static function showHelpdeskOptions(Entity $entity) { global $LANG, $CFG_GLPI; $ID = $entity->getField('id'); if (!$entity->can($ID, 'r') || !haveRight('entity_helpdesk', 'r')) { return false; } $canedit = haveRight('entity_helpdesk', 'w') && haveAccessToEntity($ID); // Get data $entdata = new EntityData(); if (!$entdata->getFromDB($ID)) { $entdata->getEmpty(); } echo "<div class='spaced'>"; if ($canedit) { echo "<form method='post' name=form action='" . getItemTypeFormURL(__CLASS__) . "'>"; } echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['buttons'][15] . " : </td>"; echo "<td colspan='2'>"; $options = array('value' => $entdata->fields["calendars_id"], 'emptylabel' => $LANG['common'][102]); if ($ID == 0) { $options['emptylabel'] = $LANG['sla'][10]; } Dropdown::show('Calendar', $options); if ($entdata->fields["calendars_id"] == 0) { $calendar = new Calendar(); if ($calendar->getFromDB(self::getUsedConfig('calendars_id', $ID))) { echo " - " . $calendar->getLink(); } } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][28] . " : </td>"; echo "<td colspan='2'>"; $toadd = array(); if ($ID != 0) { $toadd = array(0 => $LANG['common'][102]); } Ticket::dropdownType('tickettype', $entdata->fields["tickettype"], $toadd); if ($entdata->fields["calendars_id"] == 0) { $calendar = new Calendar(); if ($calendar->getFromDB(self::getUsedConfig('calendars_id', $ID))) { echo " - " . $calendar->getLink(); } } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['setup'][52] . " : </td>"; echo "<td colspan='2'>"; $autoassign = array(-1 => $LANG['setup'][731], 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' => $entdata->fields["auto_assign_mode"])); echo "</td></tr>"; echo "<tr><th colspan='4'>" . $LANG['entity'][17] . "</th></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][18] . " : </td>"; echo "<td colspan='2'>"; Dropdown::showInteger('autoclose_delay', $entdata->fields['autoclose_delay'], 0, 99, 1, array(-1 => $LANG['setup'][731], -10 => $LANG['setup'][307])); /* Alert::dropdownIntegerNever('autoclose_delay', $entdata->fields['autoclose_delay'], array('max' => 99, 'inherit_global' => 1, 'never_value' => -10,)); */ echo " " . $LANG['stats'][31] . "</td></tr>"; echo "<tr><th colspan='4'>" . $LANG['entity'][19] . "</th></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][19] . " : </td>"; echo "<td colspan='2'>"; /// no inquest case = rate 0 $typeinquest = array(0 => $LANG['common'][102], 1 => $LANG['satisfaction'][9], 2 => $LANG['satisfaction'][10]); // No inherit from parent for root entity if ($entdata->fields['entities_id'] == 0) { unset($typeinquest[0]); if ($entdata->fields['inquest_config'] == 0) { $entdata->fields['inquest_config'] = 1; } } $rand = Dropdown::showFromArray('inquest_config', $typeinquest, $options = array('value' => $entdata->fields['inquest_config'])); echo "</td></tr>\n"; // Do not display for root entity in inherit case if ($entdata->fields['inquest_config'] == 0 && $entdata->fields['entities_id'] != 0) { $inquestconfig = self::getUsedConfig('inquest_config', $entdata->fields['entities_id']); $inquestrate = self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_rate'); echo "<tr><td colspan='4' class='green center'>" . $LANG['common'][102] . " : "; if ($inquestrate == 0) { echo $LANG['crontask'][31]; } else { echo $typeinquest[$inquestconfig]; echo " - " . self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_delay'); echo " " . $LANG['stats'][31] . " - "; echo $inquestrate . "%"; if ($inquestconfig == 2) { echo " - " . self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_URL'); } } echo "</td></tr>\n"; } echo "<tr class='tab_bg_1'><td colspan='4'>"; $_REQUEST = array('inquest_config' => $entdata->fields['inquest_config'], 'entities_id' => $ID); $params = array('inquest_config' => '__VALUE__', 'entities_id' => $ID); echo "<div id='inquestconfig'>"; include GLPI_ROOT . '/ajax/ticketsatisfaction.php'; echo "</div>\n"; echo "</td></tr>"; if ($canedit) { echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='4'>"; echo "<input type='hidden' name='entities_id' value='{$ID}'>"; if ($entdata->fields["id"]) { echo "<input type='hidden' name='id' value='" . $entdata->fields["id"] . "'>"; echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\"\n class='submit'>"; } else { echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][7] . "\" class='submit'>"; } echo "</td></tr>"; echo "</table></form>"; } else { echo "</table>"; } echo "</div>"; ajaxUpdateItemOnSelectEvent("dropdown_inquest_config{$rand}", "inquestconfig", $CFG_GLPI["root_doc"] . "/ajax/ticketsatisfaction.php", $params); }