diff --git a/front/processmaker.helpdesk.form.php b/front/processmaker.helpdesk.form.php
index f8a1e08..d7c146c 100644
--- a/front/processmaker.helpdesk.form.php
+++ b/front/processmaker.helpdesk.form.php
@@ -30,506 +30,511 @@ function processMakerShowProcessList ($ID, $from_helpdesk) {
}
-function showFormHelpdesk($ID, $pmItem, $caseInfo, $ticket_template=false) {
- global $DB, $CFG_GLPI;
-
- if (!Ticket::canCreate()) {
- return false;
- }
-
- if (!$ticket_template
- && Session::haveRightsOr('ticketvalidation', TicketValidation::getValidateRights())) {
-
- $opt = array();
- $opt['reset'] = 'reset';
- $opt['criteria'][0]['field'] = 55; // validation status
- $opt['criteria'][0]['searchtype'] = 'equals';
- $opt['criteria'][0]['value'] = CommonITILValidation::WAITING;
- $opt['criteria'][0]['link'] = 'AND';
-
- $opt['criteria'][1]['field'] = 59; // validation aprobator
- $opt['criteria'][1]['searchtype'] = 'equals';
- $opt['criteria'][1]['value'] = Session::getLoginUserID();
- $opt['criteria'][1]['link'] = 'AND';
-
- $url_validate = $CFG_GLPI["root_doc"]."/front/ticket.php?".Toolbox::append_params($opt,
- '&');
-
- if (TicketValidation::getNumberToValidate(Session::getLoginUserID()) > 0) {
- echo "".
- __('Tickets awaiting approval')."
";
- }
- }
-
- $email = UserEmail::getDefaultForUser($ID);
- $default_use_notif = Entity::getUsedConfig('is_notif_enable_default', $_REQUEST['entities_id'], '', 1);
-
- // Set default values...
- $default_values = array('_users_id_requester_notif'
- => array('use_notification'
- => (($email == "")?0:$default_use_notif)),
- 'nodelegate' => 1,
- '_users_id_requester' => 0,
- '_users_id_observer' => array(0),
- '_users_id_observer_notif'
- => array('use_notification' => $default_use_notif),
- 'name' => '',
- 'content' => '',
- 'itilcategories_id' => 0,
- 'locations_id' => 0,
- 'urgency' => 3,
-
- 'items_id' => 0,
- 'entities_id' => $_REQUEST['entities_id'],
- 'plan' => array(),
- 'global_validation' => CommonITILValidation::NONE,
- '_add_validation' => 0,
- 'type' => Entity::getUsedConfig('tickettype',
- $_REQUEST['entities_id'],
- '', Ticket::INCIDENT_TYPE),
- '_right' => "id",
- '_filename' => array(),
- '_tag_filename' => array());
-
- // Get default values from posted values on reload form
- if (!$ticket_template) {
- if (isset($_POST)) {
- $values = Html::cleanPostForTextArea($_POST);
- }
- }
-
- $ticket = new Ticket();
- // Restore saved value or override with page parameter
- if (!function_exists('restoreInput')) {
- function restoreInput(Array $default=array()) {
-
- if (isset($_SESSION['saveInput']['Ticket'])) {
- $saved = Html::cleanPostForTextArea($_SESSION['saveInput']['Ticket']);
-
- // clear saved data when restored (only need once)
- unset($_SESSION['saveInput']['Ticket']);
-
- return $saved;
- }
-
- return $default;
- }
- }
- $saved = restoreInput();
- foreach ($default_values as $name => $value) {
- if (!isset($values[$name])) {
- if (isset($saved[$name])) {
- $values[$name] = $saved[$name];
- } else {
- $values[$name] = $value;
- }
- }
- }
-
- // Check category / type validity
- if ($values['itilcategories_id']) {
- $cat = new ITILCategory();
- if ($cat->getFromDB($values['itilcategories_id'])) {
- switch ($values['type']) {
- case Ticket::INCIDENT_TYPE :
- if (!$cat->getField('is_incident')) {
- $values['itilcategories_id'] = 0;
- }
- break;
-
- case Ticket::DEMAND_TYPE :
- if (!$cat->getField('is_request')) {
- $values['itilcategories_id'] = 0;
- }
- break;
-
- default :
- break;
- }
- }
- }
-
- if (!$ticket_template) {
- echo "