Commit 32e8fc33 authored by Chenu Denis's avatar Chenu Denis

[fix] Use keepTrackOn settings

parent 282276fe
......@@ -63,6 +63,18 @@ class updateTokenAfterSubmit extends PluginBase {
$oToken->completed = "N";
$oToken->usesleft++;
}
if($this->get('keepTrackOn','Survey',$surveyId,"")) {
$keepTrackOn = $this->get('keepTrackOn','Survey',$surveyId,"");
$currentTrack = isset($oToken->$keepTrackOn) ? $oToken->$keepTrackOn : null;
if(!is_null($currentTrack)) {
$numberTrack = 0;
if(substr($currentTrack, 0, strlen("updateTokenAfterSubmit-")) === "updateTokenAfterSubmit-") {
$numberTrack = intval(substr($currentTrack,strlen("updateTokenAfterSubmit-")));
}
$numberTrack++;
$oToken->$keepTrackOn = "updateTokenAfterSubmit-".$numberTrack;
}
}
if(!$oToken->save()) {
$this->log("Unable to update token code {$token} in survey {$surveyId}",'error');
$this->log(sprintf("With error %",CVarDumper::dumpAsString($oToken->getErrors(), 2, false)),'warning');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment