public function displayCriteria()
 {
     $this->getReport()->startColumn();
     echo $this->getCriteriaLabel() . ' :';
     $this->getReport()->endColumn();
     $this->getReport()->startColumn();
     Ticket::dropdownPriority($this->getName(), $this->getParameterValue(), 1);
     $this->getReport()->endColumn();
 }
Esempio n. 2
0
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if (!$this->canView()) {
         return false;
     }
     $plugin_projet_projets_id = -1;
     if (isset($options['plugin_projet_projets_id'])) {
         $plugin_projet_projets_id = $options['plugin_projet_projets_id'];
     }
     $item = new PluginProjetProjet();
     if ($item->getFromDB($plugin_projet_projets_id)) {
         $entities_id = $item->fields["entities_id"];
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
         $plugin_projet_projets_id = $this->fields["plugin_projet_projets_id"];
     } else {
         // Create item
         $input = array('plugin_projet_projets_id' => $plugin_projet_projets_id, 'entities_id' => $entities_id);
         $this->check(-1, 'w', $input);
     }
     $options["colspan"] = 4;
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<input type='hidden' name='plugin_projet_projets_id' value='{$plugin_projet_projets_id}'>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='2'>" . PluginProjetProjet::getTypeName(2) . "</td><td colspan='2'>";
     $link = NOT_AVAILABLE;
     if ($item->getFromDB($plugin_projet_projets_id)) {
         $link = $item->getLink();
     }
     echo $link;
     echo "</td>";
     echo "<td>";
     echo __('Parent task', 'projet') . "</td><td>";
     PluginProjetTask_Task::displayLinkedProjetTasksTo($ID);
     if ($this->canCreate()) {
         $rand_linked_projettask = mt_rand();
         echo "&nbsp;";
         if (!PluginProjetTask_Task::getParentProjetTasksTo($ID)) {
             echo "<img onClick=\"Ext.get('linkedprojettask{$rand_linked_projettask}').setDisplayed('block')\"\n                       title=\"" . __('Add') . "\" alt=\"" . __('Add') . "\"\n                       class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
         }
         echo "<div style='display:none' id='linkedprojettask{$rand_linked_projettask}'>";
         PluginProjetTask_Task::dropdownLinks('_link[link]', isset($values["_link"]) ? $values["_link"]['link'] : '');
         echo "&nbsp;";
         PluginProjetTask_Task::dropdownParent("_link[plugin_projet_tasks_id_2]", isset($values["_link"]) ? $values["_link"]['plugin_projet_tasks_id_2'] : '', array('id' => $this->fields["id"], 'entities_id' => $this->fields["entities_id"], 'plugin_projet_projets_id' => $plugin_projet_projets_id));
         echo "<input type='hidden' name='_link[plugin_projet_tasks_id_1]' value='{$ID}'>\n";
         echo "&nbsp;";
         echo "</div>";
         if (isset($values["_link"]) && !empty($values["_link"]['plugin_projet_tasks_id_2'])) {
             echo "<script language='javascript'>Ext.get('linkedprojettask{$rand_linked_projettask}').\n                   setDisplayed('block');</script>";
         }
     }
     echo "</td>";
     echo "<td>";
     echo __('Dependent', 'projet') . "</td><td>";
     Dropdown::showYesNo("depends", $this->fields["depends"]);
     echo "&nbsp;";
     echo " <img alt='' src='" . $CFG_GLPI["root_doc"] . "/pics/aide.png' onmouseout=\"cleanhide('commentsup')\" onmouseover=\"cleandisplay('commentsup')\">";
     echo "<span class='over_link' id='commentsup'>" . nl2br(__('Depends on the tasks children', 'projet')) . "</span>";
     echo "</td>";
     echo "</tr>";
     $width_left = $width_right = "50%";
     $cols = 60;
     $rows = 4;
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'>";
     echo __('Name') . "</td><td  colspan='2'>";
     Html::autocompletionTextField($this, "name", array('size' => "30"));
     echo "<td >";
     echo _n('Type', 'Types', 1) . "</td><td>";
     Dropdown::show('PluginProjetTaskType', array('value' => $this->fields["plugin_projet_tasktypes_id"]));
     echo "</td>";
     echo "<td>";
     echo __('State') . "</td><td>";
     if ($ID > 0) {
         $this->dropdownState("plugin_projet_taskstates_id", $this->fields["plugin_projet_taskstates_id"], array('depends' => $this->fields["depends"], 'id' => $this->fields["id"], 'plugin_projet_projets_id' => $plugin_projet_projets_id));
     } else {
         Dropdown::show('PluginProjetTaskState', array('value' => $this->fields["plugin_projet_taskstates_id"]));
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2'>";
     echo _n('Location', 'Locations', 1) . "</td><td  colspan='2'>";
     Dropdown::show('Location', array('value' => $this->fields["locations_id"]));
     echo "</td>";
     echo "<td>";
     echo __('Priority') . "</td><td>";
     Ticket::dropdownPriority(array('value' => $this->fields["priority"], 'withmajor' => true));
     echo "</td>";
     echo "<td>" . __('Progress') . "</td><td>";
     $advance = floor($this->fields["advance"]);
     echo "<select name='advance'>";
     if (empty($ID) || $this->fields["depends"] == 0) {
         for ($i = 0; $i < 101; $i += 5) {
             echo "<option value='{$i}' ";
             if ($advance == $i) {
                 echo "selected";
             }
             echo " >{$i}</option>";
         }
     } else {
         if ($this->fields["depends"] != 0) {
             for ($i = 0; $i < 100; $i += 5) {
                 echo "<option value='{$i}' ";
                 if ($advance == $i) {
                     echo "selected";
                 }
                 echo " >{$i}</option>";
             }
         }
     }
     echo "</select> %";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_3'>";
     echo "<td colspan='4'>" . __('Assigned to') . "</td>";
     echo "<td colspan='4'>" . __('Planification', 'projet') . "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4' width='{$width_left}'>";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td>" . _n('User', 'Users', 1) . "</td><td>";
     $this->dropdownItems($this->fields["plugin_projet_projets_id"], "users_id", array(), $this->fields["users_id"], 'User');
     echo "</td></tr>";
     echo "<tr><td>" . _n('Group', 'Groups', 1) . "</td><td>";
     $this->dropdownItems($this->fields["plugin_projet_projets_id"], "groups_id", array(), $this->fields["groups_id"], 'Group');
     echo "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td>" . _n('Supplier', 'Suppliers', 1) . "</td><td>";
     $this->dropdownItems($this->fields["plugin_projet_projets_id"], "contacts_id", array(), $this->fields["contacts_id"], 'Supplier');
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</td>";
     echo "<td colspan='4' width='{$width_right}' valign='top'>";
     echo "<table width='100%'>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Effective duration', 'projet') . "</td><td>";
     $toadd = array();
     for ($i = 9; $i <= 100; $i++) {
         $toadd[] = $i * HOUR_TIMESTAMP;
     }
     Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Planning') . "</td>";
     echo "<td>";
     $plan = new PluginProjetTaskPlanning();
     $plan->showFormForTask($plugin_projet_projets_id, $this);
     echo "</td></tr>";
     echo "</table>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_3'>";
     $colspan = '8';
     if (!empty($ID)) {
         $colspan = '4';
     }
     echo "<td colspan='" . $colspan . "'>" . __('Description') . "</td>";
     if (!empty($ID)) {
         echo "<td colspan='4'>" . __('Results') . "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='" . $colspan . "' width='{$width_left}'>";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td>";
     echo "<textarea name='comment' cols='{$cols}' rows='{$rows}'>" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "</table>";
     if (!empty($ID)) {
         echo "</td>";
         echo "<td colspan='4' width='{$width_left}'>";
         echo "<table width='100%'>";
         echo "<tr>";
         echo "<td>";
         echo "<textarea name='sub' cols='{$cols}' rows='{$rows}'>" . $this->fields["sub"] . "</textarea>";
         echo "</td>";
         echo "</tr>";
         echo "</table>";
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_3'>";
     echo "<td colspan='4'>" . __('Others participants', 'projet') . "</td>";
     echo "<td colspan='4'>" . __('Affected people', 'projet') . "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4' width='{$width_left}'>";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td>";
     echo "<textarea name='others' cols='{$cols}' rows='2'>" . $this->fields["others"] . "</textarea>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</td>";
     echo "<td colspan='4' width='{$width_right}' valign='top'>";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td>";
     echo "<textarea name='affect' cols='{$cols}' rows='2'>" . $this->fields["affect"] . "</textarea>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td  colspan='2'>" . __('Send email', 'projet') . "</td><td colspan='2'>";
     echo "<input type='checkbox' name='send_notification'";
     echo " value='1'>";
     echo "</td>";
     echo "<td colspan='4' align='center'>" . __('Display on the Gantt', 'projet') . " ";
     Dropdown::showYesNo("show_gantt", $this->fields["show_gantt"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='8' align='center'>";
     $datestring = __('Last update') . ": ";
     $date = Html::convDateTime($this->fields["date_mod"]);
     echo $datestring . $date . "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
Esempio n. 3
0
 /**
  * Clone of Ticket::showForm()
  * Change '$this' by '$ticket', 'self' by 'Ticket' and 'parent' by 'Ticket'
  */
 static function getCentral($ID = 0, $options = array())
 {
     global $CFG_GLPI;
     // * Added by plugin survey ticket
     $ticket = new Ticket();
     // * End of adding
     $default_values = Ticket::getDefaultValues();
     // Get default values from posted values on reload form
     if (!isset($options['template_preview'])) {
         if (isset($_POST)) {
             $values = $_POST;
         }
     }
     // Restore saved value or override with page parameter
     $saved = $ticket->restoreInput();
     foreach ($default_values as $name => $value) {
         if (!isset($values[$name])) {
             if (isset($saved[$name])) {
                 $values[$name] = $saved[$name];
             } else {
                 $values[$name] = $value;
             }
         }
     }
     // Default check
     if ($ID > 0) {
         $ticket->check($ID, 'r');
     } else {
         // Create item
         $ticket->check(-1, 'w', $values);
     }
     if (!$ID) {
         $ticket->userentities = array();
         if ($values["_users_id_requester"]) {
             //Get all the user's entities
             $all_entities = Profile_User::getUserEntities($values["_users_id_requester"], true, true);
             //For each user's entity, check if the technician which creates the ticket have access to it
             foreach ($all_entities as $tmp => $ID_entity) {
                 if (Session::haveAccessToEntity($ID_entity)) {
                     $ticket->userentities[] = $ID_entity;
                 }
             }
         }
         $ticket->countentitiesforuser = count($ticket->userentities);
         if ($ticket->countentitiesforuser > 0 && !in_array($ticket->fields["entities_id"], $ticket->userentities)) {
             // If entity is not in the list of user's entities,
             // then use as default value the first value of the user's entites list
             $ticket->fields["entities_id"] = $ticket->userentities[0];
             // Pass to values
             $values['entities_id'] = $ticket->userentities[0];
         }
     }
     if ($values['type'] <= 0) {
         $values['type'] = Entity::getUsedConfig('tickettype', $values['entities_id'], '', Ticket::INCIDENT_TYPE);
     }
     if (!isset($options['template_preview'])) {
         $options['template_preview'] = 0;
     }
     // Load ticket template if available :
     $tt = $ticket->getTicketTemplateToUse($options['template_preview'], $values['type'], $values['itilcategories_id'], $values['entities_id']);
     // Predefined fields from template : reset them
     if (isset($values['_predefined_fields'])) {
         $values['_predefined_fields'] = Toolbox::decodeArrayFromInput($values['_predefined_fields']);
     } else {
         $values['_predefined_fields'] = array();
     }
     // Store predefined fields to be able not to take into account on change template
     // Only manage predefined values on ticket creation
     $predefined_fields = array();
     if (!$ID) {
         if (isset($tt->predefined) && count($tt->predefined)) {
             foreach ($tt->predefined as $predeffield => $predefvalue) {
                 if (isset($default_values[$predeffield])) {
                     // Is always default value : not set
                     // Set if already predefined field
                     // Set if ticket template change
                     if ($values[$predeffield] == $default_values[$predeffield] || isset($values['_predefined_fields'][$predeffield]) && $values[$predeffield] == $values['_predefined_fields'][$predeffield] || isset($values['_tickettemplates_id']) && $values['_tickettemplates_id'] != $tt->getID()) {
                         // Load template data
                         $values[$predeffield] = $predefvalue;
                         $ticket->fields[$predeffield] = $predefvalue;
                         $predefined_fields[$predeffield] = $predefvalue;
                     }
                 }
             }
         } else {
             // No template load : reset predefined values
             if (count($values['_predefined_fields'])) {
                 foreach ($values['_predefined_fields'] as $predeffield => $predefvalue) {
                     if ($values[$predeffield] == $predefvalue) {
                         $values[$predeffield] = $default_values[$predeffield];
                     }
                 }
             }
         }
     }
     // Put ticket template on $values for actors
     $values['_tickettemplate'] = $tt;
     $canupdate = Session::haveRight('update_ticket', '1');
     $canpriority = Session::haveRight('update_priority', '1');
     $canstatus = $canupdate;
     if (in_array($ticket->fields['status'], $ticket->getClosedStatusArray())) {
         $canupdate = false;
     }
     $showuserlink = 0;
     if (Session::haveRight('user', 'r')) {
         $showuserlink = 1;
     }
     if (!$options['template_preview']) {
         $ticket->showTabs($options);
     } else {
         // Add all values to fields of tickets for template preview
         foreach ($values as $key => $val) {
             if (!isset($ticket->fields[$key])) {
                 $ticket->fields[$key] = $val;
             }
         }
     }
     // In percent
     $colsize1 = '13';
     $colsize2 = '29';
     $colsize3 = '13';
     $colsize4 = '45';
     $canupdate_descr = $canupdate || $ticket->fields['status'] == Ticket::INCOMING && $ticket->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID()) && $ticket->numberOfFollowups() == 0 && $ticket->numberOfTasks() == 0;
     if (!$options['template_preview']) {
         echo "<form method='post' name='form_ticket' enctype='multipart/form-data' action='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'>";
     }
     echo "<div class='spaced' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe' id='mainformtable'>";
     // Optional line
     $ismultientities = Session::isMultiEntitiesMode();
     echo "<tr class='headerRow'>";
     echo "<th colspan='4'>";
     if ($ID) {
         $text = sprintf(__('%1$s - %2$s'), $ticket->getTypeName(1), sprintf(__('%1$s: %2$s'), __('ID'), $ID));
         if ($ismultientities) {
             $text = sprintf(__('%1$s (%2$s)'), $text, Dropdown::getDropdownName('glpi_entities', $ticket->fields['entities_id']));
         }
         echo $text;
     } else {
         if ($ismultientities) {
             printf(__('The ticket will be added in the entity %s'), Dropdown::getDropdownName("glpi_entities", $ticket->fields['entities_id']));
         } else {
             _e('New ticket');
         }
     }
     echo "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th width='{$colsize1}%'>";
     echo $tt->getBeginHiddenFieldText('date');
     if (!$ID) {
         printf(__('%1$s%2$s'), __('Opening date'), $tt->getMandatoryMark('date'));
     } else {
         _e('Opening date');
     }
     echo $tt->getEndHiddenFieldText('date');
     echo "</th>";
     echo "<td width='{$colsize2}%'>";
     echo $tt->getBeginHiddenFieldValue('date');
     $date = $ticket->fields["date"];
     if ($canupdate) {
         Html::showDateTimeFormItem("date", $date, 1, false);
     } else {
         echo Html::convDateTime($date);
     }
     echo $tt->getEndHiddenFieldValue('date', $ticket);
     echo "</td>";
     // SLA
     echo "<th width='{$colsize3}%'>" . $tt->getBeginHiddenFieldText('due_date');
     if (!$ID) {
         printf(__('%1$s%2$s'), __('Due date'), $tt->getMandatoryMark('due_date'));
     } else {
         _e('Due date');
     }
     echo $tt->getEndHiddenFieldText('due_date');
     echo "</th>";
     echo "<td width='{$colsize4}%' class='nopadding'>";
     if ($ID) {
         if ($ticket->fields["slas_id"] > 0) {
             echo "<table width='100%'><tr><td class='nopadding'>";
             echo Html::convDateTime($ticket->fields["due_date"]);
             echo "</td><td class='b'>" . __('SLA') . "</td>";
             echo "<td class='nopadding'>";
             echo Dropdown::getDropdownName("glpi_slas", $ticket->fields["slas_id"]);
             $commentsla = "";
             $slalevel = new SlaLevel();
             if ($slalevel->getFromDB($ticket->fields['slalevels_id'])) {
                 $commentsla .= '<span class="b spaced">' . sprintf(__('%1$s: %2$s'), __('Escalation level'), $slalevel->getName()) . '</span><br>';
             }
             $nextaction = new SlaLevel_Ticket();
             if ($nextaction->getFromDBForTicket($ticket->fields["id"])) {
                 $commentsla .= '<span class="b spaced">' . sprintf(__('Next escalation: %s'), Html::convDateTime($nextaction->fields['date'])) . '</span>';
                 if ($slalevel->getFromDB($nextaction->fields['slalevels_id'])) {
                     $commentsla .= '<span class="b spaced">' . sprintf(__('%1$s: %2$s'), __('Escalation level'), $slalevel->getName()) . '</span>';
                 }
             }
             $slaoptions = array();
             if (Session::haveRight('config', 'r')) {
                 $slaoptions['link'] = Toolbox::getItemTypeFormURL('SLA') . "?id=" . $ticket->fields["slas_id"];
             }
             Html::showToolTip($commentsla, $slaoptions);
             if ($canupdate) {
                 echo "&nbsp;<input type='submit' class='submit' name='sla_delete' value='" . _sx('button', 'Delete permanently') . "'>";
             }
             echo "</td>";
             echo "</tr></table>";
         } else {
             echo "<table><tr><td class='nopadding'>";
             echo $tt->getBeginHiddenFieldValue('due_date');
             Html::showDateTimeFormItem("due_date", $ticket->fields["due_date"], 1, true, $canupdate);
             echo $tt->getEndHiddenFieldValue('due_date', $ticket);
             echo "</td>";
             if ($canupdate) {
                 echo "<td>";
                 echo $tt->getBeginHiddenFieldText('slas_id');
                 echo "<span id='sla_action'>";
                 echo "<a class='vsubmit' " . Html::addConfirmationOnAction(array(__('The assignment of a SLA to a ticket causes the recalculation of the due date.'), __("Escalations defined in the SLA will be triggered under this new date.")), "cleanhide('sla_action');cleandisplay('sla_choice');") . ">" . __('Assign a SLA') . '</a>';
                 echo "</span>";
                 echo "<span id='sla_choice' style='display:none'>";
                 echo "<span  class='b'>" . __('SLA') . "</span>&nbsp;";
                 Sla::dropdown(array('entity' => $ticket->fields["entities_id"], 'value' => $ticket->fields["slas_id"]));
                 echo "</span>";
                 echo $tt->getEndHiddenFieldText('slas_id');
                 echo "</td>";
             }
             echo "</tr></table>";
         }
     } else {
         // New Ticket
         echo "<table><tr><td class='nopadding'>";
         if ($ticket->fields["due_date"] == 'NULL') {
             $ticket->fields["due_date"] = '';
         }
         echo $tt->getBeginHiddenFieldValue('due_date');
         Html::showDateTimeFormItem("due_date", $ticket->fields["due_date"], 1, false, $canupdate);
         echo $tt->getEndHiddenFieldValue('due_date', $ticket);
         echo "</td>";
         if ($canupdate) {
             echo "<td class='nopadding b'>" . $tt->getBeginHiddenFieldText('slas_id');
             printf(__('%1$s%2$s'), __('SLA'), $tt->getMandatoryMark('slas_id'));
             echo $tt->getEndHiddenFieldText('slas_id') . "</td>";
             echo "<td class='nopadding'>" . $tt->getBeginHiddenFieldValue('slas_id');
             Sla::dropdown(array('entity' => $ticket->fields["entities_id"], 'value' => $ticket->fields["slas_id"]));
             echo $tt->getEndHiddenFieldValue('slas_id', $ticket);
             echo "</td>";
         }
         echo "</tr></table>";
     }
     echo "</td></tr>";
     if ($ID) {
         echo "<tr class='tab_bg_1'>";
         echo "<th width='{$colsize1}%'>" . __('By') . "</th>";
         echo "<td width='{$colsize2}%'>";
         if ($canupdate) {
             User::dropdown(array('name' => 'users_id_recipient', 'value' => $ticket->fields["users_id_recipient"], 'entity' => $ticket->fields["entities_id"], 'right' => 'all'));
         } else {
             echo getUserName($ticket->fields["users_id_recipient"], $showuserlink);
         }
         echo "</td>";
         echo "<th width='{$colsize3}%'>" . __('Last update') . "</th>";
         echo "<td width='{$colsize4}%'>";
         if ($ticket->fields['users_id_lastupdater'] > 0) {
             //TRANS: %1$s is the update date, %2$s is the last updater name
             printf(__('%1$s by %2$s'), Html::convDateTime($ticket->fields["date_mod"]), getUserName($ticket->fields["users_id_lastupdater"], $showuserlink));
         }
         echo "</td>";
         echo "</tr>";
     }
     if ($ID && (in_array($ticket->fields["status"], $ticket->getSolvedStatusArray()) || in_array($ticket->fields["status"], $ticket->getClosedStatusArray()))) {
         echo "<tr class='tab_bg_1'>";
         echo "<th width='{$colsize1}%'>" . __('Resolution date') . "</th>";
         echo "<td width='{$colsize2}%'>";
         Html::showDateTimeFormItem("solvedate", $ticket->fields["solvedate"], 1, false, $canupdate);
         echo "</td>";
         if (in_array($ticket->fields["status"], $ticket->getClosedStatusArray())) {
             echo "<th width='{$colsize3}%'>" . __('Close date') . "</th>";
             echo "<td width='{$colsize4}%'>";
             Html::showDateTimeFormItem("closedate", $ticket->fields["closedate"], 1, false, $canupdate);
             echo "</td>";
         } else {
             echo "<td colspan='2'>&nbsp;</td>";
         }
         echo "</tr>";
     }
     if ($ID) {
         echo "</table>";
         echo "<table  class='tab_cadre_fixe' id='mainformtable2'>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<th width='{$colsize1}%'>" . sprintf(__('%1$s%2$s'), __('Type'), $tt->getMandatoryMark('type')) . "</th>";
     echo "<td width='{$colsize2}%'>";
     // Permit to set type when creating ticket without update right
     if ($canupdate || !$ID) {
         $opt = array('value' => $ticket->fields["type"]);
         /// Auto submit to load template
         if (!$ID) {
             $opt['on_change'] = 'submit()';
         }
         $rand = Ticket::dropdownType('type', $opt);
         if ($ID) {
             $params = array('type' => '__VALUE__', 'entity_restrict' => $ticket->fields['entities_id'], 'value' => $ticket->fields['itilcategories_id'], 'currenttype' => $ticket->fields['type']);
             Ajax::updateItemOnSelectEvent("dropdown_type{$rand}", "show_category_by_type", $CFG_GLPI["root_doc"] . "/ajax/dropdownTicketCategories.php", $params);
         }
     } else {
         echo Ticket::getTicketTypeName($ticket->fields["type"]);
     }
     echo "</td>";
     echo "<th width='{$colsize3}%'>" . sprintf(__('%1$s%2$s'), __('Category'), $tt->getMandatoryMark('itilcategories_id')) . "</th>";
     echo "<td width='{$colsize4}%'>";
     // Permit to set category when creating ticket without update right
     if ($canupdate || !$ID || $canupdate_descr) {
         $opt = array('value' => $ticket->fields["itilcategories_id"], 'entity' => $ticket->fields["entities_id"]);
         if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
             $opt['condition'] = "`is_helpdeskvisible`='1' AND ";
         } else {
             $opt['condition'] = '';
         }
         /// Auto submit to load template
         if (!$ID) {
             $opt['on_change'] = 'submit()';
         }
         /// if category mandatory, no empty choice
         /// no empty choice is default value set on ticket creation, else yes
         if (($ID || $values['itilcategories_id']) && $tt->isMandatoryField("itilcategories_id") && $ticket->fields["itilcategories_id"] > 0) {
             $opt['display_emptychoice'] = false;
         }
         switch ($ticket->fields["type"]) {
             case Ticket::INCIDENT_TYPE:
                 $opt['condition'] .= "`is_incident`='1'";
                 break;
             case Ticket::DEMAND_TYPE:
                 $opt['condition'] .= "`is_request`='1'";
                 break;
             default:
                 break;
         }
         echo "<span id='show_category_by_type'>";
         ITILCategory::dropdown($opt);
         echo "</span>";
     } else {
         echo Dropdown::getDropdownName("glpi_itilcategories", $ticket->fields["itilcategories_id"]);
     }
     echo "</td>";
     echo "</tr>";
     if (!$ID) {
         echo "</table>";
         $ticket->showActorsPartForm($ID, $values);
         echo "<table class='tab_cadre_fixe' id='mainformtable3'>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<th width='{$colsize1}%'>" . $tt->getBeginHiddenFieldText('status');
     printf(__('%1$s%2$s'), __('Status'), $tt->getMandatoryMark('status'));
     echo $tt->getEndHiddenFieldText('status') . "</th>";
     echo "<td width='{$colsize2}%'>";
     echo $tt->getBeginHiddenFieldValue('status');
     if ($canstatus) {
         Ticket::dropdownStatus(array('value' => $ticket->fields["status"], 'showtype' => 'allowed'));
     } else {
         echo Ticket::getStatus($ticket->fields["status"]);
     }
     echo $tt->getEndHiddenFieldValue('status', $ticket);
     echo "</td>";
     echo "<th width='{$colsize3}%'>" . $tt->getBeginHiddenFieldText('requesttypes_id');
     printf(__('%1$s%2$s'), __('Request source'), $tt->getMandatoryMark('requesttypes_id'));
     echo $tt->getEndHiddenFieldText('requesttypes_id') . "</th>";
     echo "<td width='{$colsize4}%'>";
     echo $tt->getBeginHiddenFieldValue('requesttypes_id');
     if ($canupdate) {
         RequestType::dropdown(array('value' => $ticket->fields["requesttypes_id"]));
     } else {
         echo Dropdown::getDropdownName('glpi_requesttypes', $ticket->fields["requesttypes_id"]);
     }
     echo $tt->getEndHiddenFieldValue('requesttypes_id', $ticket);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>" . $tt->getBeginHiddenFieldText('urgency');
     printf(__('%1$s%2$s'), __('Urgency'), $tt->getMandatoryMark('urgency'));
     echo $tt->getEndHiddenFieldText('urgency') . "</th>";
     echo "<td>";
     if ($canupdate && $canpriority || !$ID || $canupdate_descr) {
         // Only change during creation OR when allowed to change priority OR when user is the creator
         echo $tt->getBeginHiddenFieldValue('urgency');
         $idurgency = Ticket::dropdownUrgency(array('value' => $ticket->fields["urgency"]));
         echo $tt->getEndHiddenFieldValue('urgency', $ticket);
     } else {
         $idurgency = "value_urgency" . mt_rand();
         echo "<input id='{$idurgency}' type='hidden' name='urgency' value='" . $ticket->fields["urgency"] . "'>";
         echo Ticket::getUrgencyName($ticket->fields["urgency"]);
     }
     echo "</td>";
     // Display validation state
     echo "<th>";
     if (!$ID) {
         echo $tt->getBeginHiddenFieldText('_add_validation');
         printf(__('%1$s%2$s'), __('Approval request'), $tt->getMandatoryMark('_add_validation'));
         echo $tt->getEndHiddenFieldText('_add_validation');
     } else {
         echo $tt->getBeginHiddenFieldText('global_validation');
         _e('Approval');
         echo $tt->getEndHiddenFieldText('global_validation');
     }
     echo "</th>";
     echo "<td>";
     if (!$ID) {
         echo $tt->getBeginHiddenFieldValue('_add_validation');
         $validation_right = '';
         if ($values['type'] == Ticket::INCIDENT_TYPE && Session::haveRight('create_incident_validation', 1)) {
             $validation_right = 'validate_incident';
         }
         if ($values['type'] == Ticket::DEMAND_TYPE && Session::haveRight('create_request_validation', 1)) {
             $validation_right = 'validate_request';
         }
         if (!empty($validation_right)) {
             User::dropdown(array('name' => "_add_validation", 'entity' => $ticket->fields['entities_id'], 'right' => $validation_right, 'value' => $values['_add_validation']));
         }
         echo $tt->getEndHiddenFieldValue('_add_validation', $ticket);
         if ($tt->isPredefinedField('global_validation')) {
             echo "<input type='hidden' name='global_validation' value='" . $tt->predefined['global_validation'] . "'>";
         }
     } else {
         echo $tt->getBeginHiddenFieldValue('global_validation');
         if ($canupdate) {
             TicketValidation::dropdownStatus('global_validation', array('global' => true, 'value' => $ticket->fields['global_validation']));
         } else {
             echo TicketValidation::getStatus($ticket->fields['global_validation']);
         }
         echo $tt->getEndHiddenFieldValue('global_validation', $ticket);
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>" . $tt->getBeginHiddenFieldText('impact');
     printf(__('%1$s%2$s'), __('Impact'), $tt->getMandatoryMark('impact'));
     echo $tt->getEndHiddenFieldText('impact') . "</th>";
     echo "<td>";
     echo $tt->getBeginHiddenFieldValue('impact');
     if ($canupdate) {
         $idimpact = Ticket::dropdownImpact(array('value' => $ticket->fields["impact"]));
     } else {
         $idimpact = "value_impact" . mt_rand();
         echo "<input id='{$idimpact}' type='hidden' name='impact' value='" . $ticket->fields["impact"] . "'>";
         echo Ticket::getImpactName($ticket->fields["impact"]);
     }
     echo $tt->getEndHiddenFieldValue('impact', $ticket);
     echo "</td>";
     echo "<th rowspan='2'>" . $tt->getBeginHiddenFieldText('itemtype');
     printf(__('%1$s%2$s'), __('Associated element'), $tt->getMandatoryMark('itemtype'));
     if ($ID && $canupdate) {
         echo "&nbsp;<img title='" . __s('Update') . "' alt='" . __s('Update') . "'\n                      onClick=\"Ext.get('tickethardwareselection{$ID}').setDisplayed('block')\"\n                      class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/showselect.png'>";
     }
     echo $tt->getEndHiddenFieldText('itemtype');
     echo "</th>";
     echo "<td rowspan='2'>";
     echo $tt->getBeginHiddenFieldValue('itemtype');
     // Select hardware on creation or if have update right
     if ($canupdate || !$ID || $canupdate_descr) {
         if ($ID) {
             if ($ticket->fields['itemtype'] && ($item = getItemForItemtype($ticket->fields['itemtype'])) && $ticket->fields["items_id"]) {
                 if ($item->can($ticket->fields["items_id"], 'r')) {
                     printf(__('%1$s - %2$s'), $item->getTypeName(), $item->getLink(array('comments' => true)));
                 } else {
                     printf(__('%1$s - %2$s'), $item->getTypeName(), $item->getNameID());
                 }
             }
         }
         $dev_user_id = 0;
         $dev_itemtype = $ticket->fields["itemtype"];
         $dev_items_id = $ticket->fields["items_id"];
         if (!$ID) {
             $dev_user_id = $values['_users_id_requester'];
             $dev_itemtype = $values["itemtype"];
             $dev_items_id = $values["items_id"];
         } else {
             if (isset($ticket->users[CommonITILActor::REQUESTER]) && count($ticket->users[CommonITILActor::REQUESTER]) == 1) {
                 foreach ($ticket->users[CommonITILActor::REQUESTER] as $user_id_single) {
                     $dev_user_id = $user_id_single['users_id'];
                 }
             }
         }
         if ($ID) {
             echo "<div id='tickethardwareselection{$ID}' style='display:none'>";
         }
         if ($dev_user_id > 0) {
             Ticket::dropdownMyDevices($dev_user_id, $ticket->fields["entities_id"], $dev_itemtype, $dev_items_id);
         }
         Ticket::dropdownAllDevices("itemtype", $dev_itemtype, $dev_items_id, 1, $dev_user_id, $ticket->fields["entities_id"]);
         if ($ID) {
             echo "</div>";
         }
         echo "<span id='item_ticket_selection_information'></span>";
     } else {
         if ($ID && $ticket->fields['itemtype'] && ($item = getItemForItemtype($ticket->fields['itemtype']))) {
             $item->getFromDB($ticket->fields['items_id']);
             printf(__('%1$s - %2$s'), $item->getTypeName(), $item->getNameID());
         } else {
             _e('General');
         }
     }
     echo $tt->getEndHiddenFieldValue('itemtype', $ticket);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>" . sprintf(__('%1$s%2$s'), __('Priority'), $tt->getMandatoryMark('priority')) . "</th>";
     echo "<td>";
     $idajax = 'change_priority_' . mt_rand();
     if ($canupdate && $canpriority && !$tt->isHiddenField('priority')) {
         $idpriority = Ticket::dropdownPriority(array('value' => $ticket->fields["priority"], 'withmajor' => true));
         echo "&nbsp;<span id='{$idajax}' style='display:none'></span>";
     } else {
         $idpriority = 0;
         echo "<span id='{$idajax}'>" . Ticket::getPriorityName($ticket->fields["priority"]) . "</span>";
     }
     if ($canupdate || $canupdate_descr) {
         $params = array('urgency' => '__VALUE0__', 'impact' => '__VALUE1__', 'priority' => $idpriority);
         Ajax::updateItemOnSelectEvent(array($idurgency, $idimpact), $idajax, $CFG_GLPI["root_doc"] . "/ajax/priority.php", $params);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     // Need comment right to add a followup with the actiontime
     if (!$ID && Session::haveRight("global_add_followups", "1")) {
         echo "<th>" . $tt->getBeginHiddenFieldText('actiontime');
         printf(__('%1$s%2$s'), __('Total duration'), $tt->getMandatoryMark('actiontime'));
         echo $tt->getEndHiddenFieldText('actiontime') . "</th>";
         echo "<td>";
         echo $tt->getBeginHiddenFieldValue('actiontime');
         Dropdown::showTimeStamp('actiontime', array('value' => $values['actiontime'], 'addfirstminutes' => true));
         echo $tt->getEndHiddenFieldValue('actiontime', $ticket);
         echo "</td>";
     } else {
         echo "<th></th><td></td>";
     }
     echo "<th>" . $tt->getBeginHiddenFieldText('locations_id');
     printf(__('%1$s%2$s'), __('Location'), $tt->getMandatoryMark('locations_id'));
     echo $tt->getEndHiddenFieldText('locations_id') . "</th>";
     echo "<td>";
     echo $tt->getBeginHiddenFieldValue('locations_id');
     if ($canupdate) {
         Location::dropdown(array('value' => $ticket->fields['locations_id'], 'entity' => $ticket->fields['entities_id']));
     } else {
         echo Dropdown::getDropdownName('glpi_locations', $ticket->fields["locations_id"]);
     }
     echo $tt->getEndHiddenFieldValue('locations_id', $ticket);
     echo "</td></tr>";
     echo "</table>";
     if ($ID) {
         $values['canupdate'] = $canupdate;
         $ticket->showActorsPartForm($ID, $values);
     }
     $view_linked_tickets = $ID || $canupdate;
     echo "<table class='tab_cadre_fixe' id='mainformtable4'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th width='{$colsize1}%'>" . $tt->getBeginHiddenFieldText('name');
     printf(__('%1$s%2$s'), __('Title'), $tt->getMandatoryMark('name'));
     echo $tt->getEndHiddenFieldText('name') . "</th>";
     echo "<td width='" . (100 - $colsize1) . "%' colspan='3'>";
     if (!$ID || $canupdate_descr) {
         echo $tt->getBeginHiddenFieldValue('name');
         $rand = mt_rand();
         echo "<script type='text/javascript' >\n";
         echo "function showName{$rand}() {\n";
         echo "Ext.get('name{$rand}').setDisplayed('none');";
         $params = array('maxlength' => 250, 'size' => 90, 'name' => 'name', 'data' => rawurlencode($ticket->fields["name"]));
         Ajax::updateItemJsCode("viewname{$rand}", $CFG_GLPI["root_doc"] . "/ajax/inputtext.php", $params);
         echo "}";
         echo "</script>\n";
         echo "<div id='name{$rand}' class='tracking left' onClick='showName{$rand}()'>\n";
         if (empty($ticket->fields["name"])) {
             _e('Without title');
         } else {
             echo $ticket->fields["name"];
         }
         echo "</div>\n";
         echo "<div id='viewname{$rand}'>\n";
         echo "</div>\n";
         if (!$ID) {
             echo "<script type='text/javascript' >\n\n            showName{$rand}();\n            </script>";
         }
         echo $tt->getEndHiddenFieldValue('name', $ticket);
     } else {
         if (empty($ticket->fields["name"])) {
             _e('Without title');
         } else {
             echo $ticket->fields["name"];
         }
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th width='{$colsize1}%'>" . $tt->getBeginHiddenFieldText('content');
     printf(__('%1$s%2$s'), __('Description'), $tt->getMandatoryMark('content'));
     echo $tt->getEndHiddenFieldText('content') . "</th>";
     echo "<td width='" . (100 - $colsize1) . "%' colspan='3'>";
     // * Added by plugin surveyticket
     $psTicketTemplate = new PluginSurveyticketTicketTemplate();
     $psSurvey = new PluginSurveyticketSurvey();
     $plugin_surveyticket_surveys_id = 0;
     $a_tickettemplates = current($psTicketTemplate->find("`tickettemplates_id`='" . $tt->fields['id'] . "'\n                                                      AND `type`='" . $values['type'] . "'\n                                                      AND `is_central`='1'"));
     if (isset($a_tickettemplates['plugin_surveyticket_surveys_id'])) {
         $psSurvey = new PluginSurveyticketSurvey();
         $psSurvey->getFromDB($a_tickettemplates['plugin_surveyticket_surveys_id']);
         if ($psSurvey->fields['is_active'] == 1) {
             $plugin_surveyticket_surveys_id = $a_tickettemplates['plugin_surveyticket_surveys_id'];
             $psSurvey = new PluginSurveyticketSurvey();
             $psSurvey->startSurvey($plugin_surveyticket_surveys_id);
         }
     } else {
         // End of adding by plugin
         if (!$ID || $canupdate_descr) {
             // Admin =oui on autorise la modification de la description
             echo $tt->getBeginHiddenFieldValue('content');
             $rand = mt_rand();
             echo "<script type='text/javascript' >\n";
             echo "function showDesc{$rand}() {\n";
             echo "Ext.get('desc{$rand}').setDisplayed('none');";
             $params = array('rows' => 6, 'cols' => 90, 'name' => 'content', 'data' => rawurlencode($ticket->fields["content"]));
             Ajax::updateItemJsCode("viewdesc{$rand}", $CFG_GLPI["root_doc"] . "/ajax/textarea.php", $params);
             echo "}";
             echo "</script>\n";
             echo "<div id='desc{$rand}' class='tracking' onClick='showDesc{$rand}()'>\n";
             if (!empty($ticket->fields["content"])) {
                 echo nl2br($ticket->fields["content"]);
             } else {
                 _e('Empty description');
             }
             echo "</div>\n";
             echo "<div id='viewdesc{$rand}'></div>\n";
             if (!$ID) {
                 echo "<script type='text/javascript' >\n\n            showDesc{$rand}();\n            </script>";
             }
             echo $tt->getEndHiddenFieldValue('content', $ticket);
         } else {
             echo nl2br($ticket->fields["content"]);
         }
         // * Added by plugin surveyticket
     }
     // End of adding by plugin
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     // Permit to add doc when creating a ticket
     if (!$ID) {
         echo "<th width='{$colsize1}%'>" . sprintf(__('File (%s)'), Document::getMaxUploadSize());
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/aide.png' class='pointer' alt=\"" . __s('Help') . "\" onclick=\"window.open('" . $CFG_GLPI["root_doc"] . "/front/documenttype.list.php','Help','scrollbars=1,resizable=1,width=1000," . "height=800')\">";
         echo "&nbsp;";
         Ticket::showDocumentAddButton();
         echo "</th>";
         echo "<td width='{$colsize2}%'>";
         echo "<div id='uploadfiles'><input type='file' name='filename[]' size='20'></div></td>";
     } else {
         echo "<th colspan='2'>";
         $docnb = Document_Item::countForItem($ticket);
         echo "<a href=\"" . $ticket->getLinkURL() . "&amp;forcetab=Document_Item\$1\">";
         //TRANS: %d is the document number
         echo sprintf(_n('%d associated document', '%d associated documents', $docnb), $docnb);
         echo "</a></th>";
     }
     if ($view_linked_tickets) {
         echo "<th width='{$colsize3}%'>" . _n('Linked ticket', 'Linked tickets', 2);
         $rand_linked_ticket = mt_rand();
         if ($canupdate) {
             echo "&nbsp;";
             echo "<img onClick=\"Ext.get('linkedticket{$rand_linked_ticket}').setDisplayed('block')\"\n                   title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n                   class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
         }
         echo '</th>';
         echo "<td width='{$colsize4}%'>";
         if ($canupdate) {
             echo "<div style='display:none' id='linkedticket{$rand_linked_ticket}'>";
             Ticket_Ticket::dropdownLinks('_link[link]', isset($values["_link"]) ? $values["_link"]['link'] : '');
             printf(__('%1$s: %2$s'), __('Ticket'), __('ID'));
             echo "<input type='hidden' name='_link[tickets_id_1]' value='{$ID}'>\n";
             echo "<input type='text' name='_link[tickets_id_2]'\n                   value='" . (isset($values["_link"]) ? $values["_link"]['tickets_id_2'] : '') . "'\n                   size='10'>\n";
             echo "&nbsp;";
             echo "</div>";
             if (isset($values["_link"]) && !empty($values["_link"]['tickets_id_2'])) {
                 echo "<script language='javascript'>Ext.get('linkedticket{$rand_linked_ticket}').\n                      setDisplayed('block');</script>";
             }
         }
         Ticket_Ticket::displayLinkedTicketsTo($ID);
         echo "</td>";
     } else {
         echo "<td></td>";
     }
     echo "</tr>";
     if ((!$ID || $canupdate || $canupdate_descr || Session::haveRight("assign_ticket", "1") || Session::haveRight("steal_ticket", "1")) && !$options['template_preview']) {
         echo "<tr class='tab_bg_1'>";
         if ($ID) {
             if (Session::haveRight('delete_ticket', 1)) {
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 if ($ticket->fields["is_deleted"] == 1) {
                     echo "<input type='submit' class='submit' name='restore' value='" . _sx('button', 'Restore') . "'></td>";
                 } else {
                     echo "<input type='submit' class='submit' name='update' value='" . _sx('button', 'Save') . "'></td>";
                 }
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 if ($ticket->fields["is_deleted"] == 1) {
                     echo "<input type='submit' class='submit' name='purge' value='" . _sx('button', 'Delete permanently') . "' " . Html::addConfirmationOnAction(__('Confirm the final deletion?')) . ">";
                 } else {
                     echo "<input type='submit' class='submit' name='delete' value='" . _sx('button', 'Put in dustbin') . "'></td>";
                 }
             } else {
                 echo "<td class='tab_bg_2 center' colspan='4'>";
                 echo "<input type='submit' class='submit' name='update' value='" . _sx('button', 'Save') . "'>";
             }
             echo "<input type='hidden' name='_read_date_mod' value='" . $ticket->getField('date_mod') . "'>";
         } else {
             echo "<td class='tab_bg_2 center' colspan='4'>";
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
             if ($tt->isField('id') && $tt->fields['id'] > 0) {
                 echo "<input type='hidden' name='_tickettemplates_id' value='" . $tt->fields['id'] . "'>";
                 echo "<input type='hidden' name='_predefined_fields'\n                      value=\"" . Toolbox::prepareArrayForInput($predefined_fields) . "\">";
             }
         }
     }
     echo "</table>";
     echo "<input type='hidden' name='id' value='{$ID}'>";
     echo "</div>";
     if (!$options['template_preview']) {
         Html::closeForm();
         $ticket->addDivForTabs();
     }
     return true;
 }
 /**
  * Print the config form for connections
  *
  * @return Nothing (display)
  **/
 function showFormHelpdesk()
 {
     global $DB, $CFG_GLPI;
     if (!self::canView()) {
         return false;
     }
     $canedit = Config::canUpdate();
     if ($canedit) {
         echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL(__CLASS__) . "\" method='post'>";
     }
     echo "<div class='center spaced' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __('Assistance') . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td width='30%'>" . __('Step for the hours (minutes)') . "</td>";
     echo "<td width='20%'>";
     Dropdown::showNumber('time_step', array('value' => $CFG_GLPI["time_step"], 'min' => 30, 'max' => 60, 'step' => 30, 'toadd' => array(1 => 1, 5 => 5, 10 => 10, 15 => 15, 20 => 20)));
     echo "</td>";
     echo "<td width='30%'>" . __('Limit of the schedules for planning') . "</td>";
     echo "<td width='20%'>";
     Dropdown::showHours('planning_begin', array('value' => $CFG_GLPI["planning_begin"]));
     echo "&nbsp;->&nbsp;";
     Dropdown::showHours('planning_end', array('value' => $CFG_GLPI["planning_end"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Default file size limit imported by the mails receiver') . "</td><td>";
     MailCollector::showMaxFilesize('default_mailcollector_filesize_max', $CFG_GLPI["default_mailcollector_filesize_max"]);
     echo "</td>";
     echo "<td>" . __('Use rich text for helpdesk') . "</td><td>";
     $id = 'alert' . mt_rand();
     $param['on_change'] = '$("#' . $id . '").html("");
         if ($(this).val() == 0) {
            $("#' . $id . '").html("<br>' . __('You will lose the formatting of your data') . '");
         }';
     Dropdown::showYesNo("use_rich_text", $CFG_GLPI["use_rich_text"], -1, $param);
     echo "<span class='red' id='" . $id . "'></span>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Default heading when adding a document to a ticket') . "</td><td>";
     DocumentCategory::dropdown(array('value' => $CFG_GLPI["documentcategories_id_forticket"], 'name' => "documentcategories_id_forticket"));
     echo "</td>";
     echo "<td>" . __('By default, a software may be linked to a ticket') . "</td><td>";
     Dropdown::showYesNo("default_software_helpdesk_visible", $CFG_GLPI["default_software_helpdesk_visible"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Keep tickets when purging hardware in the inventory') . "</td><td>";
     Dropdown::showYesNo("keep_tickets_on_delete", $CFG_GLPI["keep_tickets_on_delete"]);
     echo "</td><td>" . __('Show personnal information in new ticket form (simplified interface)');
     echo "</td><td>";
     Dropdown::showYesNo('use_check_pref', $CFG_GLPI['use_check_pref']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Allow anonymous ticket creation (helpdesk.receiver)') . "</td><td>";
     Dropdown::showYesNo("use_anonymous_helpdesk", $CFG_GLPI["use_anonymous_helpdesk"]);
     echo "</td><td>" . __('Allow anonymous followups (receiver)') . "</td><td>";
     Dropdown::showYesNo("use_anonymous_followups", $CFG_GLPI["use_anonymous_followups"]);
     echo "</td></tr>";
     echo "</table>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='7'>" . __('Matrix of calculus for priority');
     echo "<input type='hidden' name='_matrix' value='1'></th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td class='b right' colspan='2'>" . __('Impact') . "</td>";
     for ($impact = 5; $impact >= 1; $impact--) {
         echo "<td class='center'>" . Ticket::getImpactName($impact) . '<br>';
         if ($impact == 3) {
             $isimpact[3] = 1;
             echo "<input type='hidden' name='_impact_3' value='1'>";
         } else {
             $isimpact[$impact] = ($CFG_GLPI['impact_mask'] & 1 << $impact) > 0;
             Dropdown::showYesNo("_impact_{$impact}", $isimpact[$impact]);
         }
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='b' colspan='2'>" . __('Urgency') . "</td>";
     for ($impact = 5; $impact >= 1; $impact--) {
         echo "<td>&nbsp;</td>";
     }
     echo "</tr>";
     for ($urgency = 5; $urgency >= 1; $urgency--) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . Ticket::getUrgencyName($urgency) . "&nbsp;</td>";
         echo "<td>";
         if ($urgency == 3) {
             $isurgency[3] = 1;
             echo "<input type='hidden' name='_urgency_3' value='1'>";
         } else {
             $isurgency[$urgency] = ($CFG_GLPI['urgency_mask'] & 1 << $urgency) > 0;
             Dropdown::showYesNo("_urgency_{$urgency}", $isurgency[$urgency]);
         }
         echo "</td>";
         for ($impact = 5; $impact >= 1; $impact--) {
             $pri = round(($urgency + $impact) / 2);
             if (isset($CFG_GLPI['priority_matrix'][$urgency][$impact])) {
                 $pri = $CFG_GLPI['priority_matrix'][$urgency][$impact];
             }
             if ($isurgency[$urgency] && $isimpact[$impact]) {
                 $bgcolor = $_SESSION["glpipriority_{$pri}"];
                 echo "<td class='center' bgcolor='{$bgcolor}'>";
                 Ticket::dropdownPriority(array('value' => $pri, 'name' => "_matrix_{$urgency}_{$impact}"));
                 echo "</td>";
             } else {
                 echo "<td><input type='hidden' name='_matrix_{$urgency}_{$impact}' value='{$pri}'>\n                     </td>";
             }
         }
         echo "</tr>\n";
     }
     if ($canedit) {
         echo "<tr class='tab_bg_2'>";
         echo "<td colspan='7' class='center'>";
         echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . "\">";
         echo "</td></tr>";
     }
     echo "</table></div>";
     Html::closeForm();
 }
Esempio n. 5
0
 /**
  * Display item used to select a pattern for a criteria
  *
  * @param $name      criteria name
  * @param $ID        the given criteria
  * @param $condition condition used
  * @param $value     the pattern (default '')
  * @param $test      Is to test rule ? (false by default)
  **/
 function displayCriteriaSelectPattern($name, $ID, $condition, $value = "", $test = false)
 {
     $crit = $this->getCriteria($ID);
     $display = false;
     $tested = false;
     if (isset($crit['type']) && ($test || in_array($condition, array(self::PATTERN_IS, self::PATTERN_IS_NOT, self::PATTERN_NOT_UNDER, self::PATTERN_UNDER)))) {
         switch ($crit['type']) {
             case "yesonly":
                 Dropdown::showYesNo($name, $crit['table'], 0);
                 $display = true;
                 break;
             case "yesno":
                 Dropdown::showYesNo($name, $crit['table']);
                 $display = true;
                 break;
             case "dropdown":
                 $param = array('name' => $name, 'value' => $value);
                 if (isset($crit['condition'])) {
                     $param['condition'] = $crit['condition'];
                 }
                 Dropdown::show(getItemTypeForTable($crit['table']), $param);
                 $display = true;
                 break;
             case "dropdown_users":
                 User::dropdown(array('value' => $value, 'name' => $name, 'right' => 'all'));
                 $display = true;
                 break;
             case "dropdown_tracking_itemtype":
                 Dropdown::showItemTypes($name, array_keys(Ticket::getAllTypesForHelpdesk()));
                 $display = true;
                 break;
             case "dropdown_urgency":
                 Ticket::dropdownUrgency(array('name' => $name, 'value' => $value));
                 $display = true;
                 break;
             case "dropdown_impact":
                 Ticket::dropdownImpact(array('name' => $name, 'value' => $value));
                 $display = true;
                 break;
             case "dropdown_priority":
                 Ticket::dropdownPriority(array('name' => $name, 'value' => $value));
                 $display = true;
                 break;
             case "dropdown_status":
                 Ticket::dropdownStatus(array('name' => $name, 'value' => $value));
                 $display = true;
                 break;
             case "dropdown_tickettype":
                 Ticket::dropdownType($name, array('value' => $value));
                 $display = true;
                 break;
         }
         $tested = true;
     }
     //Not a standard condition
     if (!$tested) {
         $display = $this->displayAdditionalRuleCondition($condition, $crit, $name, $value, $test);
     }
     if ($condition == self::PATTERN_EXISTS || $condition == self::PATTERN_DOES_NOT_EXISTS) {
         echo "<input type='hidden' name='{$name}' value='1'>";
         $display = true;
     }
     if (!$display && ($rc = getItemForItemtype($this->rulecriteriaclass))) {
         Html::autocompletionTextField($rc, "pattern", array('name' => $name, 'value' => $value, 'size' => 70));
     }
 }
Esempio n. 6
0
 /**
  * Print the config form for connections
  *
  * @return Nothing (display)
  **/
 function showFormHelpdesk()
 {
     global $DB, $LANG, $CFG_GLPI;
     if (!haveRight("config", "w")) {
         return false;
     }
     echo "<form name='form' action=\"" . getItemTypeFormURL(__CLASS__) . "\" method='post'>";
     echo "<div class='center' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . $LANG['title'][24] . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['setup'][612] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("is_ticket_category_mandatory", $CFG_GLPI["is_ticket_category_mandatory"]);
     echo "</td><td>" . $LANG['setup'][148] . "&nbsp;:</td><td>";
     Dropdown::showInteger('time_step', $CFG_GLPI["time_step"], 30, 60, 30, array(5 => 5, 10 => 10, 15 => 15, 20 => 20));
     echo "&nbsp;" . $LANG['job'][22];
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['setup'][610] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("is_ticket_title_mandatory", $CFG_GLPI["is_ticket_title_mandatory"]);
     echo "</td><td>" . $LANG['setup'][223] . "&nbsp;:</td><td>";
     Dropdown::showHours('planning_begin', $CFG_GLPI["planning_begin"]);
     echo "&nbsp;->&nbsp;";
     Dropdown::showHours('planning_end', $CFG_GLPI["planning_end"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . $LANG['setup'][611] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("is_ticket_content_mandatory", $CFG_GLPI["is_ticket_content_mandatory"]);
     echo "</td><td>" . $LANG['mailgate'][7] . " (" . $LANG['setup'][46] . ")&nbsp;:</td><td>";
     MailCollector::showMaxFilesize('default_mailcollector_filesize_max', $CFG_GLPI["default_mailcollector_filesize_max"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . $LANG['setup'][52] . "&nbsp;:</td><td>";
     $autoassign = array(NO_AUTO_ASSIGN => $LANG['choice'][0], AUTO_ASSIGN_HARDWARE_CATEGORY => $LANG['setup'][51], AUTO_ASSIGN_CATEGORY_HARDWARE => $LANG['setup'][50]);
     Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $CFG_GLPI["auto_assign_mode"]));
     echo "</td><td>" . $LANG['setup'][409] . "&nbsp;:</td><td>";
     Dropdown::show('DocumentCategory', array('value' => $CFG_GLPI["documentcategories_id_forticket"], 'name' => "documentcategories_id_forticket"));
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['entity'][18] . "&nbsp;:</td><td>";
     Dropdown::showInteger('autoclose_delay', $CFG_GLPI['autoclose_delay'], 0, 99, 1, array(-10 => $LANG['setup'][307]));
     echo "&nbsp;" . $LANG['stats'][31] . "</td>";
     echo "<td>" . $LANG['setup'][608] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("default_software_helpdesk_visible", $CFG_GLPI["default_software_helpdesk_visible"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['tracking'][37] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("keep_tickets_on_delete", $CFG_GLPI["keep_tickets_on_delete"]);
     echo "</td><td>" . $LANG['setup'][219] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("use_anonymous_helpdesk", $CFG_GLPI["use_anonymous_helpdesk"]);
     echo "</td></tr>";
     echo "</table><br>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='7'>" . $LANG['help'][1];
     echo "<input type='hidden' name='_matrix' value='1'></th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td class='b right' colspan='2'>" . $LANG['joblist'][30] . "&nbsp;:</td>";
     for ($impact = 5, $msg = 47; $impact >= 1; $impact--, $msg++) {
         echo "<td>" . $LANG['help'][$msg] . "&nbsp;: ";
         if ($impact == 3) {
             $isimpact[3] = 1;
             echo "<input type='hidden' name='_impact_3' value='1'>";
         } else {
             $isimpact[$impact] = ($CFG_GLPI['impact_mask'] & 1 << $impact) > 0;
             Dropdown::showYesNo("_impact_{$impact}", $isimpact[$impact]);
         }
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='b' colspan='2'>" . $LANG['joblist'][29] . "&nbsp;:</td>";
     for ($impact = 5, $msg = 47; $impact >= 1; $impact--, $msg++) {
         echo "<td>&nbsp;</td>";
     }
     echo "</tr>";
     for ($urgency = 5, $msg = 42; $urgency >= 1; $urgency--, $msg++) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['help'][$msg] . "&nbsp;:</td>";
         echo "<td>";
         if ($urgency == 3) {
             $isurgency[3] = 1;
             echo "<input type='hidden' name='_urgency_3' value='1'>";
         } else {
             $isurgency[$urgency] = ($CFG_GLPI['urgency_mask'] & 1 << $urgency) > 0;
             Dropdown::showYesNo("_urgency_{$urgency}", $isurgency[$urgency]);
         }
         echo "</td>";
         for ($impact = 5; $impact >= 1; $impact--) {
             $pri = round(($urgency + $impact) / 2);
             if (isset($CFG_GLPI['priority_matrix'][$urgency][$impact])) {
                 $pri = $CFG_GLPI['priority_matrix'][$urgency][$impact];
             }
             if ($isurgency[$urgency] && $isimpact[$impact]) {
                 $bgcolor = $_SESSION["glpipriority_{$pri}"];
                 echo "<td bgcolor='{$bgcolor}'>";
                 Ticket::dropdownPriority("_matrix_{$urgency}_{$impact}", $pri);
                 echo "</td>";
             } else {
                 echo "<td><input type='hidden' name='_matrix_{$urgency}_{$impact}' value='{$pri}'></td>";
             }
         }
         echo "</tr>\n";
     }
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='7' class='center'>";
     echo "<input type='hidden' name='id' value='" . $CFG_GLPI["id"] . "'>";
     echo "<input type='submit' name='update' class='submit' value=\"" . $LANG['buttons'][2] . "\">";
     echo "</td></tr>";
     echo "</table></div>";
     echo "</form>";
 }
Esempio n. 7
0
 /**
  * @param $options   array
  **/
 function displayActionSelectPattern($options = array())
 {
     $display = false;
     $param['value'] = '';
     if (isset($options['value'])) {
         $param['value'] = $options['value'];
     }
     switch ($options["action_type"]) {
         //If a regex value is used, then always display an autocompletiontextfield
         case "regex_result":
         case "append_regex_result":
             Html::autocompletionTextField($this, "value", $param);
             break;
         case 'fromuser':
         case 'fromitem':
             Dropdown::showYesNo("value", $param['value'], 0);
             $display = true;
             break;
         default:
             $actions = Rule::getActionsByType($options["sub_type"]);
             if (isset($actions[$options["field"]]['type'])) {
                 switch ($actions[$options["field"]]['type']) {
                     case "dropdown":
                         $table = $actions[$options["field"]]['table'];
                         $param['name'] = "value";
                         if (isset($actions[$options["field"]]['condition'])) {
                             $param['condition'] = $actions[$options["field"]]['condition'];
                         }
                         Dropdown::show(getItemTypeForTable($table), $param);
                         $display = true;
                         break;
                     case "dropdown_tickettype":
                         Ticket::dropdownType('value', $param);
                         $display = true;
                         break;
                     case "dropdown_assign":
                         $param['name'] = 'value';
                         $param['right'] = 'own_ticket';
                         User::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_users":
                         $param['name'] = 'value';
                         $param['right'] = 'all';
                         User::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_urgency":
                         $param['name'] = 'value';
                         Ticket::dropdownUrgency($param);
                         $display = true;
                         break;
                     case "dropdown_impact":
                         $param['name'] = 'value';
                         Ticket::dropdownImpact($param);
                         $display = true;
                         break;
                     case "dropdown_priority":
                         if ($_POST["action_type"] != 'compute') {
                             $param['name'] = 'value';
                             Ticket::dropdownPriority($param);
                         }
                         $display = true;
                         break;
                     case "dropdown_status":
                         $param['name'] = 'value';
                         Ticket::dropdownStatus($param);
                         $display = true;
                         break;
                     case "yesonly":
                         Dropdown::showYesNo("value", $param['value'], 0);
                         $display = true;
                         break;
                     case "yesno":
                         Dropdown::showYesNo("value", $param['value']);
                         $display = true;
                         break;
                     case "dropdown_management":
                         $param['name'] = 'value';
                         $param['management_restrict'] = 2;
                         $param['withtemplate'] = false;
                         Dropdown::showGlobalSwitch(0, $param);
                         $display = true;
                         break;
                     case "dropdown_users_validate":
                         $used = array();
                         if ($item = getItemForItemtype($options["sub_type"])) {
                             $rule_data = getAllDatasFromTable('glpi_ruleactions', "`action_type` = 'add_validation'\n                                                           AND `field` = 'users_id_validate'\n                                                           AND `" . $item->getRuleIdField() . "`\n                                                            = '" . $options[$item->getRuleIdField()] . "'");
                             foreach ($rule_data as $data) {
                                 $used[] = $data['value'];
                             }
                         }
                         $param['name'] = 'value';
                         $param['right'] = array('validate_incident', 'validate_request');
                         $param['used'] = $used;
                         User::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_groups_validate":
                         $used = array();
                         if ($item = getItemForItemtype($options["sub_type"])) {
                             $rule_data = getAllDatasFromTable('glpi_ruleactions', "`action_type` = 'add_validation'\n                                                           AND `field` = 'groups_id_validate'\n                                                           AND `" . $item->getRuleIdField() . "`\n                                                            = '" . $options[$item->getRuleIdField()] . "'");
                             foreach ($rule_data as $data) {
                                 $used[] = $data['value'];
                             }
                         }
                         $condition = "(SELECT count(`users_id`)\n                                    FROM `glpi_groups_users`\n                                    WHERE `groups_id` = `glpi_groups`.`id`)";
                         $param['name'] = 'value';
                         $param['condition'] = $condition;
                         $param['right'] = array('validate_incident', 'validate_request');
                         $param['used'] = $used;
                         Group::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_validation_percent":
                         $ticket = new Ticket();
                         echo $ticket->getValueToSelect('validation_percent', 'value', $param['value']);
                         $display = true;
                         break;
                     default:
                         if ($rule = getItemForItemtype($options["sub_type"])) {
                             $display = $rule->displayAdditionalRuleAction($actions[$options["field"]], $param['value']);
                         }
                         break;
                 }
             }
             if (!$display) {
                 Html::autocompletionTextField($this, "value", $param);
             }
     }
 }
Esempio n. 8
0
 public function showEquals($searchopt, $value, $edit = true)
 {
     $inputname = $searchopt['linkfield'];
     switch ($searchopt['table'] . "." . $searchopt['linkfield']) {
         case "glpi_tickets.status":
             if ($edit) {
                 Ticket::dropdownStatus($inputname, $value, 1);
             } else {
                 echo Ticket::getStatus($value);
             }
             break;
         case "glpi_tickets.priority":
             if ($edit) {
                 Ticket::dropdownPriority($inputname, $value, true, true);
             } else {
                 echo Ticket::getPriorityName(trim($value));
             }
             break;
         case "glpi_tickets.impact":
             if ($edit) {
                 Ticket::dropdownImpact($inputname, $value, true);
             } else {
                 echo Ticket::getImpactName($value);
             }
             break;
         case "glpi_tickets.urgency":
             if ($edit) {
                 Ticket::dropdownUrgency($inputname, $value, true);
             } else {
                 echo Ticket::getUrgencyName($value);
             }
             break;
         case "glpi_tickets.global_validation":
             if ($edit) {
                 TicketValidation::dropdownStatus($inputname, array('value' => $value, 'all' => 1));
             } else {
                 TicketValidation::getStatus($value);
             }
             break;
         case "glpi_users.name":
             if ($edit) {
                 User::dropdown(array('name' => $inputname, 'value' => $value, 'comments' => false, 'all' => -1, 'right' => 'all'));
             } else {
                 echo getUserName($value);
             }
             break;
         case "glpi_ticketvalidations.status":
             if ($edit) {
                 TicketValidation::dropdownStatus($inputname, array('value' => $value, 'all' => 1));
             } else {
                 echo TicketValidation::getStatus($value);
             }
             break;
     }
 }
Esempio n. 9
0
             break;
         case "Ticket.users_id_assign":
             User::dropdown(array('name' => $inputname, 'value' => $_REQUEST['value'], 'right' => 'own_ticket', 'all' => 1));
             $display = true;
             break;
     }
 }
 if (!$display && isset($searchopt['field'])) {
     // Specific cases
     switch ($searchopt['table'] . "." . $searchopt['field']) {
         case "glpi_tickets.status":
             Ticket::dropdownStatus($inputname, $_REQUEST['value'], 1);
             $display = true;
             break;
         case "glpi_tickets.priority":
             Ticket::dropdownPriority($inputname, $_REQUEST['value'], true, true);
             $display = true;
             break;
         case "glpi_tickets.impact":
             Ticket::dropdownImpact($inputname, $_REQUEST['value'], true);
             $display = true;
             break;
         case "glpi_tickets.urgency":
             Ticket::dropdownUrgency($inputname, $_REQUEST['value'], true);
             $display = true;
             break;
         case "glpi_tickets.global_validation":
             TicketValidation::dropdownStatus($inputname, array('value' => $_REQUEST['value'], 'all' => 1));
             $display = true;
             break;
         case "glpi_users.name":
Esempio n. 10
0
function plugin_projet_MassiveActionsFieldsDisplay($options = array())
{
    $table = $options['options']['table'];
    $field = $options['options']['field'];
    $linkfield = $options['options']['linkfield'];
    if ($table == getTableForItemType($options['itemtype'])) {
        // Table fields
        switch ($table . "." . $field) {
            case "glpi_plugin_projet_projets.advance":
            case "glpi_plugin_projet_tasks.advance":
                echo "<select name='advance'>";
                for ($i = 0; $i < 101; $i += 5) {
                    echo "<option value='{$i}'>{$i}</option>";
                }
                echo "</select> ";
                echo "<input type='hidden' name='field' value='advance'>";
                return true;
                break;
            case "glpi_plugin_projet_tasks.priority":
                Ticket::dropdownPriority($linkfield, $field, false, true);
                return true;
                break;
        }
    }
    // Need to return false on non display item
    return false;
}
Esempio n. 11
0
 /**
  * @param $options   array
  **/
 function displayActionSelectPattern($options = array())
 {
     $display = false;
     switch ($_POST["action_type"]) {
         //If a regex value is used, then always display an autocompletiontextfield
         case "regex_result":
         case "append_regex_result":
             Html::autocompletionTextField($this, "value");
             break;
         case 'fromuser':
         case 'fromitem':
             Dropdown::showYesNo("value", 0, 0);
             $display = true;
             break;
         default:
             $actions = Rule::getActionsByType($options["sub_type"]);
             if (isset($actions[$options["field"]]['type'])) {
                 switch ($actions[$options["field"]]['type']) {
                     case "dropdown":
                         $table = $actions[$options["field"]]['table'];
                         $param = array('name' => "value");
                         if (isset($actions[$options["field"]]['condition'])) {
                             $param['condition'] = $actions[$options["field"]]['condition'];
                         }
                         Dropdown::show(getItemTypeForTable($table), $param);
                         $display = true;
                         break;
                     case "dropdown_tickettype":
                         Ticket::dropdownType('value');
                         $display = true;
                         break;
                     case "dropdown_assign":
                         User::dropdown(array('name' => 'value', 'right' => 'own_ticket'));
                         $display = true;
                         break;
                     case "dropdown_users":
                         User::dropdown(array('name' => 'value', 'right' => 'all'));
                         $display = true;
                         break;
                     case "dropdown_urgency":
                         Ticket::dropdownUrgency(array('name' => 'value'));
                         $display = true;
                         break;
                     case "dropdown_impact":
                         Ticket::dropdownImpact(array('name' => 'value'));
                         $display = true;
                         break;
                     case "dropdown_priority":
                         if ($_POST["action_type"] != 'compute') {
                             Ticket::dropdownPriority(array('name' => 'value'));
                         }
                         $display = true;
                         break;
                     case "dropdown_status":
                         Ticket::dropdownStatus(array('name' => "value"));
                         $display = true;
                         break;
                     case "yesonly":
                         Dropdown::showYesNo("value", 0, 0);
                         $display = true;
                         break;
                     case "yesno":
                         Dropdown::showYesNo("value");
                         $display = true;
                         break;
                     case "dropdown_management":
                         Dropdown::showGlobalSwitch(0, array('name' => 'value', 'management_restrict' => 2, 'withtemplate' => false));
                         $display = true;
                         break;
                     case "dropdown_users_validate":
                         User::dropdown(array('name' => "value", 'right' => array('validate_incident', 'validate_request')));
                         $display = true;
                         break;
                     default:
                         if ($rule = getItemForItemtype($options["sub_type"])) {
                             $display = $rule->displayAdditionalRuleAction($actions[$options["field"]]);
                         }
                         break;
                 }
             }
             if (!$display) {
                 Html::autocompletionTextField($this, "value");
             }
     }
 }
     echo " " . $LANG['financial'][57];
     break;
 case "glpi_softwarelicenses.number":
     Dropdown::showInteger($search["linkfield"], 0, 1, 1000, 1, array(-1 => $LANG['software'][4]));
     break;
 case "glpi_contracts.alert":
     Contract::dropdownAlert($search["linkfield"], 0);
     break;
 case "glpi_tickets.status":
     Ticket::dropdownStatus($search["linkfield"]);
     break;
 case "glpi_tickets.type":
     Ticket::dropdownType($search["linkfield"]);
     break;
 case "glpi_tickets.priority":
     Ticket::dropdownPriority($search["linkfield"]);
     break;
 case "glpi_tickets.impact":
     Ticket::dropdownImpact($search["linkfield"]);
     break;
 case "glpi_tickets.urgency":
     Ticket::dropdownUrgency($search["linkfield"]);
     break;
 case "glpi_tickets.global_validation":
     TicketValidation::dropdownStatus($search["linkfield"]);
     break;
 default:
     // Specific plugin Type case
     $plugdisplay = false;
     if ($plug = isPluginItemType($_POST["itemtype"])) {
         $plugdisplay = doOneHook($plug['plugin'], 'MassiveActionsFieldsDisplay', array('itemtype' => $_POST["itemtype"], 'options' => $search));