.
*
* ------------------------------------------------------------------------
*
* This file is called by ajax function and display dropdown task job
* definition.
*
* ------------------------------------------------------------------------
*
* @package FusionInventory
* @author David Durieux
* @copyright Copyright (c) 2010-2016 FusionInventory team
* @license AGPL License 3.0 or (at your option) any later version
* http://www.gnu.org/licenses/agpl-3.0-standalone.html
* @link http://www.fusioninventory.org/
* @link https://github.com/fusioninventory/fusioninventory-for-glpi
*
*/
include ("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Session::checkCentralAccess();
// Make a select box
$type = filter_input(INPUT_POST, "type");
$actortype = filter_input(INPUT_POST, "actortype");
if (!empty($type) && !empty($actortype)) {
$rand = mt_rand();
$entity_restrict = filter_input(INPUT_POST, "entity_restrict");
switch ($type) {
case "user" :
$right = 'all';
/// TODO : review depending of itil object
// Only steal or own ticket whit empty assign
if ($actortype == 'assign') {
$right = "own_ticket";
if (!$item->canAssign()) {
$right = 'id';
}
}
$options = ['name' => '_itil_'.$actortype.'[users_id]',
'entity' => $entity_restrict,
'right' => $right,
'ldap_import' => true];
$withemail = false;
if ($CFG_GLPI["use_mailing"]) {
$allow_email = filter_input(INPUT_POST, "allow_email");
$withemail = (!empty($allow_email) ? $allow_email : false);
$paramscomment = ['value' => '__VALUE__',
'allow_email' => $withemail,
'field' => "_itil_".$actortype];
// 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];
}
$rand = User::dropdown($options);
if ($CFG_GLPI["use_mailing"]==1) {
echo "
";
if ($withemail) {
echo __('Email followup').' : ';
$rand = Dropdown::showYesNo('_itil_'.$actortype.'[use_notification]', 1);
echo '
'.__('Email').' : ';
echo "";
}
echo "";
}
break;
case "group" :
$cond = ($actortype=='assign' ? $cond = '`is_assign`' : $cond = '`is_requester`');
Dropdown::show('Group', ['name' => '_itil_'.$actortype.'[groups_id]',
'entity' => $entity_restrict,
'condition' => $cond]);
break;
case "supplier" :
Dropdown::show('Supplier', ['name' => 'suppliers_id_assign',
'entity' => $entity_restrict]);
break;
}
}