Skip to content
Snippets Groups Projects
Commit 5353fd4b authored by Peter Rotich's avatar Peter Rotich
Browse files

tasks: Log status change events.

parent fc60c1ef
No related branches found
No related tags found
No related merge requests found
......@@ -1104,6 +1104,8 @@ class DynamicFormEntry extends VerySimpleModel {
* Parameters:
* $filter - (callback) function to receive each field and return
* boolean true if the field's errors are significant
* $options - options to pass to form and fields.
*
*/
function isValid($filter=false, $options=array()) {
......
......@@ -437,6 +437,7 @@ class Task extends TaskModel implements RestrictedAccess, Threadable {
function setStatus($status, $comments='') {
global $thisstaff;
$ecb = null;
switch($status) {
case 'open':
if ($this->isOpen())
......@@ -444,6 +445,10 @@ class Task extends TaskModel implements RestrictedAccess, Threadable {
$this->reopen();
$this->closed = null;
$ecb = function ($t) {
$t->logEvent('reopened', false, null, 'closed');
};
break;
case 'closed':
if ($this->isClosed())
......@@ -451,6 +456,9 @@ class Task extends TaskModel implements RestrictedAccess, Threadable {
$this->close();
$this->closed = SqlFunction::NOW();
$ecb = function($t) {
$t->logEvent('closed');
};
break;
default:
return false;
......@@ -459,6 +467,9 @@ class Task extends TaskModel implements RestrictedAccess, Threadable {
if (!$this->save(true))
return false;
// Log events via callback
if ($ecb) $ecb($this);
if ($comments) {
$errors = array();
$this->postNote(array(
......@@ -528,8 +539,7 @@ class Task extends TaskModel implements RestrictedAccess, Threadable {
if ($thisstaff && $thisstaff->getId() == $assignee->getId())
$evd['claim'] = true;
else
$evd['staff'] = $assignee;
$evd['staff'] = array($assignee->getId(), $assignee->getName());
}
} elseif ($assignee instanceof Team) {
if ($this->getTeamId() == $assignee->getId()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment