";
Html::closeForm();
}
/**
* Print the helpdesk form
*
* @param $ID int : ID of the user who want to display the Helpdesk
* @param $ticket_template int : ID ticket template for preview : false if not used for preview
*
* @return nothing (print the helpdesk)
**/
function showFormHelpdesk($ID, $pmItem, $caseInfo, $ticket_template=false) {
global $DB, $CFG_GLPI, $LANG;
if (!Session::haveRight("create_ticket","1")) {
return false;
}
$query = "SELECT `realname`, `firstname`, `name`
FROM `glpi_users`
WHERE `id` = '$ID'";
$result = $DB->query($query);
$email = UserEmail::getDefaultForUser($ID);
// Set default values...
$default_values = array('_users_id_requester_notif' => array('use_notification' => ($email==""?0:1),
'alternative_email' => ''),
'nodelegate' => 1,
'_users_id_requester' => 0,
'name' => '',
'content' => '',
'itilcategories_id' => 0,
'urgency' => 3,
'itemtype' => '',
'entities_id' => $_SESSION['glpiactive_entity'],
'items_id' => 0,
'plan' => array(),
'global_validation' => 'none',
'due_date' => 'NULL',
'slas_id' => 0,
'_add_validation' => 0,
'type' => EntityData::getUsedConfig('tickettype',
$_SESSION['glpiactive_entity'],
'', Ticket::INCIDENT_TYPE),
'_right' => "id");
if (!$ticket_template) {
$options = $_REQUEST;
}
// Restore saved value or override with page parameter
foreach ($default_values as $name => $value) {
if (!isset($options[$name])) {
if (isset($_SESSION["helpdeskSaved"][$name])) {
$options[$name] = $_SESSION["helpdeskSaved"][$name];
} else {
$options[$name] = $value;
}
}
}
// Clean text fields
$options['name'] = stripslashes($options['name']);
$options['content'] = Html::cleanPostForTextArea($options['content']);
if (!$ticket_template) {
echo "