forked from extern/egroupware
Add a global signature to change messages. Set it in notifications site configuration.
This commit is contained in:
parent
a3513a9797
commit
a0738bd2f4
@ -144,6 +144,7 @@ abstract class bo_tracking
|
||||
* @var int;
|
||||
*/
|
||||
var $user;
|
||||
|
||||
/**
|
||||
* Saved user preferences, if send_notifications need to set an other language
|
||||
*
|
||||
@ -269,6 +270,7 @@ abstract class bo_tracking
|
||||
* - 'subject' string subject line for the notification of $data,$old, defaults to link-title
|
||||
* - 'link' string of link to view $data
|
||||
* - 'sender' sender of email
|
||||
* - 'skip_notify' array of email addresses that should _not_ be notified
|
||||
* @param array $data current entry
|
||||
* @param array $old=null old/last state of the entry or null for a new entry
|
||||
* @return mixed
|
||||
@ -522,6 +524,11 @@ abstract class bo_tracking
|
||||
//error_log("do_notificaton() adding user=$this->user to email_sent, to not notify him");
|
||||
$email_sent[] = $GLOBALS['egw']->accounts->id2name($this->user,'account_email');
|
||||
}
|
||||
$skip_notify = $this->get_config('skip_notify',$data,$old);
|
||||
if($skip_notify && is_array($skip_notify))
|
||||
{
|
||||
$email_sent = array_merge($email_sent, $skip_notify);
|
||||
}
|
||||
|
||||
// entry creator
|
||||
if ($this->creator_field && ($email = $GLOBALS['egw']->accounts->id2name($data[$this->creator_field],'account_email')) &&
|
||||
@ -923,6 +930,10 @@ abstract class bo_tracking
|
||||
{
|
||||
$body .= "</table>\n";
|
||||
}
|
||||
if($sig = $this->get_signature($data,$old,$receiver))
|
||||
{
|
||||
$body .= ($html_email ? '<br />':'') . "\n$sig";
|
||||
}
|
||||
return $body;
|
||||
}
|
||||
|
||||
@ -1029,4 +1040,26 @@ abstract class bo_tracking
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a (global) signature to append to the change notificaiton
|
||||
*/
|
||||
protected function get_signature($data, $old, $receiver)
|
||||
{
|
||||
$config = config::read('notifications');
|
||||
|
||||
if(class_exists($this->app. '_merge'))
|
||||
{
|
||||
$merge_class = $this->app.'_merge';
|
||||
$merge = new $merge_class();
|
||||
$sig = $merge->merge_string($config['signature'], array($data[$this->id_field]), $error, 'text/html');
|
||||
if($error)
|
||||
{
|
||||
error_log($error);
|
||||
return $config['signature'];
|
||||
}
|
||||
return $sig;
|
||||
}
|
||||
return $config['signature'];
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,13 @@
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="th">
|
||||
<td colspan="2">{lang_Signature}</td>
|
||||
</tr>
|
||||
<tr class = "row_off">
|
||||
<td>{lang_Signature_added_to_every_change_notification}<br />{lang_You_can_also_use} <a href="index.php?menuaction=addressbook.addressbook_merge.show_replacements">{lang_addressbook}</a> {lang_placeholders_with_user/_prefix}<br />{lang_{{user/n_fn}}}</td>
|
||||
<td><textarea rows="7" cols="50" name="newsettings[signature]">{value_signature}</textarea></td>
|
||||
</tr>
|
||||
<!-- END body -->
|
||||
<!-- BEGIN footer -->
|
||||
<tr valign="bottom" style="height: 30px;">
|
||||
|
Loading…
Reference in New Issue
Block a user