Skip to content

Commit

Permalink
Fixed issue #7199: Raising the token's "uses left" value from 0 to X …
Browse files Browse the repository at this point in the history
…doesn't remove the "completed" date
  • Loading branch information
c-schmitz committed Jan 22, 2013
1 parent c4cd988 commit a5cb66b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions application/models/Tokens_dynamic.php
Expand Up @@ -337,6 +337,26 @@ function createTokens($iSurveyID)

return array($newtokencount,count($tkresult));
}


/**
* This method is invoked before saving a record (after validation, if any).
* The default implementation raises the {@link onBeforeSave} event.
* You may override this method to do any preparation work for record saving.
* Use {@link isNewRecord} to determine whether the saving is
* for inserting or updating record.
* Make sure you call the parent implementation so that the event is raised properly.
* @return boolean whether the saving should be executed. Defaults to true.
*/
public function beforeSave()
{
// Postgres delivers bytea fields as streams :-o - if this is not done it looks like Postgres saves something unexpected
if ($this->usesleft>0)
{
$this->completed='N';
}
return parent::beforeSave();
}

public function search()
{
Expand Down

0 comments on commit a5cb66b

Please sign in to comment.