fixed no more notifications send, if notification of group-members is NOT enabled

This commit is contained in:
Ralf Becker 2012-03-13 15:47:55 +00:00
parent e09a3fac51
commit 7f45afcc82

View File

@ -487,9 +487,11 @@ abstract class bo_tracking
if ($this->creator_field && ($email = $GLOBALS['egw']->accounts->id2name($data[$this->creator_field],'account_email')) &&
!in_array($email, $email_sent))
{
$this->send_notification($data,$old,$email,$data[$this->creator_field],'notify_creator');
if ($this->send_notification($data,$old,$email,$data[$this->creator_field],'notify_creator'))
{
$email_sent[] = $email;
}
}
// members of group when entry owned by group
if ($this->creator_field && $GLOBALS['egw']->accounts->get_type($data[$this->creator_field]) == 'g')
@ -499,11 +501,13 @@ abstract class bo_tracking
if (($email = $GLOBALS['egw']->accounts->id2name($u,'account_email')) &&
!in_array($email, $email_sent))
{
$this->send_notification($data,$old,$email,$u,'notify_owner_group_member');
if ($this->send_notification($data,$old,$email,$u,'notify_owner_group_member'))
{
$email_sent[] = $email;
}
}
}
}
// assigned / responsible users
if ($this->assigned_field)
@ -530,25 +534,29 @@ abstract class bo_tracking
{
if (($email = $GLOBALS['egw']->accounts->id2name($assignee,'account_email')) && !in_array($email, $email_sent))
{
$this->send_notification($data,$old,$email,$assignee,'notify_assigned',
in_array($assignee,$assignees) !== in_array($assignee,$old_assignees) || $deleted); // assignment changed
if ($this->send_notification($data,$old,$email,$assignee,'notify_assigned',
in_array($assignee,$assignees) !== in_array($assignee,$old_assignees) || $deleted)) // assignment changed
{
$email_sent[] = $email;
}
}
}
else // item assignee is a group
{
foreach($GLOBALS['egw']->accounts->members($assignee,true) as $u)
{
if (($email = $GLOBALS['egw']->accounts->id2name($u,'account_email')) && !in_array($email, $email_sent))
{
$this->send_notification($data,$old,$email,$u,'notify_assigned',
in_array($u,$assignees) !== in_array($u,$old_assignees) || $deleted); // assignment changed
if ($this->send_notification($data,$old,$email,$u,'notify_assigned',
in_array($u,$assignees) !== in_array($u,$old_assignees) || $deleted)) // assignment changed
{
$email_sent[] = $email;
}
}
}
}
}
}
// notification copies
if (($copies = $this->get_config('copy',$data,$old)))
@ -558,11 +566,13 @@ abstract class bo_tracking
{
if (strchr($email,'@') !== false && !in_array($email, $email_sent))
{
$this->send_notification($data,$old,$email,$lang,'notify_copy');
if ($this->send_notification($data,$old,$email,$lang,'notify_copy'))
{
$email_sent[] = $email;
}
}
}
}
// restore the user enviroment
if ($this->save_prefs)
@ -593,7 +603,7 @@ abstract class bo_tracking
* @param string $check=null pref. to check if a notification is wanted
* @param boolean $assignment_changed=true the assignment of the user $user_or_lang changed
* @param boolean $deleted=null can be set to true to let the tracking know the item got deleted or undelted
* @return boolean true on success or false on error (error-message is in $this->errors)
* @return boolean true on success or false if notification not requested or error (error-message is in $this->errors)
*/
public function send_notification($data,$old,$email,$user_or_lang,$check=null,$assignment_changed=true,$deleted=null)
{