Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SondagesPro-LimeSurvey-plugin
recomputeExpression
Commits
41817eb1
Commit
41817eb1
authored
Apr 24, 2019
by
Denis Chenu
Browse files
[fix] 500 error when checking
parent
788a8b61
Changes
2
Hide whitespace changes
Inline
Side-by-side
js/recompute.js
View file @
41817eb1
...
...
@@ -89,7 +89,7 @@ function addUpdateResponse()
if
(
$
(
'
.menubar
'
).
eq
(
1
).
find
(
'
.menubar-main
'
).
find
(
"
.menubar-left:last
"
).
length
)
{
$
(
'
.menubar
'
).
eq
(
1
).
find
(
'
.menubar-main
'
).
find
(
"
.menubar-left:last
"
).
append
(
"
<a class='btn btn-small updateanswer' data-recompute='1'><i class='icon-refresh'></i>Update This Answer</a>
"
);
}
else
{
$
(
'
#browsermenubarid .container-fluid .col-md-12
'
).
append
(
"
<a class='btn btn-small updateanswer' data-recompute='1'><i class='icon-refresh'></i>Update all submitted answers</a>
"
);
$
(
'
#browsermenubarid .container-fluid .col-md-12
'
).
append
(
"
<a class='btn
btn-default
btn-small updateanswer' data-recompute='1'><i class='icon-refresh'></i>Update all submitted answers</a>
"
);
}
$
(
"
[data-recompute]
"
).
click
(
function
(){
$
(
"
#updatedsrid
"
).
remove
();
...
...
recomputeExpression.php
View file @
41817eb1
...
...
@@ -7,7 +7,7 @@
* @copyright 2013 Denis Chenu <http://sondages.pro>
* @copyright 2013 Practice Lab <https://www.practicelab.com/>
* @license GPL v3
* @version 2.0.
1
* @version 2.0.
2
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -33,6 +33,7 @@ class recomputeExpression extends PluginBase
private
$aUpdatedArray
=
array
();
private
$_iSurveyId
;
private
$_iResponseId
;
protected
$settings
=
array
(
'bAllowNonAdmin'
=>
array
(
...
...
@@ -92,7 +93,7 @@ class recomputeExpression extends PluginBase
public
function
actionRecompute
()
{
// Needed parameters sid: the survey id
$this
->
_
_
iSurveyId
=
$iSurveyId
=
(
int
)
Yii
::
app
()
->
request
->
getQuery
(
'sid'
,
0
);
$this
->
_iSurveyId
=
$iSurveyId
=
(
int
)
Yii
::
app
()
->
request
->
getQuery
(
'sid'
,
0
);
// Optionnal parameters : token
$sToken
=
(
string
)
Yii
::
app
()
->
request
->
getQuery
(
'token'
,
""
);
// Optionnal parameters : srid
...
...
@@ -149,7 +150,7 @@ class recomputeExpression extends PluginBase
if
(
$oResponse
)
{
$iResponseId
=
$oResponse
->
id
;
$this
->
_iResponseId
=
$iResponseId
=
$oResponse
->
id
;
$aOldAnswers
=
$oResponse
->
attributes
;
// Not needed but keep it
if
(
isset
(
$oResponse
->
token
)
&&
$oResponse
->
token
)
...
...
@@ -241,7 +242,7 @@ class recomputeExpression extends PluginBase
if
(
!
empty
(
$equationAttribute
)
&&
!
empty
(
$equationAttribute
->
value
))
{
$equation
=
$equationAttribute
->
value
;
}
$newVal
=
$oResponse
->
$column
=
$this
->
this
->
_EMProcessString
(
$equation
);
$newVal
=
$oResponse
->
$column
=
$this
->
_EMProcessString
(
$equation
);
if
(
$oldVal
!=
$newVal
&&
(
$oldVal
&&
$newVal
))
{
$updatedValues
[
'old'
][
$sColumnName
]
=
$oldVal
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment