File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -531,13 +531,25 @@ protected function addGroupActor($role, $group) {
531531 * Attach documents of the answer to the target
532532 */
533533 protected function attachDocument ($ formAnswerId , $ itemtype , $ targetID ) {
534+ global $ CFG_GLPI ;
535+
534536 $ docItem = new Document_Item ();
535- if (count ($ this ->attachedDocuments ) > 0 ) {
536- foreach ($ this ->attachedDocuments as $ documentID => $ dummy ) {
537- $ docItem ->add ([
538- 'documents_id ' => $ documentID ,
539- 'itemtype ' => $ itemtype ,
540- 'items_id ' => $ targetID
537+ if (count ($ this ->attachedDocuments ) <= 0 ) {
538+ return ;
539+ }
540+
541+ foreach ($ this ->attachedDocuments as $ documentID => $ dummy ) {
542+ $ docItem ->add ([
543+ 'documents_id ' => $ documentID ,
544+ 'itemtype ' => $ itemtype ,
545+ 'items_id ' => $ targetID ,
546+ ]);
547+ if ($ itemtype === Ticket::class) {
548+ $ document = new Document ();
549+ $ documentCategoryFk = DocumentCategory::getForeignKeyField ();
550+ $ document ->update ([
551+ 'id ' => $ documentID ,
552+ $ documentCategoryFk => $ CFG_GLPI ["documentcategories_id_forticket " ],
541553 ]);
542554 }
543555 }
You can’t perform that action at this time.
0 commit comments