File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,8 @@ function plugin_formcreator_hook_add_ticket(CommonDBTM $item) {
372
372
}
373
373
374
374
function plugin_formcreator_hook_update_ticket (CommonDBTM $ item ) {
375
+ global $ DB ;
376
+
375
377
if (!($ item instanceof Ticket)) {
376
378
return ;
377
379
}
@@ -389,6 +391,19 @@ function plugin_formcreator_hook_update_ticket(CommonDBTM $item) {
389
391
]
390
392
]);
391
393
if (!$ issue ->isNewItem ()) {
394
+ // find the 1st requester
395
+ $ requester = $ DB ->request ([
396
+ 'SELECT ' => 'users_id ' ,
397
+ 'FROM ' => Ticket_User::getTable (),
398
+ 'WHERE ' => [
399
+ 'tickets_id ' => $ item ->getID (),
400
+ 'type ' => CommonITILActor::REQUESTER ,
401
+ ],
402
+ 'ORDER ' => ['id ' ],
403
+ 'LIMIT ' => '1 ' ,
404
+ ])->current ();
405
+ $ requester = $ requester ['users_id ' ] ?? 0 ;
406
+
392
407
$ issue ->update ([
393
408
'id ' => $ issue ->getID (),
394
409
'items_id ' => $ id ,
@@ -400,7 +415,7 @@ function plugin_formcreator_hook_update_ticket(CommonDBTM $item) {
400
415
'date_mod ' => $ item ->fields ['date_mod ' ],
401
416
'entities_id ' => $ item ->fields ['entities_id ' ],
402
417
'is_recursive ' => '0 ' ,
403
- 'requester_id ' => $ item -> fields [ ' users_id_recipient ' ] ,
418
+ 'requester_id ' => $ requester ,
404
419
'comment ' => addslashes ($ item ->fields ['content ' ]),
405
420
]);
406
421
return ;
You can’t perform that action at this time.
0 commit comments