/** * @since version 0.84 (before in entitydata.class) * * @param $entity Entity object **/ static function showHelpdeskOptions(Entity $entity) { global $CFG_GLPI; $ID = $entity->getField('id'); if (!$entity->can($ID, READ) || !Session::haveRightsOr(self::$rightname, array(self::READHELPDESK, self::UPDATEHELPDESK))) { return false; } $canedit = Session::haveRight(self::$rightname, self::UPDATEHELPDESK) && Session::haveAccessToEntity($ID); echo "<div class='spaced'>"; if ($canedit) { echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; } echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . _n('Ticket template', 'Ticket templates', 1) . "</td>"; echo "<td colspan='2'>"; $toadd = array(); if ($ID != 0) { $toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity')); } $options = array('value' => $entity->fields["tickettemplates_id"], 'entity' => $ID, 'toadd' => $toadd); TicketTemplate::dropdown($options); if ($entity->fields["tickettemplates_id"] == self::CONFIG_PARENT && $ID != 0) { echo "<font class='green'> "; $tt = new TicketTemplate(); $tid = self::getUsedConfig('tickettemplates_id', $ID, '', 0); if (!$tid) { echo Dropdown::EMPTY_VALUE; } else { if ($tt->getFromDB($tid)) { echo $tt->getLink(); } } echo "</font>"; } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Calendar') . "</td>"; echo "<td colspan='2'>"; $options = array('value' => $entity->fields["calendars_id"], 'emptylabel' => __('24/7')); if ($ID != 0) { $options['toadd'] = array(self::CONFIG_PARENT => __('Inheritance of the parent entity')); } Calendar::dropdown($options); if ($entity->fields["calendars_id"] == self::CONFIG_PARENT && $ID != 0) { echo "<font class='green'> "; $calendar = new Calendar(); $cid = self::getUsedConfig('calendars_id', $ID, '', 0); if (!$cid) { _e('24/7'); } else { if ($calendar->getFromDB($cid)) { echo $calendar->getLink(); } } echo "</font>"; } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Tickets default type') . "</td>"; echo "<td colspan='2'>"; $toadd = array(); if ($ID != 0) { $toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity')); } Ticket::dropdownType('tickettype', array('value' => $entity->fields["tickettype"], 'toadd' => $toadd)); if ($entity->fields['tickettype'] == self::CONFIG_PARENT && $ID != 0) { echo "<font class='green'> "; echo Ticket::getTicketTypeName(self::getUsedConfig('tickettype', $ID, '', Ticket::INCIDENT_TYPE)); echo "</font>"; } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Automatic assignment of tickets') . "</td>"; echo "<td colspan='2'>"; $autoassign = self::getAutoAssignMode(); if ($ID == 0) { unset($autoassign[self::CONFIG_PARENT]); } Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $entity->fields["auto_assign_mode"])); if ($entity->fields['auto_assign_mode'] == self::CONFIG_PARENT && $ID != 0) { $auto_assign_mode = self::getUsedConfig('auto_assign_mode', $entity->fields['entities_id']); echo "<font class='green'> "; echo $autoassign[$auto_assign_mode]; echo "</font>"; } echo "</td></tr>"; echo "<tr><th colspan='4'>" . __('Automatic closing configuration') . "</th></tr>"; echo "<tr class='tab_bg_1'>" . "<td colspan='2'>" . __('Automatic closing of solved tickets after') . "</td>"; echo "<td colspan='2'>"; $autoclose = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'), self::CONFIG_NEVER => __('Never'), 0 => __('Immediatly')); if ($ID == 0) { unset($autoclose[self::CONFIG_PARENT]); } Dropdown::showNumber('autoclose_delay', array('value' => $entity->fields['autoclose_delay'], 'min' => 1, 'max' => 99, 'step' => 1, 'toadd' => $autoclose, 'unit' => 'day')); if ($entity->fields['autoclose_delay'] == self::CONFIG_PARENT && $ID != 0) { $autoclose_mode = self::getUsedConfig('autoclose_delay', $entity->fields['entities_id'], '', self::CONFIG_NEVER); echo "<br><font class='green'> "; if ($autoclose_mode >= 0) { printf(_n('%d day', '%d days', $autoclose_mode), $autoclose_mode); } else { echo $autoclose[$autoclose_mode]; } echo "</font>"; } echo "</td></tr>"; echo "<tr><th colspan='4'>" . __('Configuring the satisfaction survey') . "</th></tr>"; echo "<tr class='tab_bg_1'>" . "<td colspan='2'>" . __('Configuring the satisfaction survey') . "</td>"; echo "<td colspan='2'>"; /// no inquest case = rate 0 $typeinquest = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'), 1 => __('Internal survey'), 2 => __('External survey')); // No inherit from parent for root entity if ($ID == 0) { unset($typeinquest[self::CONFIG_PARENT]); if ($entity->fields['inquest_config'] == self::CONFIG_PARENT) { $entity->fields['inquest_config'] = 1; } } $rand = Dropdown::showFromArray('inquest_config', $typeinquest, $options = array('value' => $entity->fields['inquest_config'])); echo "</td></tr>\n"; // Do not display for root entity in inherit case if ($entity->fields['inquest_config'] == self::CONFIG_PARENT && $ID != 0) { $inquestconfig = self::getUsedConfig('inquest_config', $entity->fields['entities_id']); $inquestrate = self::getUsedConfig('inquest_config', $entity->fields['entities_id'], 'inquest_rate'); echo "<tr class='tab_bg_1'><td colspan='4' class='green center'>"; if ($inquestrate == 0) { _e('Disabled'); } else { echo $typeinquest[$inquestconfig] . '<br>'; $inqconf = self::getUsedConfig('inquest_config', $entity->fields['entities_id'], 'inquest_delay'); printf(_n('%d day', '%d days', $inqconf), $inqconf); echo "<br>"; //TRANS: %d is the percentage. %% to display % printf(__('%d%%'), $inquestrate); if ($inquestconfig == 2) { echo "<br>"; echo self::getUsedConfig('inquest_config', $entity->fields['entities_id'], 'inquest_URL'); } } echo "</td></tr>\n"; } echo "<tr class='tab_bg_1'><td colspan='4'>"; $_POST = array('inquest_config' => $entity->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 class='tab_bg_2'>"; echo "<td class='center' colspan='4'>"; echo "<input type='hidden' name='id' value='" . $entity->fields["id"] . "'>"; echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\"\n class='submit'>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); } else { echo "</table>"; } echo "</div>"; Ajax::updateItemOnSelectEvent("dropdown_inquest_config{$rand}", "inquestconfig", $CFG_GLPI["root_doc"] . "/ajax/ticketsatisfaction.php", $params); }
/** * Print the Tracking right form for the current profile * * @param $openform boolean open the form (true by default) * @param $closeform boolean close the form (true by default) **/ function showFormTracking($openform = true, $closeform = true) { global $CFG_GLPI; if (!self::canView()) { return false; } echo "<div class='spaced'>"; if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { echo "<form method='post' action='" . $this->getFormURL() . "'>"; } echo "<table class='tab_cadre_fixe'>"; // Assistance / Tracking-helpdesk echo "<tr class='tab_bg_1'><th colspan='2'>" . __('Assistance') . "</th></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . _n('Ticket', 'Tickets', Session::getPluralNumber()) . ': ' . __('Default ticket template') . "</td><td width='30%'>"; // Only root entity ones and recursive $options = array('value' => $this->fields["tickettemplates_id"], 'entity' => 0); if (Session::isMultiEntitiesMode()) { $options['condition'] = '`is_recursive`'; } // Only add profile if on root entity if (!isset($_SESSION['glpiactiveentities'][0])) { $options['addicon'] = false; } TicketTemplate::dropdown($options); echo "</td></tr>\n"; echo "</table>"; $matrix_options = array('canedit' => $canedit, 'default_class' => 'tab_bg_2'); $rights = array(array('itemtype' => 'Ticket', 'label' => _n('Ticket', 'Tickets', Session::getPluralNumber()), 'field' => 'ticket'), array('itemtype' => 'TicketCost', 'label' => _n('Ticket cost', 'Ticket costs', Session::getPluralNumber()), 'field' => 'ticketcost'), array('itemtype' => 'TicketRecurrent', 'label' => __('Recurrent tickets'), 'field' => 'ticketrecurrent'), array('itemtype' => 'TicketTemplate', 'label' => _n('Ticket template', 'Ticket templates', Session::getPluralNumber()), 'field' => 'tickettemplate')); $matrix_options['title'] = _n('Ticket', 'Tickets', Session::getPluralNumber()); $this->displayRightsChoiceMatrix($rights, $matrix_options); $rights = array(array('itemtype' => 'TicketFollowup', 'label' => _n('Followup', 'Followups', Session::getPluralNumber()), 'field' => 'followup'), array('itemtype' => 'TicketTask', 'label' => _n('Task', 'Tasks', Session::getPluralNumber()), 'field' => 'task')); $matrix_options['title'] = _n('Followup', 'Followups', Session::getPluralNumber()) . " / " . _n('Task', 'Tasks', Session::getPluralNumber()); $this->displayRightsChoiceMatrix($rights, $matrix_options); $rights = array(array('itemtype' => 'TicketValidation', 'label' => _n('Validation', 'Validations', Session::getPluralNumber()), 'field' => 'ticketvalidation')); $matrix_options['title'] = _n('Validation', 'Validations', Session::getPluralNumber()); $this->displayRightsChoiceMatrix($rights, $matrix_options); echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_5'><th colspan='2'>" . __('Association') . "</th>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('See hardware of my groups') . "</td><td>"; Html::showCheckbox(array('name' => '_show_group_hardware', 'checked' => $this->fields['show_group_hardware'])); echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Link with items for the creation of tickets') . "</td>"; echo "\n<td>"; self::getLinearRightChoice(self::getHelpdeskHardwareTypes(true), array('field' => 'helpdesk_hardware', 'value' => $this->fields['helpdesk_hardware'])); echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Associable items to a ticket') . "</td>"; echo "<td><input type='hidden' name='_helpdesk_item_types' value='1'>"; self::dropdownHelpdeskItemtypes(array('values' => $this->fields["helpdesk_item_type"])); // Linear_HIT // self::getLinearRightChoice(self::getHelpdeskItemtypes(), // array('field' => 'helpdesk_item_type', // 'value' => $this->fields['helpdesk_item_type'], // 'check_all' => true, // 'zero_on_empty' => false, // 'max_per_line' => 4, // 'check_method' => // function ($element, $field) { // return in_array($element,$field); // })); echo "</td>"; echo "</tr>\n"; echo "</table>"; $rights = array(array('itemtype' => 'Stat', 'label' => __('Statistics'), 'field' => 'statistic'), array('itemtype' => 'Planning', 'label' => __('Planning'), 'field' => 'planning')); $matrix_options['title'] = __('Visibility'); $this->displayRightsChoiceMatrix($rights, $matrix_options); $rights = array(array('itemtype' => 'Problem', 'label' => _n('Problem', 'Problems', Session::getPluralNumber()), 'field' => 'problem')); $matrix_options['title'] = _n('Problem', 'Problems', Session::getPluralNumber()); $this->displayRightsChoiceMatrix($rights, $matrix_options); $rights = array(array('itemtype' => 'Change', 'label' => _n('Change', 'Changes', Session::getPluralNumber()), 'field' => 'change'), array('itemtype' => 'ChangeValidation', 'label' => _n('Validation', 'Validations', Session::getPluralNumber()), 'field' => 'changevalidation')); $matrix_options['title'] = _n('Change', 'Changes', Session::getPluralNumber()); $this->displayRightsChoiceMatrix($rights, $matrix_options); if ($canedit && $closeform) { echo "<div class='center'>"; echo "<input type='hidden' name='id' value='" . $this->fields['id'] . "'>"; echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>"; echo "</div>\n"; Html::closeForm(); } echo "</div>"; }
/** * Print the Tracking right form for the current profile * * @param $openform boolean open the form (true by default) * @param $closeform boolean close the form (true by default) **/ function showFormTracking($openform = true, $closeform = true) { global $CFG_GLPI; if (!Session::haveRight("profile", "r")) { return false; } if (($canedit = Session::haveRight("profile", "w")) && $openform) { echo "<form method='post' action='" . $this->getFormURL() . "'>"; } echo "<div class='spaced'>"; echo "<table class='tab_cadre_fixe'>"; // Assistance / Tracking-helpdesk echo "<tr class='tab_bg_1'><th colspan='6'>" . __('Assistance') . "</th></tr>\n"; echo "<tr class='tab_bg_5'><th colspan='6'>" . __('Creation') . "</th>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Create a ticket') . "</td><td>"; Dropdown::showYesNo("create_ticket", $this->fields["create_ticket"]); echo "</td>"; echo "<td>" . __('Add a followup to tickets (requester)') . "</td><td>"; Dropdown::showYesNo("add_followups", $this->fields["add_followups"]); echo "</td>"; echo "<td>" . __('Add a followup to all tickets') . "</td><td>"; Dropdown::showYesNo("global_add_followups", $this->fields["global_add_followups"]); echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Add a followup to tickets of associated groups') . "</td><td>"; Dropdown::showYesNo("group_add_followups", $this->fields["group_add_followups"]); echo "</td>"; echo "<td>" . __('Add a task to all tickets') . "</td><td>"; Dropdown::showYesNo("global_add_tasks", $this->fields["global_add_tasks"]); echo "</td>"; echo "<td>" . __('Default ticket template') . "</td><td>"; // Only root entity ones and recursive $options = array('value' => $this->fields["tickettemplates_id"], 'entity' => 0); if (Session::isMultiEntitiesMode()) { $options['condition'] = '`is_recursive` = 1'; } TicketTemplate::dropdown($options); echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . _n('Ticket cost', 'Ticket costs', 2) . "</td><td>"; self::dropdownRight("ticketcost", array('value' => $this->fields["ticketcost"])); echo "</td>"; echo "<td>" . _n('Ticket template', 'Ticket templates', 2) . "</td><td>"; self::dropdownRight("tickettemplate", array('value' => $this->fields["tickettemplate"])); echo "</td>"; echo "<td>" . __('Recurrent tickets') . "</td><td>"; self::dropdownRight("ticketrecurrent", array('value' => $this->fields["ticketrecurrent"])); echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_5'><th colspan='6'>" . _x('noun', 'Update') . "</th>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Update a ticket') . "</td><td>"; Dropdown::showYesNo("update_ticket", $this->fields["update_ticket"]); echo "</td>"; echo "<td>" . __('Change the priority') . "</td><td>"; Dropdown::showYesNo("update_priority", $this->fields["update_priority"]); echo "</td>"; echo "<td>" . __('Edit all tasks') . "</td><td>"; Dropdown::showYesNo("update_tasks", $this->fields["update_tasks"]); echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Update followups (author)') . "</td><td>"; Dropdown::showYesNo("update_own_followups", $this->fields["update_own_followups"]); echo "</td>"; echo "<td>" . __('Update all followups') . "</td><td>"; Dropdown::showYesNo("update_followups", $this->fields["update_followups"]); echo "</td>\n"; echo "<td colspan='2'></td></tr>\n"; echo "<tr class='tab_bg_5'><th colspan='6'>" . __('Deletion') . "</th>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __("Ticket's deletion") . "</td><td>"; Dropdown::showYesNo("delete_ticket", $this->fields["delete_ticket"]); echo "</td>"; echo "<td>" . __('Delete all followups') . "</td><td>"; Dropdown::showYesNo("delete_followups", $this->fields["delete_followups"]); echo "</td>\n"; echo "<td>" . __('Delete all validations') . "</td><td>"; Dropdown::showYesNo("delete_validations", $this->fields["delete_validations"]); echo "</td></tr>\n"; echo "<tr class='tab_bg_5'><th colspan='6'>" . __('Approval') . "</th><"; echo "/tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Create a validation request for a request') . "</td><td>"; Dropdown::showYesNo("create_request_validation", $this->fields["create_request_validation"]); echo "<td>" . __('Create a validation request for an incident') . "</td><td>"; Dropdown::showYesNo("create_incident_validation", $this->fields["create_incident_validation"]); echo "</td>"; echo "<td colspan='2'></td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Validate a request') . "</td><td>"; Dropdown::showYesNo("validate_request", $this->fields["validate_request"]); echo "<td>" . __('Validate an incident') . "</td><td>"; Dropdown::showYesNo("validate_incident", $this->fields["validate_incident"]); echo "<td colspan='2'></td></tr>\n"; echo "<tr class='tab_bg_5'><th colspan='6'>" . __('Assignment') . "</th>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('To be in charge of a ticket') . "</td><td>"; Dropdown::showYesNo("own_ticket", $this->fields["own_ticket"]); echo "<td>" . __('Steal a ticket') . "</td><td>"; Dropdown::showYesNo("steal_ticket", $this->fields["steal_ticket"]); echo "</td>"; echo "<td>" . __('Assign a ticket') . "</td><td>"; Dropdown::showYesNo("assign_ticket", $this->fields["assign_ticket"]); echo "</td></tr>\n"; echo "<tr class='tab_bg_5'><th colspan='6'>" . __('Association') . "</th>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('See hardware of my groups') . "</td><td>"; Dropdown::showYesNo("show_group_hardware", $this->fields["show_group_hardware"]); echo "</td>"; echo "<td>" . __('Link with items for the creation of tickets') . "</td>"; echo "\n<td>"; Dropdown::showFromArray('helpdesk_hardware', self::getHelpdeskHardwareTypes(), array('value' => $this->fields["helpdesk_hardware"])); echo "</td>\n"; echo "<td>" . __('Associable items to a ticket') . "</td>"; echo "<td><input type='hidden' name='_helpdesk_item_types' value='1'>"; self::dropdownHelpdeskItemtypes(array('values' => $this->fields["helpdesk_item_type"])); echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_5'><th colspan='6'>" . __('Visibility') . "</th>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('See assigned tickets (personnal + group associated)') . "</td><td>"; Dropdown::showYesNo("show_assign_ticket", $this->fields["show_assign_ticket"]); echo "</td>"; echo "<td>" . __('See tickets created by my groups') . "</td><td>"; Dropdown::showYesNo("show_group_ticket", $this->fields["show_group_ticket"]); echo "</td>"; echo "<td>" . __('See all tickets') . "</td><td>"; Dropdown::showYesNo("show_all_ticket", $this->fields["show_all_ticket"]); echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('See public followups and tasks') . "</td><td>"; Dropdown::showYesNo("observe_ticket", $this->fields["observe_ticket"]); echo "</td>"; echo "<td>" . __('See all followups and tasks (public and private)') . "</td><td>"; Dropdown::showYesNo("show_full_ticket", $this->fields["show_full_ticket"]); echo "</td>"; echo "<td>" . __('Statistics') . "</td><td>"; Dropdown::showYesNo("statistic", $this->fields["statistic"]); echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('See personnal planning') . "</td><td>"; Dropdown::showYesNo("show_planning", $this->fields["show_planning"]); echo "</td>"; echo "<td>" . __('See schedule of people in my groups') . "</td><td>"; Dropdown::showYesNo("show_group_planning", $this->fields["show_group_planning"]); echo "</td>"; echo "<td>" . __('See all plannings') . "</td><td>"; Dropdown::showYesNo("show_all_planning", $this->fields["show_all_planning"]); echo "</td></tr>\n"; echo "<tr class='tab_bg_5'><th colspan='6'>" . _n('Problem', 'Problems', 2); echo "</th></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('See all problems') . "</td><td>"; Dropdown::showYesNo("show_all_problem", $this->fields["show_all_problem"]); echo "</td>"; echo "<td>" . __('See problems (author)') . "</td><td>"; Dropdown::showYesNo("show_my_problem", $this->fields["show_my_problem"]); echo "</td>"; echo "<td>" . __('Update all problems') . "</td><td>"; Dropdown::showYesNo("edit_all_problem", $this->fields["edit_all_problem"]); echo "</td>"; echo "</tr>\n"; // echo "<tr class='tab_bg_2'>"; // echo "<td>".__('Update all changes')."</td><td>"; // Dropdown::showYesNo("edit_all_change", $this->fields["edit_all_change"]); // echo "</td>"; // echo "<td>".__('See all changes')."</td><td>"; // Dropdown::showYesNo("show_all_change", $this->fields["show_all_change"]); // echo "</td>"; // echo "<td>".__('See changes (author)')."</td><td>"; // Dropdown::showYesNo("show_my_change", $this->fields["show_my_change"]); // echo "</td>"; // echo "</tr>\n"; if ($canedit && $closeform) { echo "<tr class='tab_bg_1'>"; echo "<td colspan='6' class='center'>"; echo "<input type='hidden' name='id' value='" . $this->fields['id'] . "'>"; echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>"; echo "</td></tr>\n"; echo "</table>\n"; Html::closeForm(); } else { echo "</table>\n"; } echo "</div>"; }