Merge pull request #132 from tomolimo/4.0/bugfixes
Fixed issues with notifications
This commit is contained in:
@@ -75,7 +75,7 @@ class PluginProcessmakerNotificationTargetCase extends PluginProcessmakerNotific
|
||||
|
||||
|
||||
/**
|
||||
* Add users from $options['glpi_send_email']['to']
|
||||
* Add users from $email_param['recipients']
|
||||
*
|
||||
* @param array $email_param should contain 'recipients'
|
||||
*
|
||||
@@ -98,13 +98,30 @@ class PluginProcessmakerNotificationTargetCase extends PluginProcessmakerNotific
|
||||
}
|
||||
}
|
||||
|
||||
$query = $this->getDistinctUserSql()."
|
||||
FROM `glpi_users` ".
|
||||
$this->getProfileJoinSql()."
|
||||
WHERE `glpi_users`.`id` IN (".implode(',', $id_list).")";
|
||||
$user = new User();
|
||||
foreach ($id_list as $users_id) {
|
||||
if ($user->getFromDB($users_id)) {
|
||||
|
||||
foreach ($DB->request($query) as $data) {
|
||||
$this->addToRecipientsList($data);
|
||||
$author_email = UserEmail::getDefaultForUser($user->fields['id']);
|
||||
$author_lang = $user->fields["language"];
|
||||
$author_id = $user->fields['id'];
|
||||
|
||||
if (empty($author_lang)) {
|
||||
$author_lang = $CFG_GLPI["language"];
|
||||
}
|
||||
if (empty($author_id)) {
|
||||
$author_id = -1;
|
||||
}
|
||||
|
||||
$user = [
|
||||
'language' => $author_lang,
|
||||
'users_id' => $author_id
|
||||
];
|
||||
if ($this->isMailMode()) {
|
||||
$user['email'] = $author_email;
|
||||
}
|
||||
$this->addToRecipientsList($user);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($email_list as $email){
|
||||
|
||||
@@ -124,7 +124,7 @@ class PluginProcessmakerNotificationTargetProcessmaker extends NotificationTarge
|
||||
$res = $PM_DB->query("SELECT APP_DATA, APP_TITLE, APP_DESCRIPTION FROM APPLICATION WHERE APP_NUMBER = ".$options['case']->fields['id']);
|
||||
if ($res && $PM_DB->numrows($res) == 1) {
|
||||
// get all the case variables from $PM_DB
|
||||
$caserow = $PM_DB->fetch_assoc($res);
|
||||
$caserow = $PM_DB->fetchAssoc($res);
|
||||
$case_variables = unserialize($caserow['APP_DATA']);
|
||||
$excluded_re = '/^(' . implode('|', $excluded) . ')$/u';
|
||||
foreach ($case_variables as $key => $val) {
|
||||
@@ -197,7 +197,8 @@ class PluginProcessmakerNotificationTargetProcessmaker extends NotificationTarge
|
||||
function getContentHeader() {
|
||||
|
||||
if ($this->getMode() == \Notification_NotificationTemplate::MODE_MAIL
|
||||
&& MailCollector::getNumberOfActiveMailCollectors()
|
||||
&& MailCollector::countActiveCollectors()
|
||||
&& $this->allowResponse()
|
||||
) {
|
||||
return NotificationTargetTicket::HEADERTAG.' '.__('To answer by email, write above this line').' '.
|
||||
NotificationTargetTicket::HEADERTAG;
|
||||
@@ -213,7 +214,8 @@ class PluginProcessmakerNotificationTargetProcessmaker extends NotificationTarge
|
||||
function getContentFooter() {
|
||||
|
||||
if ($this->getMode() == \Notification_NotificationTemplate::MODE_MAIL
|
||||
&& MailCollector::getNumberOfActiveMailCollectors()
|
||||
&& MailCollector::countActiveCollectors()
|
||||
&& $this->allowResponse()
|
||||
) {
|
||||
return NotificationTargetTicket::FOOTERTAG.' '.__('To answer by email, write under this line').' '.
|
||||
NotificationTargetTicket::FOOTERTAG;
|
||||
|
||||
@@ -238,7 +238,7 @@ class PluginProcessmakerNotificationTargetTask extends PluginProcessmakerNotific
|
||||
|
||||
$this->addTarget(Notification::AUTHOR, __('Requester'), PluginProcessmakerNotificationTargetProcessmaker::PM_USER_TYPE);
|
||||
|
||||
if (strpos($event, 'task_update_') === 0) {
|
||||
if (strpos($event, 'task_reassign_') === 0) {
|
||||
$this->addTarget(Notification::OLD_TECH_IN_CHARGE,
|
||||
__('Former technician in charge of the task'));
|
||||
}
|
||||
@@ -309,17 +309,33 @@ class PluginProcessmakerNotificationTargetTask extends PluginProcessmakerNotific
|
||||
* @param $options
|
||||
*/
|
||||
function addOldAssignTechnician($options = []) {
|
||||
global $DB;
|
||||
//global $DB;
|
||||
global $CFG_GLPI;
|
||||
|
||||
// In case of delete task pass user id
|
||||
if (isset($options['old_users_id_tech'])) {
|
||||
$query = $this->getDistinctUserSql()."
|
||||
FROM `glpi_users` ".
|
||||
$this->getProfileJoinSql()."
|
||||
WHERE `glpi_users`.`id` = '".$options['old_users_id_tech']."'";
|
||||
|
||||
foreach ($DB->request($query) as $data) {
|
||||
$this->addToRecipientsList($data);
|
||||
$user = new User();
|
||||
if ($user->getFromDB($options['old_users_id_tech'])) {
|
||||
|
||||
$author_email = UserEmail::getDefaultForUser($user->fields['id']);
|
||||
$author_lang = $user->fields["language"];
|
||||
$author_id = $user->fields['id'];
|
||||
|
||||
if (empty($author_lang)) {
|
||||
$author_lang = $CFG_GLPI["language"];
|
||||
}
|
||||
if (empty($author_id)) {
|
||||
$author_id = -1;
|
||||
}
|
||||
|
||||
$user = [
|
||||
'language' => $author_lang,
|
||||
'users_id' => $author_id
|
||||
];
|
||||
if ($this->isMailMode()) {
|
||||
$user['email'] = $author_email;
|
||||
}
|
||||
$this->addToRecipientsList($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
$events = [];
|
||||
|
||||
if (isset($params['start'])) {
|
||||
$params['begin'] = '2000-01-01 00:00:00';
|
||||
$params['begin'] = $params['start']; //'2000-01-01 00:00:00';
|
||||
if ($params['type'] == 'group') {
|
||||
$params['who_group'] = $params['who'];
|
||||
$params['whogroup'] = $params['who'];
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<compatibility>9.4</compatibility>
|
||||
</version>
|
||||
<version>
|
||||
<num>4.0.5</num>
|
||||
<num>4.0.8</num>
|
||||
<compatibility>9.5</compatibility>
|
||||
</version>
|
||||
</versions>
|
||||
|
||||
Reference in New Issue
Block a user