File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -358,6 +358,8 @@ function plugin_formcreator_hook_add_ticket(CommonDBTM $item) {
358358}
359359
360360function plugin_formcreator_hook_update_ticket (CommonDBTM $ item ) {
361+ global $ DB ;
362+
361363 if (!($ item instanceof Ticket)) {
362364 return ;
363365 }
@@ -374,6 +376,20 @@ function plugin_formcreator_hook_update_ticket(CommonDBTM $item) {
374376 'items_id ' => $ id
375377 ]
376378 ]);
379+
380+ // find the 1st requester
381+ $ requester = $ DB ->request ([
382+ 'SELECT ' => 'users_id ' ,
383+ 'FROM ' => Ticket_User::getTable (),
384+ 'WHERE ' => [
385+ 'tickets_id ' => $ item ->getID (),
386+ 'type ' => CommonITILActor::REQUESTER ,
387+ ],
388+ 'ORDER ' => ['id ' ],
389+ 'LIMIT ' => '1 ' ,
390+ ])->next ();
391+ $ requester = $ requester ['users_id ' ] ?? 0 ;
392+
377393 $ issue ->update ([
378394 'id ' => $ issue ->getID (),
379395 'items_id ' => $ id ,
@@ -385,7 +401,7 @@ function plugin_formcreator_hook_update_ticket(CommonDBTM $item) {
385401 'date_mod ' => $ item ->fields ['date_mod ' ],
386402 'entities_id ' => $ item ->fields ['entities_id ' ],
387403 'is_recursive ' => '0 ' ,
388- 'requester_id ' => $ item -> fields [ ' users_id_recipient ' ] ,
404+ 'requester_id ' => $ requester ,
389405 'users_id_validator ' => $ validationStatus ['user ' ],
390406 'comment ' => addslashes ($ item ->fields ['content ' ]),
391407 ]);
You can’t perform that action at this time.
0 commit comments