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) {
372372}
373373
374374function  plugin_formcreator_hook_update_ticket (CommonDBTM   $ item ) {
375+    global  $ DB  ;
376+ 
375377   if  (!($ item  instanceof  Ticket)) {
376378      return ;
377379   }
@@ -389,6 +391,19 @@ function plugin_formcreator_hook_update_ticket(CommonDBTM $item) {
389391      ]
390392   ]);
391393   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+ 
392407      $ issue ->update ([
393408         'id '                  => $ issue ->getID (),
394409         'items_id '            => $ id ,
@@ -400,7 +415,7 @@ function plugin_formcreator_hook_update_ticket(CommonDBTM $item) {
400415         'date_mod '            => $ item ->fields ['date_mod ' ],
401416         'entities_id '         => $ item ->fields ['entities_id ' ],
402417         'is_recursive '        => '0 ' ,
403-          'requester_id '        => $ item -> fields [ ' users_id_recipient ' ] ,
418+          'requester_id '        => $ requester  ,
404419         'comment '             => addslashes ($ item ->fields ['content ' ]),
405420      ]);
406421      return ;
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments