. * --------------------------------------------------------------------- */ include ('../inc/includes.php'); include_once("../functionsophalglpi.php"); header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); Session::checkCentralAccess(); // Make a select box if (isset($_POST["type"]) && isset($_POST["actortype"]) && isset($_POST["itemtype"])) { $rand = mt_rand(); if ($item = getItemForItemtype($_POST["itemtype"])) { switch ($_POST["type"]) { case "user" : $right = 'all'; // Only steal or own ticket whit empty assign if ($_POST["actortype"] == 'assign') { $right = "own_ticket"; if (!$item->canAssign()) { //sophal $CanAttribue = CanAttribue($_SESSION['glpiactiveprofile']['name']); if($CanAttribue == 1){ $right = 'all'; }else{ $right = 'id'; } } } $options = ['name' => '_itil_'.$_POST["actortype"].'[users_id]', 'entity' => $_POST['entity_restrict'], 'right' => $right, 'rand' => $rand, 'ldap_import' => true]; if ($CFG_GLPI["notifications_mailing"]) { $withemail = (isset($_POST["allow_email"]) ? $_POST["allow_email"] : false); $paramscomment = ['value' => '__VALUE__', 'allow_email' => $withemail, 'field' => "_itil_".$_POST["actortype"], 'use_notification' => $_POST["use_notif"]]; // Fix rand value $options['rand'] = $rand; $options['toupdate'] = ['value_fieldname' => 'value', 'to_update' => "notif_user_$rand", 'url' => $CFG_GLPI["root_doc"]. "/ajax/uemailUpdate.php", 'moreparams' => $paramscomment]; } if (($_POST["itemtype"] == 'Ticket') && ($_POST["actortype"] == 'assign')) { $toupdate = []; if (isset($options['toupdate']) && is_array($options['toupdate'])) { $toupdate[] = $options['toupdate']; } $toupdate[] = ['value_fieldname' => 'value', 'to_update' => "countassign_$rand", 'url' => $CFG_GLPI["root_doc"]. "/ajax/ticketassigninformation.php", 'moreparams' => ['users_id_assign' => '__VALUE__']]; $options['toupdate'] = $toupdate; } $rand = User::dropdown($options); // Display active tickets for a tech // Need to update information on dropdown changes if (($_POST["itemtype"] == 'Ticket') && ($_POST["actortype"] == 'assign')) { echo "
--"; echo ""; } if ($CFG_GLPI["notifications_mailing"]) { echo "
"; if ($withemail) { echo __('Email followup').' '; $rand = Dropdown::showYesNo('_itil_'.$_POST["actortype"].'[use_notification]', $_POST["use_notif"]); echo '
'; printf(__('%1$s: %2$s'), _n('Email', 'Emails', 1), ""); } echo "
"; } break; case "group" : $cond = ['is_requester' => 1]; if ($_POST["actortype"] == 'assign') { $cond = ['is_assign' => 1]; } if ($_POST["actortype"] == 'observer') { $cond = ['is_watcher' => 1]; } $param = [ 'name' => '_itil_'.$_POST["actortype"].'[groups_id]', 'entity' => $_POST['entity_restrict'], 'condition' => $cond, 'rand' => $rand ]; if (($_POST["itemtype"] == 'Ticket') && ($_POST["actortype"] == 'assign')) { $param['toupdate'] = ['value_fieldname' => 'value', 'to_update' => "countgroupassign_$rand", 'url' => $CFG_GLPI["root_doc"]. "/ajax/ticketassigninformation.php", 'moreparams' => ['groups_id_assign' => '__VALUE__']]; } $rand = Group::dropdown($param); if (($_POST["itemtype"] == 'Ticket') && ($_POST["actortype"] == 'assign')) { echo "
"; echo ""; } break; case "supplier" : $options = ['name' => '_itil_'.$_POST["actortype"].'[suppliers_id]', 'entity' => $_POST['entity_restrict'], 'rand' => $rand]; if ($CFG_GLPI["notifications_mailing"]) { $withemail = (isset($_POST["allow_email"]) ? $_POST["allow_email"] : false); $paramscomment = ['value' => '__VALUE__', 'allow_email' => $withemail, 'field' => '_itil_'.$_POST["actortype"], 'typefield' => "supplier", 'use_notification' => $_POST["use_notif"]]; // Fix rand value $options['rand'] = $rand; $options['toupdate'] = ['value_fieldname' => 'value', 'to_update' => "notif_supplier_$rand", 'url' => $CFG_GLPI["root_doc"]. "/ajax/uemailUpdate.php", 'moreparams' => $paramscomment]; } if ($_POST["itemtype"] == 'Ticket') { $toupdate = []; if (isset($options['toupdate']) && is_array($options['toupdate'])) { $toupdate[] = $options['toupdate']; } $toupdate[] = ['value_fieldname' => 'value', 'to_update' => "countassign_$rand", 'url' => $CFG_GLPI["root_doc"]. "/ajax/ticketassigninformation.php", 'moreparams' => ['suppliers_id_assign' => '__VALUE__']]; $options['toupdate'] = $toupdate; } $rand = Supplier::dropdown($options); // Display active tickets for a supplier // Need to update information on dropdown changes if ($_POST["itemtype"] == 'Ticket') { echo ""; echo ""; } if ($CFG_GLPI["notifications_mailing"]) { echo "
"; if ($withemail) { echo __('Email followup').' '; $rand = Dropdown::showYesNo('_itil_'.$_POST["actortype"].'[use_notification]', $_POST['use_notif']); echo '
'; printf(__('%1$s: %2$s'), _n('Email', 'Emails', 1), ""); } echo "
"; } break; } } }