Thanks!
Cris
I know it's been a while, but this problem still exists, have you found any other solution?
Thanks a lot.
V.
]]> $mmail->Body = GLPIMailer::normalizeBreaks($current->fields['body_html']);
$mmail->AltBody = GLPIMailer::normalizeBreaks($current->fields['body_text']);
}
self::attachDocuments($mmail, $documents_to_attach);
to
foreach ($inline_docs as $docID => $tag) {
$current->fields['body_html'] = preg_replace([
'/src=["\'][^"\']*document\.send\.php\?docid='.$docID.'(&[^"\']+)?["\']/',
'/href=["\'][^"\']*document\.send\.php\?docid='.$docID.'(&[^"\']+)?["\']/',
], [
'src="cid:' . $tag . '"',
'href="' . $CFG_GLPI['url_base'] . '/front/document.send.php?docid=' . $docID . '$1"',
],
$current->fields['body_html']);
}
$mmail->Body = GLPIMailer::normalizeBreaks($current->fields['body_html']);
$mmail->AltBody = GLPIMailer::normalizeBreaks($current->fields['body_text']);
}
<------> //patch - attach docs from documents fields of queuednotifications
if($current->fields["documents"]){
$documents_to_attach = [];
$documents_to_attach = importArrayFromDB($current->fields["documents"]);
<------> self::attachDocuments($mmail, $documents_to_attach);
}
In class notificationevent.class.php around line 182
replace
if (class_exists($eventclass)) {
$eventclass::raise(
$event,
$item,
$options,
$label,
$data,
$notificationtarget->setEvent($eventclass),
$template,
$notify_me,
$emitter
);
}
to
if (class_exists($eventclass)) {
<------><------>//attach docs added with followups or tasks
<------><------>if(array_key_exists('followup_id',$options)||array_key_exists('task_id',$options)){
$id_docs_array = [];
if(array_key_exists('followup_id',$options)){
$doc_crit[] = [
'timeline_position' => ['>', CommonITILObject::NO_TIMELINE],
'items_id'=>$options['followup_id']
];
}
if(array_key_exists('task_id',$options)){
$doc_crit[] = [
'timeline_position' => ['>', CommonITILObject::NO_TIMELINE],
'items_id'=>$options['task_id']
];
}
$query = [
'SELECT'=>'documents_id',
'FROM'=>'glpi_documents_items',
'WHERE'=> $doc_crit
];
$docs_ids = $DB->request($query);
foreach($docs_ids as $d_id){
$id_docs_array[] = $d_id['documents_id'];
}
$options['documents'] = $id_docs_array;
}
<------><------>//end of patch attach docs added with followups or tasks
$eventclass::raise(
$event,
$item,
$options,
$label,
$data,
$notificationtarget->setEvent($eventclass),
$template,
$notify_me,
$emitter
);
}
In class notificationeventabstract.class.php around line 140
//Send notification to the user
if ($label == '') {
$send_data = $template->getDataToSend(
$notificationtarget,
$tid,
$key,
$users_infos,
$options
);
$send_data['_notificationtemplates_id'] = $data['notificationtemplates_id'];
$send_data['_itemtype'] = $item->getType();
$send_data['_items_id'] = method_exists($item, "getID")
? $item->getID()
: 0;
$send_data['_entities_id'] = $entity;
$send_data['mode'] = $data['mode'];
//ADD
$send_data['documents'] = $options['documents'];
I only tested this for followup and tasks.
If you have a test environment, you can try testing.
anyone can get the resolve this issue?
]]>Have you already resolved this problem?
Can you share , please?
I have the same problem with the version 9.4.3
Tks
]]>And it will even attach a document that was placed in a private followup. As you can probably guess this will just confuse the requesters plus it's inflating mailboxes with unnecessary documents. Is it possible to revise this to only place in the notification only the document attached to the followup in question?
]]>