refs #1245 - Subtask - Added option to events to avoid recursive calls
This commit is contained in:
@@ -234,15 +234,16 @@ class Subtask extends Base
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $values Form values
|
* @param array $values Form values
|
||||||
|
* @param array $options Additional options. If passed [quietly => true] - will not be called an event
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function update(array $values)
|
public function update(array $values, array $options = null)
|
||||||
{
|
{
|
||||||
$this->prepare($values);
|
$this->prepare($values);
|
||||||
$subtask = $this->getById($values['id']);
|
$subtask = $this->getById($values['id']);
|
||||||
$result = $this->db->table(self::TABLE)->eq('id', $values['id'])->save($values);
|
$result = $this->db->table(self::TABLE)->eq('id', $values['id'])->save($values);
|
||||||
|
|
||||||
if ($result) {
|
if ($result && isset($options['quietly']) && $options['quietly']) {
|
||||||
$event = $subtask;
|
$event = $subtask;
|
||||||
$event['changes'] = array_diff_assoc($values, $subtask);
|
$event['changes'] = array_diff_assoc($values, $subtask);
|
||||||
$this->container['dispatcher']->dispatch(self::EVENT_UPDATE, new SubtaskEvent($event));
|
$this->container['dispatcher']->dispatch(self::EVENT_UPDATE, new SubtaskEvent($event));
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ class SubtaskTimeTracking extends Base
|
|||||||
'id' => $subtask['id'],
|
'id' => $subtask['id'],
|
||||||
'time_spent' => $subtask['time_spent'] + $time_spent,
|
'time_spent' => $subtask['time_spent'] + $time_spent,
|
||||||
'task_id' => $subtask['task_id'],
|
'task_id' => $subtask['task_id'],
|
||||||
));
|
), array('quietly' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user