mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
backported Nathan r30167: Log a change in modified date to the history log, but do not send a notification if that is the only change
This commit is contained in:
parent
2963132004
commit
ec2e34ffa8
@ -56,6 +56,7 @@ class infolog_tracking extends bo_tracking
|
||||
'info_status' => 'St',
|
||||
'info_percent' => 'Pe',
|
||||
'info_datecompleted' => 'Co',
|
||||
'info_datemodified' => 'Mo',
|
||||
'info_location' => 'Lo',
|
||||
'info_startdate' => 'st',
|
||||
'info_enddate' => 'En',
|
||||
@ -88,6 +89,7 @@ class infolog_tracking extends bo_tracking
|
||||
'info_status' => 'Status',
|
||||
'info_percent' => 'Completed',
|
||||
'info_datecompleted' => 'Date completed',
|
||||
'info_datemodified' => 'Last changed',
|
||||
'info_location' => 'Location',
|
||||
'info_startdate' => 'Startdate',
|
||||
'info_enddate' => 'Enddate',
|
||||
@ -250,6 +252,48 @@ class infolog_tracking extends bo_tracking
|
||||
return $details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Track changes
|
||||
*
|
||||
* Overrides parent to log the modified date in the history, but not to send a notification
|
||||
*
|
||||
* @param array $data current entry
|
||||
* @param array $old=null old/last state of the entry or null for a new entry
|
||||
* @param int $user=null user who made the changes, default to current user
|
||||
* @param boolean $deleted=null can be set to true to let the tracking know the item got deleted or undeleted
|
||||
* @param array $changed_fields=null changed fields from ealier call to $this->changed_fields($data,$old), to not compute it again
|
||||
* @param boolean $skip_notification=false do NOT send any notification
|
||||
* @return int|boolean false on error, integer number of changes logged or true for new entries ($old == null)
|
||||
*/
|
||||
public function track(array $data,array $old=null,$user=null,$deleted=null,array $changed_fields=null,$skip_notification=false)
|
||||
{
|
||||
$this->user = !is_null($user) ? $user : $GLOBALS['egw_info']['user']['account_id'];
|
||||
|
||||
$changes = true;
|
||||
|
||||
if ($old && $this->field2history)
|
||||
{
|
||||
$changes = $this->save_history($data,$old,$deleted,$changed_fields);
|
||||
}
|
||||
|
||||
// Don't notify if the only change was to the modified date
|
||||
if(is_null($changed_fields))
|
||||
{
|
||||
$changed_fields = $this->changed_fields($data, $old);
|
||||
}
|
||||
if(is_array($changed_fields) && $changes == 1 && in_array('info_datemodified', $changed_fields))
|
||||
{
|
||||
return count($changes);
|
||||
}
|
||||
|
||||
// do not run do_notifications if we have no changes
|
||||
if ($changes && !$skip_notification && !$this->do_notifications($data,$old,$deleted))
|
||||
{
|
||||
$changes = false;
|
||||
}
|
||||
return $changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save changes to the history log
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user