mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-15 20:44:28 +01:00
- Add a parameter to pass in the class of the notification to use so we can pass in a test one
- Explicitly tell notification what type of message (plain or html) we're giving it
This commit is contained in:
parent
e43a0762fb
commit
d3c596a443
@ -129,6 +129,15 @@ abstract class Tracking
|
|||||||
*/
|
*/
|
||||||
var $notify_current_user = false;
|
var $notify_current_user = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to use for generating the notifications.
|
||||||
|
* Normally, just the notification class but for testing we pass in a mocked
|
||||||
|
* class
|
||||||
|
*
|
||||||
|
* @var notification_class
|
||||||
|
*/
|
||||||
|
protected $notification_class = notifications::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array with error-messages if track($data,$old) returns false
|
* Array with error-messages if track($data,$old) returns false
|
||||||
*
|
*
|
||||||
@ -190,7 +199,7 @@ abstract class Tracking
|
|||||||
* @param string $cf_app = null if set, custom field names get added to $field2history
|
* @param string $cf_app = null if set, custom field names get added to $field2history
|
||||||
* @return bo_tracking
|
* @return bo_tracking
|
||||||
*/
|
*/
|
||||||
function __construct($cf_app = null)
|
function __construct($cf_app = null, $notification_class=false)
|
||||||
{
|
{
|
||||||
if ($cf_app)
|
if ($cf_app)
|
||||||
{
|
{
|
||||||
@ -205,6 +214,10 @@ abstract class Tracking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($notification_class)
|
||||||
|
{
|
||||||
|
$this->notification_class = $notification_class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -766,10 +779,11 @@ abstract class Tracking
|
|||||||
{
|
{
|
||||||
// send via notification_app
|
// send via notification_app
|
||||||
try {
|
try {
|
||||||
$notification = new notifications();
|
$class = $this->notification_class;
|
||||||
|
$notification = new $class();
|
||||||
$notification->set_receivers(array($receiver));
|
$notification->set_receivers(array($receiver));
|
||||||
$notification->set_message($body_cache['text']);
|
$notification->set_message($body_cache['text'], 'plain');
|
||||||
$notification->set_message($body_cache['html']);
|
$notification->set_message($body_cache['html'], 'html');
|
||||||
$notification->set_sender($sender);
|
$notification->set_sender($sender);
|
||||||
$notification->set_subject($subject);
|
$notification->set_subject($subject);
|
||||||
$notification->set_links(array($link));
|
$notification->set_links(array($link));
|
||||||
|
Loading…
Reference in New Issue
Block a user