function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if (!$withtemplate) { switch ($item->getType()) { case 'Problem': $nb = 0; if ($_SESSION['glpishow_count_on_tabs']) { $nb = countElementsInTable('glpi_items_problems', "`problems_id` = '" . $item->getID() . "'"); } return self::createTabEntry(_n('Item', 'Items', Session::getPluralNumber()), $nb); case 'User': $nb = 0; if ($_SESSION['glpishow_count_on_tabs']) { $nb = countDistinctElementsInTable('glpi_problems_users', 'problems_id', "`users_id` = '" . $item->getID() . "'"); } return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb); case 'Group': $nb = 0; if ($_SESSION['glpishow_count_on_tabs']) { $nb = countDistinctElementsInTable('glpi_groups_problems', 'problems_id', "`groups_id` = '" . $item->getID() . "'"); } return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb); case 'Supplier': $nb = 0; if ($_SESSION['glpishow_count_on_tabs']) { $nb = countDistinctElementsInTable('glpi_problems_suppliers', 'problems_id', "`suppliers_id` = '" . $item->getID() . "'"); } return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb); default: if (Session::haveRight("problem", Problem::READALL)) { $nb = 0; if ($_SESSION['glpishow_count_on_tabs']) { // Direct one $nb = countElementsInTable('glpi_items_problems', " `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'"); // Linked items $linkeditems = $item->getLinkedItems(); if (count($linkeditems)) { foreach ($linkeditems as $type => $tab) { foreach ($tab as $ID) { $nb += countElementsInTable('glpi_items_problems', " `itemtype` = '{$type}'\n AND `items_id` = '{$ID}'"); } } } } return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb); } } } return ''; }
$problem_user = new Problem_User(); $problem_user->check($_POST['id'], 'd'); $problem_user->delete($_POST); Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"])); Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']); } else { if (isset($_POST['delete_group'])) { $group_problem = new Group_Problem(); $group_problem->check($_POST['id'], 'd'); $group_problem->delete($_POST); Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"])); Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']); } else { if (isset($_POST['delete_supplier'])) { $problem_supplier = new Problem_Supplier(); $problem_supplier->check($_POST['id'], 'd'); $problem_supplier->delete($_POST); Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"])); Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']); } else { Html::header(Problem::getTypeName(2), $_SERVER['PHP_SELF'], "maintain", "problem"); $problem->showForm($_GET["id"], $_GET); Html::footer(); } } } } } } } }
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if (!$withtemplate) { switch ($item->getType()) { case 'Problem': return _n('Item', 'Items', 2); default: if (Session::haveRight("show_all_problem", "1")) { $nb = 0; if ($_SESSION['glpishow_count_on_tabs']) { // Direct one $nb = countElementsInTable('glpi_items_problems', " `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'"); // Linked items $linkeditems = $item->getLinkedItems(); if (count($linkeditems)) { foreach ($linkeditems as $type => $tab) { foreach ($tab as $ID) { $nb += countElementsInTable('glpi_items_problems', " `itemtype` = '{$type}'\n AND `items_id` = '{$ID}'"); } } } } return self::createTabEntry(Problem::getTypeName(2), $nb); } } } return ''; }
function getSearchOptions() { $tab = array(); $tab['common'] = __('Characteristics'); $tab[1]['table'] = $this->getTable(); $tab[1]['field'] = 'name'; $tab[1]['name'] = __('Title'); $tab[1]['searchtype'] = 'contains'; $tab[1]['datatype'] = 'itemlink'; $tab[1]['massiveaction'] = false; $tab[21]['table'] = $this->getTable(); $tab[21]['field'] = 'content'; $tab[21]['name'] = __('Description'); $tab[21]['massiveaction'] = false; $tab[21]['datatype'] = 'text'; $tab[2]['table'] = $this->getTable(); $tab[2]['field'] = 'id'; $tab[2]['name'] = __('ID'); $tab[2]['massiveaction'] = false; $tab[2]['datatype'] = 'number'; $tab[12]['table'] = $this->getTable(); $tab[12]['field'] = 'status'; $tab[12]['name'] = __('Status'); $tab[12]['searchtype'] = 'equals'; $tab[12]['datatype'] = 'specific'; $tab[14]['table'] = $this->getTable(); $tab[14]['field'] = 'type'; $tab[14]['name'] = __('Type'); $tab[14]['searchtype'] = 'equals'; $tab[14]['datatype'] = 'specific'; $tab[10]['table'] = $this->getTable(); $tab[10]['field'] = 'urgency'; $tab[10]['name'] = __('Urgency'); $tab[10]['searchtype'] = 'equals'; $tab[10]['datatype'] = 'specific'; $tab[11]['table'] = $this->getTable(); $tab[11]['field'] = 'impact'; $tab[11]['name'] = __('Impact'); $tab[11]['searchtype'] = 'equals'; $tab[11]['datatype'] = 'specific'; $tab[3]['table'] = $this->getTable(); $tab[3]['field'] = 'priority'; $tab[3]['name'] = __('Priority'); $tab[3]['searchtype'] = 'equals'; $tab[3]['datatype'] = 'specific'; $tab[15]['table'] = $this->getTable(); $tab[15]['field'] = 'date'; $tab[15]['name'] = __('Opening date'); $tab[15]['datatype'] = 'datetime'; $tab[15]['massiveaction'] = false; $tab[16]['table'] = $this->getTable(); $tab[16]['field'] = 'closedate'; $tab[16]['name'] = __('Closing date'); $tab[16]['datatype'] = 'datetime'; $tab[16]['massiveaction'] = false; $tab[18]['table'] = $this->getTable(); $tab[18]['field'] = 'due_date'; $tab[18]['name'] = __('Due date'); $tab[18]['datatype'] = 'datetime'; $tab[18]['maybefuture'] = true; $tab[18]['massiveaction'] = false; $tab[151]['table'] = $this->getTable(); $tab[151]['field'] = 'due_date'; $tab[151]['name'] = __('Due date + Progress'); $tab[151]['massiveaction'] = false; $tab[151]['nosearch'] = true; $tab[82]['table'] = $this->getTable(); $tab[82]['field'] = 'is_late'; $tab[82]['name'] = __('Late'); $tab[82]['datatype'] = 'bool'; $tab[82]['massiveaction'] = false; $tab[17]['table'] = $this->getTable(); $tab[17]['field'] = 'solvedate'; $tab[17]['name'] = __('Resolution date'); $tab[17]['datatype'] = 'datetime'; $tab[17]['massiveaction'] = false; $tab[19]['table'] = $this->getTable(); $tab[19]['field'] = 'date_mod'; $tab[19]['name'] = __('Last update'); $tab[19]['datatype'] = 'datetime'; $tab[19]['massiveaction'] = false; $tab[7]['table'] = 'glpi_itilcategories'; $tab[7]['field'] = 'completename'; $tab[7]['name'] = __('Category'); $tab[7]['datatype'] = 'dropdown'; if (!Session::isCron() && isset($_SESSION['glpiactiveprofile']['interface']) && $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') { $tab[7]['condition'] = "`is_helpdeskvisible`='1'"; } $tab[13]['table'] = $this->getTable(); $tab[13]['field'] = 'items_id'; $tab[13]['name'] = __('Associated element'); $tab[13]['datatype'] = 'specific'; $tab[13]['nosearch'] = true; $tab[13]['nosort'] = true; $tab[13]['massiveaction'] = false; $tab[13]['additionalfields'] = array('itemtype'); $tab[131]['table'] = $this->getTable(); $tab[131]['field'] = 'itemtype'; $tab[131]['name'] = __('Associated item type'); $tab[131]['datatype'] = 'itemtypename'; $tab[131]['itemtype_list'] = 'ticket_types'; $tab[131]['nosort'] = true; $tab[131]['massiveaction'] = false; $tab[9]['table'] = 'glpi_requesttypes'; $tab[9]['field'] = 'name'; $tab[9]['name'] = __('Request source'); $tab[9]['datatype'] = 'dropdown'; // Can't use Location::getSearchOptionsToAdd because id conflicts $tab[83]['table'] = 'glpi_locations'; $tab[83]['field'] = 'completename'; $tab[83]['name'] = __('Location'); $tab[83]['datatype'] = 'dropdown'; $tab[80]['table'] = 'glpi_entities'; $tab[80]['field'] = 'completename'; $tab[80]['name'] = __('Entity'); $tab[80]['massiveaction'] = false; $tab[80]['datatype'] = 'dropdown'; $tab[45]['table'] = $this->getTable(); $tab[45]['field'] = 'actiontime'; $tab[45]['name'] = __('Total duration'); $tab[45]['datatype'] = 'timestamp'; $tab[45]['withdays'] = false; $tab[45]['massiveaction'] = false; $tab[45]['nosearch'] = true; $tab[64]['table'] = 'glpi_users'; $tab[64]['field'] = 'name'; $tab[64]['linkfield'] = 'users_id_lastupdater'; $tab[64]['name'] = __('Last updater'); $tab[64]['massiveaction'] = false; $tab[64]['datatype'] = 'dropdown'; $tab[64]['right'] = 'all'; $tab += $this->getSearchOptionsActors(); $tab['sla'] = __('SLA'); $tab[30]['table'] = 'glpi_slas'; $tab[30]['field'] = 'name'; $tab[30]['name'] = __('SLA'); $tab[30]['massiveaction'] = false; $tab[30]['datatype'] = 'dropdown'; $tab[32]['table'] = 'glpi_slalevels'; $tab[32]['field'] = 'name'; $tab[32]['name'] = __('Escalation level'); $tab[32]['massiveaction'] = false; $tab[32]['datatype'] = 'dropdown'; $tab['validation'] = __('Approval'); $tab[52]['table'] = $this->getTable(); $tab[52]['field'] = 'global_validation'; $tab[52]['name'] = __('Approval'); $tab[52]['searchtype'] = 'equals'; $tab[52]['datatype'] = 'specific'; $tab[53]['table'] = 'glpi_ticketvalidations'; $tab[53]['field'] = 'comment_submission'; $tab[53]['name'] = sprintf(__('%1$s: %2$s'), __('Request'), __('Comments')); $tab[53]['datatype'] = 'text'; $tab[53]['forcegroupby'] = true; $tab[53]['massiveaction'] = false; $tab[53]['joinparams'] = array('jointype' => 'child'); $tab[54]['table'] = 'glpi_ticketvalidations'; $tab[54]['field'] = 'comment_validation'; $tab[54]['name'] = sprintf(__('%1$s: %2$s'), __('Approval'), __('Comments')); $tab[54]['datatype'] = 'text'; $tab[54]['forcegroupby'] = true; $tab[54]['massiveaction'] = false; $tab[54]['joinparams'] = array('jointype' => 'child'); $tab[55]['table'] = 'glpi_ticketvalidations'; $tab[55]['field'] = 'status'; $tab[55]['datatype'] = 'specific'; $tab[55]['name'] = sprintf(__('%1$s: %2$s'), __('Approval'), __('Status')); $tab[55]['searchtype'] = 'equals'; $tab[55]['forcegroupby'] = true; $tab[55]['massiveaction'] = false; $tab[55]['joinparams'] = array('jointype' => 'child'); $tab[56]['table'] = 'glpi_ticketvalidations'; $tab[56]['field'] = 'submission_date'; $tab[56]['name'] = sprintf(__('%1$s: %2$s'), __('Request'), __('Date')); $tab[56]['datatype'] = 'datetime'; $tab[56]['forcegroupby'] = true; $tab[56]['massiveaction'] = false; $tab[56]['joinparams'] = array('jointype' => 'child'); $tab[57]['table'] = 'glpi_ticketvalidations'; $tab[57]['field'] = 'validation_date'; $tab[57]['name'] = sprintf(__('%1$s: %2$s'), __('Approval'), __('Date')); $tab[57]['datatype'] = 'datetime'; $tab[57]['forcegroupby'] = true; $tab[57]['massiveaction'] = false; $tab[57]['joinparams'] = array('jointype' => 'child'); $tab[58]['table'] = 'glpi_users'; $tab[58]['field'] = 'name'; $tab[58]['name'] = __('Requester'); $tab[58]['datatype'] = 'itemlink'; $tab[58]['right'] = array('create_incident_validation', 'create_request_validation'); $tab[58]['forcegroupby'] = true; $tab[58]['massiveaction'] = false; $tab[58]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketvalidations', 'joinparams' => array('jointype' => 'child'))); $tab[59]['table'] = 'glpi_users'; $tab[59]['field'] = 'name'; $tab[59]['linkfield'] = 'users_id_validate'; $tab[59]['name'] = __('Approver'); $tab[59]['datatype'] = 'itemlink'; $tab[59]['right'] = array('validate_request', 'validate_incident'); $tab[59]['forcegroupby'] = true; $tab[59]['massiveaction'] = false; $tab[59]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketvalidations', 'joinparams' => array('jointype' => 'child'))); $tab['satisfaction'] = __('Satisfaction survey'); $tab[31]['table'] = 'glpi_ticketsatisfactions'; $tab[31]['field'] = 'type'; $tab[31]['name'] = __('Type'); $tab[31]['massiveaction'] = false; $tab[31]['searchtype'] = 'equals'; $tab[31]['joinparams'] = array('jointype' => 'child'); $tab[31]['datatype'] = 'specific'; $tab[60]['table'] = 'glpi_ticketsatisfactions'; $tab[60]['field'] = 'date_begin'; $tab[60]['name'] = __('Creation date'); $tab[60]['datatype'] = 'datetime'; $tab[60]['massiveaction'] = false; $tab[60]['joinparams'] = array('jointype' => 'child'); $tab[61]['table'] = 'glpi_ticketsatisfactions'; $tab[61]['field'] = 'date_answered'; $tab[61]['name'] = __('Response date'); $tab[61]['datatype'] = 'datetime'; $tab[61]['massiveaction'] = false; $tab[61]['joinparams'] = array('jointype' => 'child'); $tab[62]['table'] = 'glpi_ticketsatisfactions'; $tab[62]['field'] = 'satisfaction'; $tab[62]['name'] = __('Satisfaction'); $tab[62]['datatype'] = 'number'; $tab[62]['massiveaction'] = false; $tab[62]['joinparams'] = array('jointype' => 'child'); $tab[63]['table'] = 'glpi_ticketsatisfactions'; $tab[63]['field'] = 'comment'; $tab[63]['name'] = __('Comments'); $tab[63]['datatype'] = 'text'; $tab[63]['massiveaction'] = false; $tab[63]['joinparams'] = array('jointype' => 'child'); $tab['followup'] = _n('Followup', 'Followups', 2); $followup_condition = ''; if (!Session::haveRight('show_full_ticket', 1)) { $followup_condition = "AND (`NEWTABLE`.`is_private` = '0'\n OR `NEWTABLE`.`users_id` = '" . Session::getLoginUserID() . "')"; } $tab[25]['table'] = 'glpi_ticketfollowups'; $tab[25]['field'] = 'content'; $tab[25]['name'] = __('Description'); $tab[25]['forcegroupby'] = true; $tab[25]['splititems'] = true; $tab[25]['massiveaction'] = false; $tab[25]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition); $tab[25]['datatype'] = 'text'; $tab[27]['table'] = 'glpi_ticketfollowups'; $tab[27]['field'] = 'count'; $tab[27]['name'] = __('Number of followups'); $tab[27]['forcegroupby'] = true; $tab[27]['usehaving'] = true; $tab[27]['datatype'] = 'number'; $tab[27]['massiveaction'] = false; $tab[27]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition); $tab[29]['table'] = 'glpi_requesttypes'; $tab[29]['field'] = 'name'; $tab[29]['name'] = __('Request source'); $tab[29]['datatype'] = 'dropdown'; $tab[29]['forcegroupby'] = true; $tab[29]['massiveaction'] = false; $tab[29]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition))); $tab[91]['table'] = 'glpi_ticketfollowups'; $tab[91]['field'] = 'is_private'; $tab[91]['name'] = __('Private followup'); $tab[91]['datatype'] = 'bool'; $tab[91]['forcegroupby'] = true; $tab[91]['splititems'] = true; $tab[91]['massiveaction'] = false; $tab[91]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition); $tab[93]['table'] = 'glpi_users'; $tab[93]['field'] = 'name'; $tab[93]['name'] = __('Writer'); $tab[93]['datatype'] = 'itemlink'; $tab[93]['right'] = 'all'; $tab[93]['forcegroupby'] = true; $tab[93]['massiveaction'] = false; $tab[93]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition))); $tab += $this->getSearchOptionsStats(); $tab[150]['table'] = $this->getTable(); $tab[150]['field'] = 'takeintoaccount_delay_stat'; $tab[150]['name'] = __('Take into account time'); $tab[150]['datatype'] = 'timestamp'; $tab[150]['forcegroupby'] = true; $tab[150]['massiveaction'] = false; if (Session::haveRight("show_all_ticket", "1") || Session::haveRight("show_assign_ticket", "1") || Session::haveRight("own_ticket", "1")) { $tab['linktickets'] = _n('Linked ticket', 'Linked tickets', 2); $tab[40]['table'] = 'glpi_tickets'; $tab[40]['field'] = 'name'; $tab[40]['name'] = __('All linked tickets'); $tab[40]['massiveaction'] = false; $tab[40]['joinparams'] = array('jointype' => 'item_item_revert', 'condition' => "AND NEWTABLE.`id` <> `glpi_tickets`.`id`", 'beforejoin' => array('table' => 'glpi_tickets_tickets', 'joinparams' => array('jointype' => 'item_item'))); $tab[40]['datatype'] = 'dropdown'; $tab[40]['forcegroupby'] = true; $tab[47]['table'] = 'glpi_tickets'; $tab[47]['field'] = 'name'; $tab[47]['name'] = __('Duplicated tickets'); $tab[47]['massiveaction'] = false; $tab[47]['joinparams'] = array('jointype' => 'item_item_revert', 'condition' => "AND NEWTABLE.`id` <> `glpi_tickets`.`id`", 'beforejoin' => array('table' => 'glpi_tickets_tickets', 'joinparams' => array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH))); $tab[47]['datatype'] = 'dropdown'; $tab[47]['forcegroupby'] = true; $tab[41]['table'] = 'glpi_tickets_tickets'; $tab[41]['field'] = 'count'; $tab[41]['name'] = __('Number of all linked tickets'); $tab[41]['massiveaction'] = false; $tab[41]['datatype'] = 'number'; $tab[41]['usehaving'] = true; $tab[41]['joinparams'] = array('jointype' => 'item_item'); $tab[46]['table'] = 'glpi_tickets_tickets'; $tab[46]['field'] = 'count'; $tab[46]['name'] = __('Number of duplicated tickets'); $tab[46]['massiveaction'] = false; $tab[46]['datatype'] = 'number'; $tab[46]['usehaving'] = true; $tab[46]['joinparams'] = array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH); $tab['task'] = _n('Task', 'Tasks', 2); $tab[26]['table'] = 'glpi_tickettasks'; $tab[26]['field'] = 'content'; $tab[26]['name'] = __('Description'); $tab[26]['datatype'] = 'text'; $tab[26]['forcegroupby'] = true; $tab[26]['splititems'] = true; $tab[26]['massiveaction'] = false; $tab[26]['joinparams'] = array('jointype' => 'child'); $tab[28]['table'] = 'glpi_tickettasks'; $tab[28]['field'] = 'count'; $tab[28]['name'] = __('Number of tasks'); $tab[28]['forcegroupby'] = true; $tab[28]['usehaving'] = true; $tab[28]['datatype'] = 'number'; $tab[28]['massiveaction'] = false; $tab[28]['joinparams'] = array('jointype' => 'child'); $tab[20]['table'] = 'glpi_taskcategories'; $tab[20]['field'] = 'name'; $tab[20]['datatype'] = 'dropdown'; $tab[20]['name'] = __('Task category'); $tab[20]['forcegroupby'] = true; $tab[20]['splititems'] = true; $tab[20]['massiveaction'] = false; $tab[20]['joinparams'] = array('beforejoin' => array('table' => 'glpi_tickettasks', 'joinparams' => array('jointype' => 'child'))); $tab[92]['table'] = 'glpi_tickettasks'; $tab[92]['field'] = 'is_private'; $tab[92]['name'] = __('Private task'); $tab[92]['datatype'] = 'bool'; $tab[92]['forcegroupby'] = true; $tab[92]['splititems'] = true; $tab[92]['massiveaction'] = false; $tab[92]['joinparams'] = array('jointype' => 'child'); $tab[94]['table'] = 'glpi_users'; $tab[94]['field'] = 'name'; $tab[94]['name'] = __('Writer'); $tab[94]['datatype'] = 'itemlink'; $tab[94]['right'] = 'all'; $tab[94]['forcegroupby'] = true; $tab[94]['massiveaction'] = false; $tab[94]['joinparams'] = array('beforejoin' => array('table' => 'glpi_tickettasks', 'joinparams' => array('jointype' => 'child'))); $tab[95]['table'] = 'glpi_users'; $tab[95]['field'] = 'name'; $tab[95]['linkfield'] = 'users_id_tech'; $tab[95]['name'] = __('Technician'); $tab[95]['datatype'] = 'itemlink'; $tab[95]['right'] = 'own_ticket'; $tab[95]['forcegroupby'] = true; $tab[95]['massiveaction'] = false; $tab[95]['joinparams'] = array('beforejoin' => array('table' => 'glpi_tickettasks', 'joinparams' => array('jointype' => 'child'))); $tab[96]['table'] = 'glpi_tickettasks'; $tab[96]['field'] = 'actiontime'; $tab[96]['name'] = __('Duration'); $tab[96]['datatype'] = 'timestamp'; $tab[96]['massiveaction'] = false; $tab[96]['joinparams'] = array('jointype' => 'child'); $tab[97]['table'] = 'glpi_tickettasks'; $tab[97]['field'] = 'date'; $tab[97]['name'] = __('Date'); $tab[97]['datatype'] = 'datetime'; $tab[97]['massiveaction'] = false; $tab[97]['joinparams'] = array('jointype' => 'child'); $tab['solution'] = _n('Solution', 'Solutions', 1); $tab[23]['table'] = 'glpi_solutiontypes'; $tab[23]['field'] = 'name'; $tab[23]['name'] = __('Solution type'); $tab[23]['datatype'] = 'dropdown'; $tab[24]['table'] = $this->getTable(); $tab[24]['field'] = 'solution'; $tab[24]['name'] = _n('Solution', 'Solutions', 1); $tab[24]['datatype'] = 'text'; $tab[24]['htmltext'] = true; $tab[24]['massiveaction'] = false; $tab['cost'] = __('Cost'); $tab[48]['table'] = 'glpi_ticketcosts'; $tab[48]['field'] = 'totalcost'; $tab[48]['name'] = __('Total cost'); $tab[48]['datatype'] = 'decimal'; $tab[48]['forcegroupby'] = true; $tab[48]['usehaving'] = true; $tab[48]['massiveaction'] = false; $tab[48]['joinparams'] = array('jointype' => 'child'); $tab[42]['table'] = 'glpi_ticketcosts'; $tab[42]['field'] = 'cost_time'; $tab[42]['name'] = __('Time cost'); $tab[42]['datatype'] = 'decimal'; $tab[42]['forcegroupby'] = true; $tab[42]['massiveaction'] = false; $tab[42]['joinparams'] = array('jointype' => 'child'); $tab[49]['table'] = 'glpi_ticketcosts'; $tab[49]['field'] = 'actiontime'; $tab[49]['name'] = sprintf(__('%1$s - %2$s'), __('Cost'), __('Duration')); $tab[49]['datatype'] = 'timestamp'; $tab[49]['forcegroupby'] = true; $tab[49]['massiveaction'] = false; $tab[49]['joinparams'] = array('jointype' => 'child'); $tab[43]['table'] = 'glpi_ticketcosts'; $tab[43]['field'] = 'cost_fixed'; $tab[43]['name'] = __('Fixed cost'); $tab[43]['datatype'] = 'decimal'; $tab[43]['forcegroupby'] = true; $tab[43]['massiveaction'] = false; $tab[43]['joinparams'] = array('jointype' => 'child'); $tab[44]['table'] = 'glpi_ticketcosts'; $tab[44]['field'] = 'cost_material'; $tab[44]['name'] = __('Material cost'); $tab[44]['datatype'] = 'decimal'; $tab[44]['forcegroupby'] = true; $tab[44]['massiveaction'] = false; $tab[44]['joinparams'] = array('jointype' => 'child'); $tab['problem'] = Problem::getTypeName(2); $tab[141]['table'] = 'glpi_problems_tickets'; $tab[141]['field'] = 'count'; $tab[141]['name'] = __('Number of problems'); $tab[141]['forcegroupby'] = true; $tab[141]['usehaving'] = true; $tab[141]['datatype'] = 'number'; $tab[141]['massiveaction'] = false; $tab[141]['joinparams'] = array('jointype' => 'child'); } // Filter search fields for helpdesk if (!Session::isCron() && (!isset($_SESSION['glpiactiveprofile']['interface']) || $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk')) { $tokeep = array('common', 'requester'); if (Session::haveRight('validate_request', 1) || Session::haveRight('validate_incident', 1) || Session::haveRight('create_incident_validation', 1) || Session::haveRight('create_request_validation', 1)) { $tokeep[] = 'validation'; } $keep = false; foreach ($tab as $key => $val) { if (!is_array($val)) { $keep = in_array($key, $tokeep); } if (!$keep) { if (is_array($val)) { $tab[$key]['nosearch'] = true; } } } // last updater no search $tab[64]['nosearch'] = true; } return $tab; }
function getSearchOptions() { $tab = array(); $tab += $this->getSearchOptionsMain(); $tab[155]['table'] = $this->getTable(); $tab[155]['field'] = 'time_to_own'; $tab[155]['name'] = __('Time to own'); $tab[155]['datatype'] = 'datetime'; $tab[155]['maybefuture'] = true; $tab[155]['massiveaction'] = false; $tab[155]['additionalfields'] = array('status'); $tab[158]['table'] = $this->getTable(); $tab[158]['field'] = 'time_to_own'; $tab[158]['name'] = __('Time to own + Progress'); $tab[158]['massiveaction'] = false; $tab[158]['nosearch'] = true; $tab[158]['additionalfields'] = array('status'); $tab[159]['table'] = $this->getTable(); $tab[159]['field'] = 'is_late'; $tab[159]['name'] = __('Time to own exceedeed'); $tab[159]['datatype'] = 'bool'; $tab[159]['massiveaction'] = false; $tab[159]['computation'] = "IF(TABLE.`time_to_own` IS NOT NULL\n AND TABLE.`status` <> " . self::WAITING . "\n AND (TABLE.`takeintoaccount_delay_stat`\n > TIME_TO_SEC(TIMEDIFF(TABLE.`time_to_own`,\n TABLE.`date`))\n OR (TABLE.`takeintoaccount_delay_stat` = 0\n AND TABLE.`time_to_own` < NOW())),\n 1, 0)"; $tab[14]['table'] = $this->getTable(); $tab[14]['field'] = 'type'; $tab[14]['name'] = __('Type'); $tab[14]['searchtype'] = 'equals'; $tab[14]['datatype'] = 'specific'; $tab[13]['table'] = 'glpi_items_tickets'; $tab[13]['field'] = 'items_id'; $tab[13]['name'] = _n('Associated element', 'Associated elements', Session::getPluralNumber()); $tab[13]['datatype'] = 'specific'; $tab[13]['comments'] = true; $tab[13]['nosort'] = true; $tab[13]['nosearch'] = true; $tab[13]['additionalfields'] = array('itemtype'); $tab[13]['joinparams'] = array('jointype' => 'child'); $tab[13]['forcegroupby'] = true; $tab[13]['massiveaction'] = false; $tab[131]['table'] = 'glpi_items_tickets'; $tab[131]['field'] = 'itemtype'; $tab[131]['name'] = _n('Associated item type', 'Associated item types', Session::getPluralNumber()); $tab[131]['datatype'] = 'itemtypename'; $tab[131]['itemtype_list'] = 'ticket_types'; $tab[131]['nosort'] = true; $tab[131]['additionalfields'] = array('itemtype'); $tab[131]['joinparams'] = array('jointype' => 'child'); $tab[131]['forcegroupby'] = true; $tab[131]['massiveaction'] = false; $tab[9]['table'] = 'glpi_requesttypes'; $tab[9]['field'] = 'name'; $tab[9]['name'] = __('Request source'); $tab[9]['datatype'] = 'dropdown'; // Can't use Location::getSearchOptionsToAdd because id conflicts $tab[83]['table'] = 'glpi_locations'; $tab[83]['field'] = 'completename'; $tab[83]['name'] = __('Location'); $tab[83]['datatype'] = 'dropdown'; $tab[80]['table'] = 'glpi_entities'; $tab[80]['field'] = 'completename'; $tab[80]['name'] = __('Entity'); $tab[80]['massiveaction'] = false; $tab[80]['datatype'] = 'dropdown'; // For ticket template $tab[142]['table'] = 'glpi_documents'; $tab[142]['field'] = 'name'; $tab[142]['name'] = _n('Document', 'Documents', Session::getPluralNumber()); $tab[142]['forcegroupby'] = true; $tab[142]['usehaving'] = true; $tab[142]['nosearch'] = true; $tab[142]['nodisplay'] = true; $tab[142]['datatype'] = 'dropdown'; $tab[142]['massiveaction'] = false; $tab[142]['joinparams'] = array('jointype' => 'items_id', 'beforejoin' => array('table' => 'glpi_documents_items', 'joinparams' => array('jointype' => 'itemtype_item'))); $tab += $this->getSearchOptionsActors(); $tab['slt'] = __('SLT'); $tab[37]['table'] = 'glpi_slts'; $tab[37]['field'] = 'name'; $tab[37]['linkfield'] = 'slts_tto_id'; $tab[37]['name'] = __('SLT') . " " . __('Time to own'); $tab[37]['massiveaction'] = false; $tab[37]['datatype'] = 'dropdown'; $tab[37]['joinparams'] = array('condition' => "AND NEWTABLE.`type` = '" . SLT::TTO . "'"); $tab[37]['condition'] = "`glpi_slts`.`type` = '" . SLT::TTO . "'"; $tab[30]['table'] = 'glpi_slts'; $tab[30]['field'] = 'name'; $tab[30]['linkfield'] = 'slts_ttr_id'; $tab[30]['name'] = __('SLT') . " " . __('Time to resolve'); $tab[30]['massiveaction'] = false; $tab[30]['datatype'] = 'dropdown'; $tab[30]['joinparams'] = array('condition' => "AND NEWTABLE.`type` = '" . SLT::TTR . "'"); $tab[30]['condition'] = "`glpi_slts`.`type` = '" . SLT::TTR . "'"; $tab[32]['table'] = 'glpi_slalevels'; $tab[32]['field'] = 'name'; $tab[32]['name'] = __('Escalation level'); $tab[32]['massiveaction'] = false; $tab[32]['datatype'] = 'dropdown'; $tab[32]['joinparams'] = array('beforejoin' => array('table' => 'glpi_slalevels_tickets', 'joinparams' => array('jointype' => 'child'))); $tab[32]['forcegroupby'] = true; $tab += TicketValidation::getSearchOptionsToAdd(); $tab['satisfaction'] = __('Satisfaction survey'); $tab[31]['table'] = 'glpi_ticketsatisfactions'; $tab[31]['field'] = 'type'; $tab[31]['name'] = __('Type'); $tab[31]['massiveaction'] = false; $tab[31]['searchtype'] = array('equals', 'notequals'); $tab[31]['searchequalsonfield'] = true; $tab[31]['joinparams'] = array('jointype' => 'child'); $tab[31]['datatype'] = 'specific'; $tab[60]['table'] = 'glpi_ticketsatisfactions'; $tab[60]['field'] = 'date_begin'; $tab[60]['name'] = __('Creation date'); $tab[60]['datatype'] = 'datetime'; $tab[60]['massiveaction'] = false; $tab[60]['joinparams'] = array('jointype' => 'child'); $tab[61]['table'] = 'glpi_ticketsatisfactions'; $tab[61]['field'] = 'date_answered'; $tab[61]['name'] = __('Response date'); $tab[61]['datatype'] = 'datetime'; $tab[61]['massiveaction'] = false; $tab[61]['joinparams'] = array('jointype' => 'child'); $tab[62]['table'] = 'glpi_ticketsatisfactions'; $tab[62]['field'] = 'satisfaction'; $tab[62]['name'] = __('Satisfaction'); $tab[62]['datatype'] = 'number'; $tab[62]['massiveaction'] = false; $tab[62]['joinparams'] = array('jointype' => 'child'); $tab[63]['table'] = 'glpi_ticketsatisfactions'; $tab[63]['field'] = 'comment'; $tab[63]['name'] = __('Comments'); $tab[63]['datatype'] = 'text'; $tab[63]['massiveaction'] = false; $tab[63]['joinparams'] = array('jointype' => 'child'); $tab['followup'] = _n('Followup', 'Followups', Session::getPluralNumber()); $followup_condition = ''; if (!Session::haveRight('followup', TicketFollowup::SEEPRIVATE)) { $followup_condition = "AND (`NEWTABLE`.`is_private` = '0'\n OR `NEWTABLE`.`users_id` = '" . Session::getLoginUserID() . "')"; } $tab[25]['table'] = 'glpi_ticketfollowups'; $tab[25]['field'] = 'content'; $tab[25]['name'] = __('Description'); $tab[25]['forcegroupby'] = true; $tab[25]['splititems'] = true; $tab[25]['massiveaction'] = false; $tab[25]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition); $tab[25]['datatype'] = 'text'; $tab[36]['table'] = 'glpi_ticketfollowups'; $tab[36]['field'] = 'date'; $tab[36]['name'] = __('Date'); $tab[36]['datatype'] = 'datetime'; $tab[36]['massiveaction'] = false; $tab[36]['forcegroupby'] = true; $tab[36]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition); $tab[27]['table'] = 'glpi_ticketfollowups'; $tab[27]['field'] = 'id'; $tab[27]['name'] = _x('quantity', 'Number of followups'); $tab[27]['forcegroupby'] = true; $tab[27]['usehaving'] = true; $tab[27]['datatype'] = 'count'; $tab[27]['massiveaction'] = false; $tab[27]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition); $tab[29]['table'] = 'glpi_requesttypes'; $tab[29]['field'] = 'name'; $tab[29]['name'] = __('Request source'); $tab[29]['datatype'] = 'dropdown'; $tab[29]['forcegroupby'] = true; $tab[29]['massiveaction'] = false; $tab[29]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition))); $tab[91]['table'] = 'glpi_ticketfollowups'; $tab[91]['field'] = 'is_private'; $tab[91]['name'] = __('Private followup'); $tab[91]['datatype'] = 'bool'; $tab[91]['forcegroupby'] = true; $tab[91]['splititems'] = true; $tab[91]['massiveaction'] = false; $tab[91]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition); $tab[93]['table'] = 'glpi_users'; $tab[93]['field'] = 'name'; $tab[93]['name'] = __('Writer'); $tab[93]['datatype'] = 'itemlink'; $tab[93]['right'] = 'all'; $tab[93]['forcegroupby'] = true; $tab[93]['massiveaction'] = false; $tab[93]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition))); $tab += $this->getSearchOptionsStats(); $tab[150]['table'] = $this->getTable(); $tab[150]['field'] = 'takeintoaccount_delay_stat'; $tab[150]['name'] = __('Take into account time'); $tab[150]['datatype'] = 'timestamp'; $tab[150]['forcegroupby'] = true; $tab[150]['massiveaction'] = false; if (Session::haveRightsOr(self::$rightname, array(self::READALL, self::READASSIGN, self::OWN))) { $tab['linktickets'] = _n('Linked ticket', 'Linked tickets', Session::getPluralNumber()); $tab[40]['table'] = 'glpi_tickets_tickets'; $tab[40]['field'] = 'tickets_id_1'; $tab[40]['name'] = __('All linked tickets'); $tab[40]['massiveaction'] = false; $tab[40]['forcegroupby'] = true; $tab[40]['searchtype'] = 'equals'; $tab[40]['joinparams'] = array('jointype' => 'item_item'); $tab[40]['additionalfields'] = array('tickets_id_2'); $tab[47]['table'] = 'glpi_tickets_tickets'; $tab[47]['field'] = 'tickets_id_1'; $tab[47]['name'] = __('Duplicated tickets'); $tab[47]['massiveaction'] = false; $tab[47]['searchtype'] = 'equals'; $tab[47]['joinparams'] = array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH); $tab[47]['additionalfields'] = array('tickets_id_2'); $tab[47]['forcegroupby'] = true; $tab[41]['table'] = 'glpi_tickets_tickets'; $tab[41]['field'] = 'id'; $tab[41]['name'] = __('Number of all linked tickets'); $tab[41]['massiveaction'] = false; $tab[41]['datatype'] = 'count'; $tab[41]['usehaving'] = true; $tab[41]['joinparams'] = array('jointype' => 'item_item'); $tab[46]['table'] = 'glpi_tickets_tickets'; $tab[46]['field'] = 'id'; $tab[46]['name'] = __('Number of duplicated tickets'); $tab[46]['massiveaction'] = false; $tab[46]['datatype'] = 'count'; $tab[46]['usehaving'] = true; $tab[46]['joinparams'] = array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH); $tab += TicketTask::getSearchOptionsToAdd(); $tab += $this->getSearchOptionsSolution(); if (Session::haveRight('ticketcost', READ)) { $tab += TicketCost::getSearchOptionsToAdd(); } $tab['problem'] = Problem::getTypeName(Session::getPluralNumber()); $tab[141]['table'] = 'glpi_problems_tickets'; $tab[141]['field'] = 'id'; $tab[141]['name'] = _x('quantity', 'Number of problems'); $tab[141]['forcegroupby'] = true; $tab[141]['usehaving'] = true; $tab[141]['datatype'] = 'count'; $tab[141]['massiveaction'] = false; $tab[141]['joinparams'] = array('jointype' => 'child'); } // Filter search fields for helpdesk if (!Session::isCron() && (!isset($_SESSION['glpiactiveprofile']['interface']) || $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk')) { $tokeep = array('common', 'requester', 'satisfaction'); if (Session::haveRightsOr('ticketvalidation', array_merge(TicketValidation::getValidateRights(), TicketValidation::getCreateRights()))) { $tokeep[] = 'validation'; } $keep = false; foreach ($tab as $key => $val) { if (!is_array($val)) { $keep = in_array($key, $tokeep); } if (!$keep) { if (is_array($val)) { $tab[$key]['nosearch'] = true; } } } // last updater no search $tab[64]['nosearch'] = true; } return $tab; }
/** * Show tickets for a problem * * @param $problem Problem object **/ static function showForProblem(Problem $problem) { global $DB, $CFG_GLPI; $ID = $problem->getField('id'); if (!$problem->can($ID, 'r')) { return false; } $canedit = $problem->can($ID, 'w'); $rand = mt_rand(); $showentities = Session::isMultiEntitiesMode(); $query = "SELECT DISTINCT `glpi_changes_problems`.`id` AS linkID,\n `glpi_changes`.*\n FROM `glpi_changes_problems`\n LEFT JOIN `glpi_changes`\n ON (`glpi_changes_problems`.`changes_id` = `glpi_changes`.`id`)\n WHERE `glpi_changes_problems`.`problems_id` = '{$ID}'\n ORDER BY `glpi_changes`.`name`"; $result = $DB->query($query); $changes = array(); $used = array(); if ($numrows = $DB->numrows($result)) { while ($data = $DB->fetch_assoc($result)) { $changes[$data['id']] = $data; $used[$data['id']] = $data['id']; } } if ($canedit) { echo "<div class='firstbloc'>"; echo "<form name='changeproblem_form{$rand}' id='changeproblem_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_2'><th colspan='3'>" . __('Add a change') . "</th></tr>"; echo "<tr class='tab_bg_2'><td>"; echo "<input type='hidden' name='problems_id' value='{$ID}'>"; Change::dropdown(array('used' => $used, 'entity' => $problem->getEntityID(), 'entity_sons' => $problem->isRecursive())); echo "</td><td class='center'>"; echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>"; echo "</td><td>"; echo "<a href='" . Toolbox::getItemTypeFormURL('Change') . "?problems_id={$ID}'>"; _e('Create a change from this problem'); echo "</a>"; echo "</td></tr></table>"; Html::closeForm(); echo "</div>"; } echo "<div class='spaced'>"; if ($canedit && $numrows) { Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); $massiveactionparams = array('num_displayed' => $numrows); Html::showMassiveActions(__CLASS__, $massiveactionparams); } echo "<table class='tab_cadre_fixehov'>"; echo "<tr>"; if ($canedit && $numrows) { echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>"; } echo "<th>" . _n('Change', 'Changes', 2); echo "</th>"; if ($showentities) { echo "<th>" . __('Entity') . "</th>"; } echo "</tr>"; $used = array(); if ($numrows) { Session::initNavigateListItems('Change', sprintf(__('%1$s = %2$s'), Problem::getTypeName(1), $problem->fields["name"])); foreach ($changes as $data) { Session::addToNavigateListItems('Change', $data["id"]); echo "<tr class='tab_bg_1'>"; if ($canedit) { echo "<td width='10'>"; Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]); echo "</td>"; } echo "<td><a href='" . Toolbox::getItemTypeFormURL('Change') . "?id=" . $data['id'] . "'>" . $data["name"] . "</a></td>"; if ($showentities) { echo "<td>" . Dropdown::getDropdownName('glpi_entities', $data["entities_id"]) . "</td>"; } echo "</tr>"; } } echo "</table>"; if ($canedit && $numrows) { $massiveactionparams['ontop'] = false; Html::showMassiveActions(__CLASS__, $massiveactionparams); Html::closeForm(); } echo "</div>"; }
/** * Show problems for a ticket * * @param $ticket Ticket object **/ static function showForTicket(Ticket $ticket) { global $DB, $CFG_GLPI; $ID = $ticket->getField('id'); if (!Session::haveRight("problem", Problem::READALL) || !$ticket->can($ID, READ)) { return false; } $canedit = $ticket->can($ID, UPDATE); $rand = mt_rand(); $query = "SELECT DISTINCT `glpi_problems_tickets`.`id` AS linkID,\n `glpi_problems`.*\n FROM `glpi_problems_tickets`\n LEFT JOIN `glpi_problems`\n ON (`glpi_problems_tickets`.`problems_id` = `glpi_problems`.`id`)\n WHERE `glpi_problems_tickets`.`tickets_id` = '{$ID}'\n ORDER BY `glpi_problems`.`name`"; $result = $DB->query($query); $problems = array(); $used = array(); if ($numrows = $DB->numrows($result)) { while ($data = $DB->fetch_assoc($result)) { $problems[$data['id']] = $data; $used[$data['id']] = $data['id']; } } if ($canedit) { echo "<div class='firstbloc'>"; echo "<form name='problemticket_form{$rand}' id='problemticket_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_2'><th colspan='3'>" . __('Add a problem') . "</th></tr>"; echo "<tr class='tab_bg_2'><td>"; echo "<input type='hidden' name='tickets_id' value='{$ID}'>"; $condition = "`glpi_problems`.`status` NOT IN ('" . implode("', '", array_merge(Problem::getSolvedStatusArray(), Problem::getClosedStatusArray())) . "')"; Problem::dropdown(array('used' => $used, 'entity' => $ticket->getEntityID(), 'condition' => $condition)); echo "</td><td class='center'>"; echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>"; echo "</td><td>"; echo "<a href='" . Toolbox::getItemTypeFormURL('Problem') . "?tickets_id={$ID}'>"; _e('Create a problem from this ticket'); echo "</a>"; echo "</td></tr></table>"; Html::closeForm(); echo "</div>"; } echo "<div class='spaced'>"; if ($canedit && $numrows) { Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); $massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand); Html::showMassiveActions($massiveactionparams); } echo "<table class='tab_cadre_fixehov'>"; echo "<tr class='noHover'><th colspan='12'>" . Problem::getTypeName($numrows) . "</th>"; echo "</tr>"; if ($numrows) { Problem::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand); Session::initNavigateListItems('Problem', sprintf(__('%1$s = %2$s'), Ticket::getTypeName(1), $ticket->fields["name"])); $i = 0; foreach ($problems as $data) { Session::addToNavigateListItems('Problem', $data["id"]); Problem::showShort($data['id'], array('row_num' => $i, 'type_for_massiveaction' => __CLASS__, 'id_for_massiveaction' => $data['linkID'])); $i++; } Problem::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand); } echo "</table>"; if ($canedit && $numrows) { $massiveactionparams['ontop'] = false; Html::showMassiveActions($massiveactionparams); Html::closeForm(); } echo "</div>"; }
Copyright (C) 2003-2013 by the INDEPNET Development Team. http://indepnet.net/ http://glpi-project.org ------------------------------------------------------------------------- LICENSE This file is part of GLPI. GLPI is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. GLPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ /** @file * @brief */ include '../inc/includes.php'; Session::checkSeveralRightsOr(array('show_all_problem' => '1', 'show_my_problem' => '1')); Html::header(Problem::getTypeName(2), '', "maintain", "problem"); Search::show('Problem'); Html::footer();
Event::log($_POST["id"], "problem", 4, "maintain", sprintf(__('%s purges an item'), $_SESSION["glpiname"])); $problem->redirectToList(); } else { if (isset($_POST["update"])) { $problem->check($_POST["id"], UPDATE); $problem->update($_POST); Event::log($_POST["id"], "problem", 4, "maintain", sprintf(__('%s updates an item'), $_SESSION["glpiname"])); // Copy solution to KB redirect to KB if (isset($_POST['_sol_to_kb']) && $_POST['_sol_to_kb']) { Html::redirect($CFG_GLPI["root_doc"] . "/front/knowbaseitem.form.php?id=new&item_itemtype=Problem&item_items_id=" . $_POST["id"]); } else { Html::back(); } } else { if (isset($_POST['addme_assign'])) { $problem_user = new Problem_User(); $problem->check($_POST['problems_id'], READ); $input = array('problems_id' => $_POST['problems_id'], 'users_id' => Session::getLoginUserID(), 'use_notification' => 1, 'type' => CommonITILActor::ASSIGN); $problem_user->add($input); Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s adds an actor'), $_SESSION["glpiname"])); Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']); } else { Html::header(Problem::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "helpdesk", "problem"); $problem->display($_GET); Html::footer(); } } } } } }
based on GLPI - Gestionnaire Libre de Parc Informatique Copyright (C) 2003-2014 by the INDEPNET Development Team. ------------------------------------------------------------------------- LICENSE This file is part of GLPI. GLPI is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. GLPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ /** @file * @brief */ include '../inc/includes.php'; Session::checkRightsOr('problem', array(Problem::READALL, Problem::READMY)); Html::header(Problem::getTypeName(Session::getPluralNumber()), '', "helpdesk", "problem"); Search::show('Problem'); Html::footer();
/** * Show problems for a change * * @param $change Change object **/ static function showForChange(Change $change) { global $DB, $CFG_GLPI; $ID = $change->getField('id'); if (!$change->can($ID, READ)) { return false; } $canedit = $change->canEdit($ID); $rand = mt_rand(); $showentities = Session::isMultiEntitiesMode(); $query = "SELECT DISTINCT `glpi_changes_problems`.`id` AS linkID,\n `glpi_problems`.*\n FROM `glpi_changes_problems`\n LEFT JOIN `glpi_problems`\n ON (`glpi_changes_problems`.`problems_id` = `glpi_problems`.`id`)\n WHERE `glpi_changes_problems`.`changes_id` = '{$ID}'\n ORDER BY `glpi_problems`.`name`"; $result = $DB->query($query); $problems = array(); $used = array(); if ($numrows = $DB->numrows($result)) { while ($data = $DB->fetch_assoc($result)) { $problems[$data['id']] = $data; $used[$data['id']] = $data['id']; } } if ($canedit) { echo "<div class='firstbloc'>"; echo "<form name='changeproblem_form{$rand}' id='changeproblem_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add a problem') . "</th></tr>"; echo "<tr class='tab_bg_2'><td>"; echo "<input type='hidden' name='changes_id' value='{$ID}'>"; Problem::dropdown(array('used' => $used, 'entity' => $change->getEntityID())); echo "</td><td class='center'>"; echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>"; echo "</td></tr></table>"; Html::closeForm(); echo "</div>"; } echo "<div class='spaced'>"; if ($canedit && $numrows) { Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); $massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand); Html::showMassiveActions($massiveactionparams); } echo "<table class='tab_cadre_fixehov table-striped table-hover'>"; echo "<tr class='noHover'><th colspan='12'>" . Problem::getTypeName($numrows) . "</th>"; echo "</tr>"; if ($numrows) { Problem::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand); Session::initNavigateListItems('Problem', sprintf(__('%1$s = %2$s'), Change::getTypeName(1), $change->fields["name"])); $i = 0; foreach ($problems as $data) { Session::addToNavigateListItems('Problem', $data["id"]); Problem::showShort($data['id'], array('row_num' => $i, 'type_for_massiveaction' => __CLASS__, 'id_for_massiveaction' => $data['linkID'])); $i++; } Problem::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand); } echo "</table>"; if ($canedit && $numrows) { $massiveactionparams['ontop'] = false; Html::showMassiveActions($massiveactionparams); Html::closeForm(); } echo "</div>"; }
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if (!$withtemplate) { switch ($item->getType()) { case 'Problem': return _n('Item', 'Items', 2); default: if (Session::haveRight("show_all_problem", "1")) { $nb = 0; if ($_SESSION['glpishow_count_on_tabs']) { // Direct one $nb = countElementsInTable('glpi_items_problems', " `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'"); // Linked items if ($subquery = $item->getSelectLinkedItem()) { $nb += countElementsInTable('glpi_items_problems', " (`itemtype`,`items_id`) IN (" . $subquery . ")"); } } return self::createTabEntry(Problem::getTypeName(2), $nb); } } } return ''; }