"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "inc/notificationtargetcommonitilobject.class.php" between
glpi-9.3.3.tgz and glpi-9.4.0.tgz

About: GLPI is an IT and asset management software (Information Resource Manager).

notificationtargetcommonitilobject.class.php  (glpi-9.3.3.tgz):notificationtargetcommonitilobject.class.php  (glpi-9.4.0.tgz)
skipping to change at line 39 skipping to change at line 39
* along with GLPI. If not, see <http://www.gnu.org/licenses/>. * along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
*/ */
if (!defined('GLPI_ROOT')) { if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly"); die("Sorry. You can't access this file directly");
} }
abstract class NotificationTargetCommonITILObject extends NotificationTarget { abstract class NotificationTargetCommonITILObject extends NotificationTarget {
public $private_profiles = [];
public $html_tags = [ public $html_tags = [
'##change.solution.description##', '##change.solution.description##',
'##followup.description##', '##followup.description##',
'##linkedticket.content##', '##linkedticket.content##',
'##problem.solution.description##', '##problem.solution.description##',
'##ticket.content##', '##ticket.content##',
'##ticket.description##', '##ticket.description##',
'##ticket.solution.description##' '##ticket.solution.description##'
]; ];
/** /**
* @param $entity (default '') * @param $entity (default '')
* @param $event (default '') * @param $event (default '')
* @param $object (default null) * @param $object (default null)
* @param $options array * @param $options array
**/ **/
function __construct($entity = '', $event = '', $object = null, $options = [] ) { function __construct($entity = '', $event = '', $object = null, $options = [] ) {
parent::__construct($entity, $event, $object, $options); parent::__construct($entity, $event, $object, $options);
$this->options['sendprivate'] = false; if (isset($options['followup_id'])) {
$this->options['sendprivate'] = $options['is_private'];
}
if (isset($options['task_id'])) {
$this->options['sendprivate'] = $options['is_private'];
}
}
function validateSendTo($event, array $infos, $notify_me = false) {
// Check global ones for notification to myself
if (!parent::validateSendTo($event, $infos, $notify_me)) {
return false;
}
// Private object and no right to see private items : do not send
if ($this->isPrivate()
&& (!isset($infos['additionnaloption']['show_private'])
|| !$infos['additionnaloption']['show_private'])) {
return false;
}
return true;
} }
/** /**
* Get notification subject prefix * Get notification subject prefix
* *
* @param $event Event name (default '') * @param $event Event name (default '')
* *
* @return string * @return string
**/ **/
function getSubjectPrefix($event = '') { function getSubjectPrefix($event = '') {
skipping to change at line 89 skipping to change at line 115
/** /**
* Get events related to Itil Object * Get events related to Itil Object
* *
* @since 9.2 * @since 9.2
* *
* @return array of events (event key => event label) * @return array of events (event key => event label)
**/ **/
function getEvents() { function getEvents() {
$events = ['requester_user' => __('New user in requesters'), $events = [
'requester_group' => __('New group in requesters'), 'requester_user' => __('New user in requesters'),
'observer_user' => __('New user in observers'), 'requester_group' => __('New group in requesters'),
'observer_group' => __('New group in observers'), 'observer_user' => __('New user in observers'),
'assign_user' => __('New user in assignees'), 'observer_group' => __('New group in observers'),
'assign_group' => __('New group in assignees'), 'assign_user' => __('New user in assignees'),
'assign_supplier' => __('New supplier in assignees')]; 'assign_group' => __('New group in assignees'),
'assign_supplier' => __('New supplier in assignees'),
'add_task' => __('New task'),
'update_task' => __('Update of a task'),
'delete_task' => __('Deletion of a task'),
'add_followup' => __("New followup"),
'update_followup' => __('Update of a followup'),
'delete_followup' => __('Deletion of a followup'),
];
asort($events); asort($events);
return $events; return $events;
} }
/** /**
* Add linked users to the notified users list * Add linked users to the notified users list
* *
* @param integer $type type of linked users * @param integer $type type of linked users
* *
* @return void * @return void
*/ */
function addLinkedUserByType($type) { function addLinkedUserByType($type) {
global $DB, $CFG_GLPI; global $DB, $CFG_GLPI;
$userlinktable = getTableForItemType($this->obj->userlinkclass); $userlinktable = getTableForItemType($this->obj->userlinkclass);
$fkfield = $this->obj->getForeignKeyField(); $fkfield = $this->obj->getForeignKeyField();
//Look for the user by his id //Look for the user by his id
$query = $this->getDistinctUserSql().", $criteria = ['LEFT JOIN' => [
`$userlinktable`.`use_notification` AS notif, User::getTable() => [
`$userlinktable`.`alternative_email` AS altemail 'ON' => [
FROM `$userlinktable` $userlinktable => 'users_id',
LEFT JOIN `glpi_users` ON (`$userlinktable`.`users_id` = `glpi_us User::getTable() => 'id'
ers`.`id`)". ]
$this->getProfileJoinSql()." ]
WHERE `$userlinktable`.`$fkfield` = '".$this->obj->fields["id"]." ]] + $this->getDistinctUserCriteria() + $this->getProfileJoinCriteria();
' $criteria['FROM'] = $userlinktable;
AND `$userlinktable`.`type` = '$type'"; $criteria['FIELDS'] = array_merge(
$criteria['FIELDS'], [
"$userlinktable.use_notification AS notif",
"$userlinktable.alternative_email AS altemail"
]
);
$criteria['WHERE']["$userlinktable.$fkfield"] = $this->obj->fields['id'];
$criteria['WHERE']["$userlinktable.type"] = $type;
foreach ($DB->request($query) as $data) { $iterator = $DB->request($criteria);
while ($data = $iterator->next()) {
//Add the user email and language in the notified users list //Add the user email and language in the notified users list
if ($data['notif']) { if ($data['notif']) {
$author_email = UserEmail::getDefaultForUser($data['users_id']); $author_email = UserEmail::getDefaultForUser($data['users_id']);
$author_lang = $data["language"]; $author_lang = $data["language"];
$author_id = $data['users_id']; $author_id = $data['users_id'];
if (!empty($data['altemail']) if (!empty($data['altemail'])
&& ($data['altemail'] != $author_email) && ($data['altemail'] != $author_email)
&& NotificationMailing::isUserAddressValid($data['altemail'])) { && NotificationMailing::isUserAddressValid($data['altemail'])) {
$author_email = $data['altemail']; $author_email = $data['altemail'];
skipping to change at line 351 skipping to change at line 395
* @param $options array * @param $options array
* *
* @return void * @return void
*/ */
function addValidationApprover($options = []) { function addValidationApprover($options = []) {
global $DB; global $DB;
if (isset($options['validation_id'])) { if (isset($options['validation_id'])) {
$validationtable = getTableForItemType($this->obj->getType().'Validatio n'); $validationtable = getTableForItemType($this->obj->getType().'Validatio n');
$query = $this->getDistinctUserSql()." $criteria = ['LEFT JOIN' => [
FROM `$validationtable` User::getTable() => [
LEFT JOIN `glpi_users` 'ON' => [
ON (`glpi_users`.`id` = `$validationtable`.`users_id_val $validationtable => 'users_id_validate',
idate`)". User::getTable() => 'id'
$this->getProfileJoinSql()." ]
WHERE `$validationtable`.`id` = '".$options['validation_id']." ]
'"; ]] + $this->getDistinctUserCriteria() + $this->getProfileJoinCriteria()
;
$criteria['FROM'] = $validationtable;
$criteria['WHERE']["$validationtable.id"] = $options['validation_id'];
foreach ($DB->request($query) as $data) { $iterator = $DB->request($criteria);
while ($data = $iterator->next()) {
$this->addToRecipientsList($data); $this->addToRecipientsList($data);
} }
} }
} }
/** /**
* Add requester related to the ITIL object validation * Add requester related to the ITIL object validation
* *
* @param array $options Options * @param array $options Options
* *
* @return void * @return void
**/ **/
function addValidationRequester($options = []) { function addValidationRequester($options = []) {
global $DB; global $DB;
if (isset($options['validation_id'])) { if (isset($options['validation_id'])) {
$validationtable = getTableForItemType($this->obj->getType().'Validatio n'); $validationtable = getTableForItemType($this->obj->getType().'Validatio n');
$query = $this->getDistinctUserSql()." $criteria = ['LEFT JOIN' => [
FROM `$validationtable` User::getTable() => [
LEFT JOIN `glpi_users` 'ON' => [
ON (`glpi_users`.`id` = `$validationtable`.`users_id`)". $validationtable => 'users_id',
$this->getProfileJoinSql()." User::getTable() => 'id'
WHERE `$validationtable`.`id` = '".$options['validation_id']." ]
'"; ]
]] + $this->getDistinctUserCriteria() + $this->getProfileJoinCriteria()
;
$criteria['FROM'] = $validationtable;
$criteria['WHERE']["$validationtable.id"] = $options['validation_id'];
foreach ($DB->request($query) as $data) { $iterator = $DB->request($criteria);
while ($data = $iterator->next()) {
$this->addToRecipientsList($data); $this->addToRecipientsList($data);
} }
} }
} }
/** /**
* Add author related to the followup * Add author related to the followup
* *
* @param array $options Options * @param array $options Options
* *
* @return void * @return void
*/ */
function addFollowupAuthor($options = []) { function addFollowupAuthor($options = []) {
global $DB; global $DB;
if (isset($options['followup_id'])) { if (isset($options['followup_id'])) {
$followuptable = getTableForItemType($this->obj->getType().'Followup'); $followuptable = getTableForItemType($this->obj->getType().'Followup');
$query = $this->getDistinctUserSql()." $criteria = array_merge_recursive(
FROM `$followuptable` ['INNER JOIN' => [
INNER JOIN `glpi_users` User::getTable() => [
ON (`glpi_users`.`id` = `$followuptable`.`users_id`)". 'ON' => [
$this->getProfileJoinSql()." $followuptable => 'users_id',
WHERE `$followuptable`.`id` = '".$options['followup_id']."'"; User::getTable() => 'id'
]
]
]],
$this->getDistinctUserCriteria() + $this->getProfileJoinCriteria()
);
$criteria['FROM'] = $followuptable;
$criteria['WHERE']["$followuptable.id"] = $options['followup_id'];
foreach ($DB->request($query) as $data) { $iterator = $DB->request($criteria);
while ($data = $iterator->next()) {
$this->addToRecipientsList($data); $this->addToRecipientsList($data);
} }
} }
} }
/** /**
* Add task author * Add task author
* *
* @param array $options Options * @param array $options Options
* *
* @return void * @return void
*/ */
function addTaskAuthor($options = []) { function addTaskAuthor($options = []) {
global $DB; global $DB;
// In case of delete task pass user id // In case of delete task pass user id
if (isset($options['task_users_id'])) { if (isset($options['task_users_id'])) {
$query = $this->getDistinctUserSql()." $criteria = $this->getDistinctUserCriteria() + $this->getProfileJoinCri
FROM `glpi_users` ". teria();
$this->getProfileJoinSql()." $criteria['FROM'] = User::getTable();
WHERE `glpi_users`.`id` = '".$options['task_users_id']."'"; $criteria['WHERE'][User::getTable() . '.id'] = $options['task_users_id'
];
foreach ($DB->request($query) as $data) { $iterator = $DB->request($criteria);
while ($data = $iterator->next()) {
$this->addToRecipientsList($data); $this->addToRecipientsList($data);
} }
} else if (isset($options['task_id'])) { } else if (isset($options['task_id'])) {
$tasktable = getTableForItemType($this->obj->getType().'Task'); $tasktable = getTableForItemType($this->obj->getType().'Task');
$query = $this->getDistinctUserSql()." $criteria = array_merge_recursive(
FROM `$tasktable` ['INNER JOIN' => [
INNER JOIN `glpi_users` ON (`glpi_users`.`id` = `$tasktable`.` User::getTable() => [
users_id`)". 'ON' => [
$this->getProfileJoinSql()." $tasktable => 'users_id',
WHERE `$tasktable`.`id` = '".$options['task_id']."'"; User::getTable() => 'id'
]
]
]],
$this->getDistinctUserCriteria() + $this->getProfileJoinCriteria()
);
$criteria['FROM'] = $tasktable;
$criteria['WHERE']["$tasktable.id"] = $options['task_id'];
foreach ($DB->request($query) as $data) { $iterator = $DB->request($criteria);
while ($data = $iterator->next()) {
$this->addToRecipientsList($data); $this->addToRecipientsList($data);
} }
} }
} }
/** /**
* Add user assigned to task * Add user assigned to task
* *
* @param array $options Options * @param array $options Options
* *
* @return void * @return void
*/ */
function addTaskAssignUser($options = []) { function addTaskAssignUser($options = []) {
global $DB; global $DB;
// In case of delete task pass user id // In case of delete task pass user id
if (isset($options['task_users_id_tech'])) { if (isset($options['task_users_id_tech'])) {
$query = $this->getDistinctUserSql()." $criteria = $this->getDistinctUserCriteria() + $this->getProfileJoinCri
FROM `glpi_users` ". teria();
$this->getProfileJoinSql()." $criteria['FROM'] = User::getTable();
WHERE `glpi_users`.`id` = '".$options['task_users_id_tech']."' $criteria['WHERE'][User::getTable() . '.id'] = $options['task_users_id_
"; tech'];
foreach ($DB->request($query) as $data) { $iterator = $DB->request($criteria);
while ($data = $iterator->next()) {
$this->addToRecipientsList($data); $this->addToRecipientsList($data);
} }
} else if (isset($options['task_id'])) { } else if (isset($options['task_id'])) {
$tasktable = getTableForItemType($this->obj->getType().'Task'); $tasktable = getTableForItemType($this->obj->getType().'Task');
$query = $this->getDistinctUserSql()." $criteria = array_merge_recursive(
FROM `$tasktable` ['INNER JOIN' => [
INNER JOIN `glpi_users` User::getTable() => [
ON (`glpi_users`.`id` = `$tasktable`.`users_id_tech`)". 'ON' => [
$this->getProfileJoinSql()." $tasktable => 'users_id_tech',
WHERE `$tasktable`.`id` = '".$options['task_id']."'"; User::getTable() => 'id'
]
]
]],
$this->getDistinctUserCriteria() + $this->getProfileJoinCriteria()
);
$criteria['FROM'] = $tasktable;
$criteria['WHERE']["$tasktable.id"] = $options['task_id'];
foreach ($DB->request($query) as $data) { $iterator = $DB->request($criteria);
while ($data = $iterator->next()) {
$this->addToRecipientsList($data); $this->addToRecipientsList($data);
} }
} }
} }
/** /**
* Add group assigned to the task * Add group assigned to the task
* *
* @since 9.1 * @since 9.1
* *
skipping to change at line 513 skipping to change at line 592
} else if (isset($options['task_id'])) { } else if (isset($options['task_id'])) {
$tasktable = getTableForItemType($this->obj->getType().'Task'); $tasktable = getTableForItemType($this->obj->getType().'Task');
foreach ($DB->request([$tasktable, 'glpi_groups'], foreach ($DB->request([$tasktable, 'glpi_groups'],
"`glpi_groups`.`id` = `$tasktable`.`groups_id_tec h` "`glpi_groups`.`id` = `$tasktable`.`groups_id_tec h`
AND `$tasktable`.`id` = '".$options['task_id']." '") as $data) { AND `$tasktable`.`id` = '".$options['task_id']." '") as $data) {
$this->addForGroup(0, $data['groups_id_tech']); $this->addForGroup(0, $data['groups_id_tech']);
} }
} }
} }
function addAdditionnalInfosForTarget() {
global $DB;
$iterator = $DB->request([
'SELECT' => ['profiles_id'],
'FROM' => 'glpi_profilerights',
'WHERE' => [
'name' => 'followup',
'rights' => ['&', ITILFollowup::SEEPRIVATE]
]
]);
while ($data = $iterator->next()) {
$this->private_profiles[$data['profiles_id']] = $data['profiles_id'];
}
}
function addAdditionnalUserInfo(array $data) {
global $DB;
if (!isset($data['users_id'])) {
return ['show_private' => 0];
}
$result = $DB->request([
'COUNT' => 'cpt',
'FROM' => 'glpi_profiles_users',
'WHERE' => [
'users_id' => $data['users_id'],
'profiles_id' => $this->private_profiles
] + getEntitiesRestrictCriteria('glpi_profiles_users', 'entities_id', $
this->getEntity(), true)
])->next();
if ($result['cpt']) {
return ['show_private' => 1];
}
return ['show_private' => 0];
}
public function getProfileJoinSql() {
Toolbox::deprecated('Use getProfileJoinCriteria');
$query = parent::getProfileJoinSql();
if ($this->isPrivate()) {
$query .= " INNER JOIN `glpi_profiles`
ON (`glpi_profiles`.`id` = `glpi_profiles_users`.`profiles_
id`
AND `glpi_profiles`.`interface` = 'central')
INNER JOIN `glpi_profilerights`
ON (`glpi_profiles`.`id` = `glpi_profilerights`.`profiles_i
d`
AND `glpi_profilerights`.`name` = 'followup'
AND `glpi_profilerights`.`rights` & ".
ITILFollowup::SEEPRIVATE.") ";
}
return $query;
}
public function getProfileJoinCriteria() {
$criteria = parent::getProfileJoinCriteria();
if ($this->isPrivate()) {
$criteria['INNER JOIN'][Profile::getTable()] = [
'ON' => [
Profile::getTable() => 'id',
Profile_User::getTable() => 'profiles_id'
]
];
$criteria['INNER JOIN'][ProfileRight::getTable()] = [
'ON' => [
ProfileRight::getTable() => 'profiles_id',
Profile::getTable() => 'id'
]
];
$criteria['WHERE'][ProfileRight::getTable() . '.name'] = 'followup';
$criteria['WHERE'][ProfileRight::getTable() . '.rights'] = ['&', ITILFo
llowup::SEEPRIVATE];
$criteria['WHERE'][Profile::getTable() . '.interface'] = 'central';
}
return $criteria;
}
function isPrivate() {
if (isset($this->options['sendprivate']) && ($this->options['sendprivate']
== 1)) {
return true;
}
return false;
}
/** /**
* Add additionnals targets for ITIL objects * Add additionnals targets for ITIL objects
* *
* @param string $event specif event to get additional targets (default '') * @param string $event specif event to get additional targets (default '')
* *
* @return void * @return void
**/ **/
function addAdditionalTargets($event = '') { function addAdditionalTargets($event = '') {
if ($event=='update') { if ($event=='update') {
skipping to change at line 763 skipping to change at line 932
$data["##$objettype.title##"] = $item->getField('name'); $data["##$objettype.title##"] = $item->getField('name');
$data["##$objettype.content##"] = $item->getField('content'); $data["##$objettype.content##"] = $item->getField('content');
$data["##$objettype.description##"] = $item->getField('content'); $data["##$objettype.description##"] = $item->getField('content');
$data["##$objettype.id##"] = sprintf("%07d", $item->getField("id ")); $data["##$objettype.id##"] = sprintf("%07d", $item->getField("id "));
$data["##$objettype.url##"] $data["##$objettype.url##"]
= $this->formatURL($options['additionnaloption']['userty pe'], = $this->formatURL($options['additionnaloption']['userty pe'],
$objettype."_".$item->getField("id")) ; $objettype."_".$item->getField("id")) ;
$tab = '$2'; $tab = '$1';
if ($_SESSION['glpiticket_timeline'] == 1) {
$tab = '$1';
}
$data["##$objettype.urlapprove##"] $data["##$objettype.urlapprove##"]
= $this->formatURL($options['additionnaloption']['use rtype'], = $this->formatURL($options['additionnaloption']['use rtype'],
$objettype."_".$item->getField("id ")."_". $objettype."_".$item->getField("id ")."_".
$item->getType().$tab); $item->getType().$tab);
$entity = new Entity(); $entity = new Entity();
if ($entity->getFromDB($this->getEntity())) { if ($entity->getFromDB($this->getEntity())) {
$data["##$objettype.entity##"] = $entity->getField('completena me'); $data["##$objettype.entity##"] = $entity->getField('completena me');
$data["##$objettype.shortentity##"] = $entity->getField('name'); $data["##$objettype.shortentity##"] = $entity->getField('name');
$data["##$objettype.entity.phone##"] = $entity->getField('phonenumbe r'); $data["##$objettype.entity.phone##"] = $entity->getField('phonenumbe r');
skipping to change at line 1010 skipping to change at line 1176
'glpi_solutiontypes', 'glpi_solutiontypes',
$itilsolution->getField('solutiontypes_id') $itilsolution->getField('solutiontypes_id')
); );
} }
$data["##$objettype.solution.description##"] = $itilsolution->getField( 'content'); $data["##$objettype.solution.description##"] = $itilsolution->getField( 'content');
} }
// Complex mode // Complex mode
if (!$simple) { if (!$simple) {
$followup_restrict = [];
$followup_restrict['items_id'] = $item->getField('id');
if (!isset($options['additionnaloption']['show_private'])
|| !$options['additionnaloption']['show_private']) {
$followup_restrict['is_private'] = 0;
}
$followup_restrict['itemtype'] = $objettype;
//Followup infos
$followups = getAllDatasFromTable('glpi_itilfollowups', $follo
wup_restrict, false, ['date_mod DESC', 'id ASC']);
$data['followups'] = [];
foreach ($followups as $followup) {
$tmp = [];
$tmp['##followup.isprivate##'] = Dropdown::getYesNo($followup['is_
private']);
$tmp['##followup.author##'] = Html::clean(getUserName($followup
['users_id']));
$tmp['##followup.requesttype##'] = Dropdown::getDropdownName('glpi_r
equesttypes',
$follow
up['requesttypes_id']);
$tmp['##followup.date##'] = Html::convDateTime($followup['dat
e']);
$tmp['##followup.description##'] = $followup['content'];
$data['followups'][] = $tmp;
}
$data["##$objettype.numberoffollowups##"] = count($data['followups']);
$data['log'] = []; $data['log'] = [];
// Use list_limit_max or load the full history ? // Use list_limit_max or load the full history ?
foreach (Log::getHistoryData($item, 0, $CFG_GLPI['list_limit_max']) as $log) { foreach (Log::getHistoryData($item, 0, $CFG_GLPI['list_limit_max']) as $log) {
$tmp = []; $tmp = [];
$tmp["##$objettype.log.date##"] = $log['date_mod']; $tmp["##$objettype.log.date##"] = $log['date_mod'];
$tmp["##$objettype.log.user##"] = $log['user_name']; $tmp["##$objettype.log.user##"] = $log['user_name'];
$tmp["##$objettype.log.field##"] = $log['field']; $tmp["##$objettype.log.field##"] = $log['field'];
$tmp["##$objettype.log.content##"] = $log['change']; $tmp["##$objettype.log.content##"] = $log['change'];
$data['log'][] = $tmp; $data['log'][] = $tmp;
} }
skipping to change at line 1041 skipping to change at line 1232
]; ];
if ($item->maybeDeleted()) { if ($item->maybeDeleted()) {
$restrict[$item->getTable() . '.is_deleted'] = 0; $restrict[$item->getTable() . '.is_deleted'] = 0;
} }
$data["##$objettype.numberofunresolved##"] $data["##$objettype.numberofunresolved##"]
= countElementsInTableForEntity($item->getTable(), $this->getEnti ty(), $restrict); = countElementsInTableForEntity($item->getTable(), $this->getEnti ty(), $restrict);
// Document // Document
$query = "SELECT `glpi_documents`.* $iterator = $DB->request([
FROM `glpi_documents` 'SELECT' => 'glpi_documents.*',
LEFT JOIN `glpi_documents_items` 'FROM' => 'glpi_documents',
ON (`glpi_documents`.`id` = `glpi_documents_items`.`documen 'LEFT JOIN' => [
ts_id`) 'glpi_documents_items' => [
WHERE `glpi_documents_items`.`itemtype` = '".$item->getType( 'ON' => [
)."' 'glpi_documents_items' => 'documents_id',
AND `glpi_documents_items`.`items_id` = '".$item->getFi 'glpi_documents' => 'id'
eld('id')."'"; ]
]
],
'WHERE' => [
'glpi_documents_items.itemtype' => $item->getType(),
'glpi_documents_items.items_id' => $item->fields['id']
]
]);
$data["documents"] = []; $data["documents"] = [];
$addtodownloadurl = ''; $addtodownloadurl = '';
if ($item->getType() == 'Ticket') { if ($item->getType() == 'Ticket') {
$addtodownloadurl = "%2526tickets_id=".$item->fields['id']; $addtodownloadurl = "%2526tickets_id=".$item->fields['id'];
} }
if ($result = $DB->query($query)) { while ($row = $iterator->next()) {
while ($row = $DB->fetch_assoc($result)) { $tmp = [];
$tmp = []; $tmp['##document.id##'] = $row['id'];
$tmp['##document.id##'] = $row['id']; $tmp['##document.name##'] = $row['name'];
$tmp['##document.name##'] = $row['name']; $tmp['##document.weblink##']
$tmp['##document.weblink##'] = $row['link'];
= $row['link'];
$tmp['##document.url##'] = $this->formatURL($options['additionnalop
$tmp['##document.url##'] = $this->formatURL($options['additionna tion']['usertype'],
loption']['usertype'], "document_".$row['id'])
"document_".$row['id ;
']); $downloadurl = "/front/document.send.php?docid=".$row['
$downloadurl = "/front/document.send.php?docid=".$ro id'];
w['id'];
$tmp['##document.downloadurl##']
$tmp['##document.downloadurl##'] = $this->formatURL($options['additionnalo
= $this->formatURL($options['additionna ption']['usertype'],
loption']['usertype'], $downloadurl.$addtodown
$downloadurl.$addtod loadurl);
ownloadurl); $tmp['##document.heading##']
$tmp['##document.heading##'] = Dropdown::getDropdownName('glpi_documen
= Dropdown::getDropdownName('glpi_docum tcategories',
entcategories', $row['document
$row['docum categories_id']);
entcategories_id']);
$tmp['##document.filename##'] $tmp['##document.filename##']
= $row['filename']; = $row['filename'];
$data['documents'][] = $tmp; $data['documents'][] = $tmp;
}
} }
$data["##$objettype.urldocument##"] $data["##$objettype.urldocument##"]
= $this->formatURL($options['additionnaloption']['userty pe'], = $this->formatURL($options['additionnaloption']['userty pe'],
$objettype."_".$item->getField("id"). '_Document_Item$1'); $objettype."_".$item->getField("id"). '_Document_Item$1');
$data["##$objettype.numberofdocuments##"] $data["##$objettype.numberofdocuments##"]
= count($data['documents']); = count($data['documents']);
//costs infos //costs infos
skipping to change at line 1236 skipping to change at line 1435
$objettype.'.assigntousers' => __('Assigned to techn icians'), $objettype.'.assigntousers' => __('Assigned to techn icians'),
$objettype.'.assigntosupplier' => __('Assigned to a sup plier'), $objettype.'.assigntosupplier' => __('Assigned to a sup plier'),
$objettype.'.groups' => _n('Requester group', $objettype.'.groups' => _n('Requester group',
'Requester groups' , Session::getPluralNumber()), 'Requester groups' , Session::getPluralNumber()),
$objettype.'.observergroups' => _n('Watcher group', ' Watcher groups', Session::getPluralNumber()), $objettype.'.observergroups' => _n('Watcher group', ' Watcher groups', Session::getPluralNumber()),
$objettype.'.assigntogroups' => __('Assigned to group s'), $objettype.'.assigntogroups' => __('Assigned to group s'),
$objettype.'.solution.type' => __('Solution type'), $objettype.'.solution.type' => __('Solution type'),
$objettype.'.solution.description' => _n('Solution', 'Solut ions', 1), $objettype.'.solution.description' => _n('Solution', 'Solut ions', 1),
$objettype.'.observerusers' => _n('Watcher', 'Watche rs', Session::getPluralNumber()), $objettype.'.observerusers' => _n('Watcher', 'Watche rs', Session::getPluralNumber()),
$objettype.'.action' => _n('Event', 'Events', 1), $objettype.'.action' => _n('Event', 'Events', 1),
'followup.date' => __('Opening date'),
'followup.isprivate' => __('Private'),
'followup.author' => __('Writer'),
'followup.description' => __('Description'),
'followup.requesttype' => __('Request source'),
$objettype.'.numberoffollowups' => _x('quantity', 'Numbe
r of followups'),
$objettype.'.numberofunresolved' => __('Number of unresol ved items'), $objettype.'.numberofunresolved' => __('Number of unresol ved items'),
$objettype.'.numberofdocuments' => _x('quantity', 'Numbe r of documents'), $objettype.'.numberofdocuments' => _x('quantity', 'Numbe r of documents'),
$objettype.'.costtime' => __('Time cost'), $objettype.'.costtime' => __('Time cost'),
$objettype.'.costfixed' => __('Fixed cost'), $objettype.'.costfixed' => __('Fixed cost'),
$objettype.'.costmaterial' => __('Material cost'), $objettype.'.costmaterial' => __('Material cost'),
$objettype.'.totalcost' => __('Total cost'), $objettype.'.totalcost' => __('Total cost'),
$objettype.'.numberofcosts' => __('Number of costs') , $objettype.'.numberofcosts' => __('Number of costs') ,
'cost.name' => sprintf(__('%1$s: %2$ s'), __('Cost'), 'cost.name' => sprintf(__('%1$s: %2$ s'), __('Cost'),
__('Name')), __('Name')),
'cost.comment' => sprintf(__('%1$s: %2$ s'), __('Cost'), 'cost.comment' => sprintf(__('%1$s: %2$ s'), __('Cost'),
skipping to change at line 1306 skipping to change at line 1511
foreach ($tags as $tag => $label) { foreach ($tags as $tag => $label) {
$this->addTagToList(['tag' => $tag, $this->addTagToList(['tag' => $tag,
'label' => $label, 'label' => $label,
'value' => true, 'value' => true,
'events' => parent::TAG_FOR_ALL_EVENTS]); 'events' => parent::TAG_FOR_ALL_EVENTS]);
} }
//Foreach global tags //Foreach global tags
$tags = ['log' => __('Historical'), $tags = ['log' => __('Historical'),
'followups' => _n('Followup', 'Followups', Session::getPlura lNumber()),
'tasks' => _n('Task', 'Tasks', Session::getPluralNumber( )), 'tasks' => _n('Task', 'Tasks', Session::getPluralNumber( )),
'costs' => _n('Cost', 'Costs', Session::getPluralNumber( )), 'costs' => _n('Cost', 'Costs', Session::getPluralNumber( )),
'authors' => _n('Requester', 'Requesters', Session::getPlu ralNumber()), 'authors' => _n('Requester', 'Requesters', Session::getPlu ralNumber()),
'suppliers' => _n('Supplier', 'Suppliers', Session::getPlura lNumber())]; 'suppliers' => _n('Supplier', 'Suppliers', Session::getPlura lNumber())];
foreach ($tags as $tag => $label) { foreach ($tags as $tag => $label) {
$this->addTagToList(['tag' => $tag, $this->addTagToList(['tag' => $tag,
'label' => $label, 'label' => $label,
'value' => false, 'value' => false,
'foreach' => true]); 'foreach' => true]);
skipping to change at line 1393 skipping to change at line 1599
'allowed_values' 'allowed_values'
=> $allowed_ti cket]]; => $allowed_ti cket]];
foreach ($tags as $tag => $label) { foreach ($tags as $tag => $label) {
$this->addTagToList(['tag' => $tag, $this->addTagToList(['tag' => $tag,
'label' => $label['text'], 'label' => $label['text'],
'value' => true, 'value' => true,
'lang' => false, 'lang' => false,
'allowed_values' => $label['allowed_values']] ); 'allowed_values' => $label['allowed_values']] );
} }
} }
/**
* Add linked users to the notified users list
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addLinkedUserByTyp
e()
*
* @param integer $type type of linked users
*
* @return void
**/
function getLinkedUserByType($type) {
Toolbox::deprecated('getLinkedUserByType() method is deprecated');
$this->addLinkedUserByType($type);
}
/**
* Add linked group to the notified user list
*
* @param integer $type type of linked groups
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addLinkedGroupByTy
pe()
*
* @return void
**/
function getLinkedGroupByType($type) {
Toolbox::deprecated('getLinkedGroupByType() method is deprecated');
$this->addLinkedGroupByType();
}
/**
* Add linked group without supervisor to the notified user list
*
* @since 0.84.1
*
* @param integer $type type of linked groups
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addLinkedGroupWith
outSupervisorByType()
*
* @return void
*/
function getLinkedGroupWithoutSupervisorByType($type) {
Toolbox::deprecated('getLinkedGroupWithoutSupervisorByType() method is dep
recated');
$this->addLinkedGroupWithoutSupervisorByType($type);
}
/**
* Add linked group supervisor to the notified user list
*
* @param integer $type type of linked groups
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addLinkedGroupSupe
rvisorByType()
*
* @return void
*/
function getLinkedGroupSupervisorByType($type) {
Toolbox::deprecated('getLinkedGroupSupervisorByType() method is deprecated
');
$this->addLinkedGroupSupervisorByType($type);
}
/**
* Add recipient
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addRecipientAddres
s()
*
* @return void
*/
function getRecipientAddress() {
Toolbox::deprecated('getRecipientAddress() method is deprecated');
return $this->addRecipientAddress();
}
/**
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addOldAssignTechni
cian()
*
* @return void
*/
function getOldAssignTechnicianAddress() {
Toolbox::deprecated('getOldAssignTechnicianAddress() method is deprecated'
);
$this->addOldAssignTechnician();
}
/**
* Get supplier related to the ITIL object
*
* @param boolean $sendprivate (false by default)
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addSupplier()
*
* @return void
**/
function getSupplierAddress($sendprivate = false) {
Toolbox::deprecated('getSupplierAddress() method is deprecated');
$this->addSupplier($sendprivate);
}
/**
* Get approuver related to the ITIL object validation
*
* @param array $options Options
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addValidationAppro
ver()
*
* @return void
**/
function getValidationApproverAddress($options = []) {
Toolbox::deprecated('getValidationApproverAddress() method is deprecated')
;
$this->addValidationApprover($options);
}
/**
* Add requester related to the ITIL object validation
*
* @param array $options Options
*
* @return void
**/
function getValidationRequesterAddress($options = []) {
Toolbox::deprecated('getValidationRequesterAddress() method is deprecated'
);
$this->addValidationRequester($options);
}
/**
* Add author related to the followup
*
* @param array $options Options
*
* @return void
*/
function getFollowupAuthor($options = []) {
Toolbox::deprecated('getFollowupAuthor() method is deprecated');
$this->addFollowupAuthor($options);
}
/**
* Add task author
*
* @param array $options Options
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addTaskAuthor()
*
* @return void
*/
function getTaskAuthor($options = []) {
Toolbox::deprecated('getTaskAuthor() method is deprecated');
$this->addTaskAuthor($options);
}
/**
* Add user assigned to task
*
* @param array $options Options
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addTaskAssignUser(
)
*
* @return void
*/
function getTaskAssignUser($options = []) {
Toolbox::deprecated('getTaskAssignUser() method is deprecated');
$this->addTaskAssignUser($options);
}
/**
* Add group assigned to the task
*
* @since 9.1
*
* @param array $options Options
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::addTaskAssignGroup
()
*
* @return void
*/
function getTaskAssignGroup($options = []) {
Toolbox::deprecated('getTaskAssignGroup() method is deprecated');
$this->addTaskAssignGroup($options);
}
/**
* Get data from an item
*
* @param CommonDBTM $item Object instance
* @param array $options Options
* @param boolean $simple (false by default)
*
* @deprecated 9.2 Use NotificationTargetCommonITILObject::getDataForObject()
*
* @return array
*/
function getDatasForObject(CommonDBTM $item, array $options, $simple = false)
{
Toolbox::deprecated('getDatasForObject() method is deprecated');
return $this->getDataForObject($item, $options, $simple);
}
} }
 End of changes. 30 change blocks. 
318 lines changed or deleted 325 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)