ticket.class.php.patch

tsmr, 04/08/2021 03:35 PM

Download (3.24 KB)

View differences:

ticket.class.php (working copy)
352 352
                  = PluginBehaviorsUser::getRequesterGroup($ticket->input['entities_id'],
353 353
                                                           $ticket->input['_users_id_requester'],
354 354
                                                           true);
355
            } else {
355
            } else  if ($config->getField('use_requester_user_group') == 3){
356
               $user = new User();
357
               if($user->getFromDB($ticket->input['_users_id_requester'])){
358
                  $ticket->input['_groups_id_requester'] = $user->fields['groups_id'];
359
               }else{
360
                  $ticket->input['_groups_id_requester'] = 0;
361
               }
362
            } else  {
356 363
               // All groups
357 364
               $g = PluginBehaviorsUser::getRequesterGroup($ticket->input['entities_id'],
358 365
                                                           $ticket->input['_users_id_requester'],
......
611 618
               $_SESSION['glpi_behaviors_auto_group'] = $grp;
612 619
               $_REQUEST['_groups_id_requester']      = $grp;
613 620

  
621
            } else if (($config->getField('use_requester_user_group') == 3)
622
                       && isset($_POST['_users_id_requester']) && ($_POST['_users_id_requester'] > 0)
623
                       && (!isset($_POST['_groups_id_requester'])
624
                           || ($_POST['_groups_id_requester'] <= 0)
625
                           || (isset($_SESSION['glpi_behaviors_auto_group'])
626
                               && ($_SESSION['glpi_behaviors_auto_group']
627
                                   == $_POST['_groups_id_requester'])))) {
628

  
629
               // Select default group of this user
630
               $user = new User();
631

  
632
               if ($user->getFromDB($_POST['_users_id_requester'])) {
633
                  $grp = $user->fields['groups_id'];
634
               } else {
635
                  $grp = 0;
636
               }
637

  
638
               $_SESSION['glpi_behaviors_auto_group'] = $grp;
639
               $_REQUEST['_groups_id_requester']      = $grp;
640

  
614 641
            } else if (($config->getField('use_requester_user_group') == 1)
615 642
                && isset($_POST['_users_id_requester']) && ($_POST['_users_id_requester'] <= 0)
616 643
                && isset($_POST['_groups_id_requester'])
......
620 647
               // clear user, so clear group
621 648
               $_SESSION['glpi_behaviors_auto_group'] = 0;
622 649
               $_REQUEST['_groups_id_requester']      = 0;
650
            } else if (($config->getField('use_requester_user_group') == 3)
651
                       && isset($_POST['_users_id_requester']) && ($_POST['_users_id_requester'] <= 0)
652
                       && isset($_POST['_groups_id_requester'])
653
                       && isset($_SESSION['glpi_behaviors_auto_group'])
654
                       && ($_SESSION['glpi_behaviors_auto_group'] == $_POST['_groups_id_requester'])) {
655

  
656
               // clear user, so clear group
657
               $_SESSION['glpi_behaviors_auto_group'] = 0;
658
               $_REQUEST['_groups_id_requester']      = 0;
623 659
            } else {
624 660
               unset($_SESSION['glpi_behaviors_auto_group']);
625 661
            }