diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 2aa2fc85966..0a4a622f4a8 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -561,28 +561,27 @@ class FormTicket /** * Return html list of ticket anaytic codes * - * @param string $selected Id categorie pre-selectionnée - * @param string $htmlname Nom de la zone select - * @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users. - * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code - * @param int $empty 1=peut etre vide, 0 sinon - * @param int $noadmininfo 0=Add admin info, 1=Disable admin info - * @param int $maxlength Max length of label - * @param string $morecss More CSS - * @param int $use_multilevel if > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes. + * @param string $selected Id categorie pre-selectionnée + * @param string $htmlname Name of select component + * @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users. + * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code + * @param int $empty 1=peut etre vide, 0 sinon + * @param int $noadmininfo 0=Add admin info, 1=Disable admin info + * @param int $maxlength Max length of label + * @param string $morecss More CSS + * @param int $use_multilevel If > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes. * @return void */ public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0) { global $langs, $user; + dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); + + $ticketstat = new Ticket($this->db); + $ticketstat->loadCacheCategoriesTickets(); + if ($use_multilevel <= 0) { - $ticketstat = new Ticket($this->db); - - dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); - - $ticketstat->loadCacheCategoriesTickets(); - print ''; } $stringtoprint .= ' '; @@ -709,8 +710,10 @@ class FormTicket $sql .= $this->db->ifsql("ctc.rowid NOT IN (SELECT ctcfather.rowid FROM llx_c_ticket_category as ctcfather JOIN llx_c_ticket_category as ctcjoin ON ctcfather.rowid = ctcjoin.fk_parent)", "'NOTPARENT'", "'PARENT'")." as isparent"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc"; $sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctcjoin ON ctc.fk_parent = ctcjoin.rowid"; - $sql .= " WHERE ctc.public = 1"; - $sql .= " AND ctc.active = 1"; + $sql .= " WHERE ctc.active = 1"; + if ($filtertype == 'public=1') { + $sql .= " AND ctc.public = 1"; + } if (!empty($arrayidused)) { $sql .= " AND ctc.fk_parent IN ( "; foreach ($arrayidused as $idused) { @@ -791,6 +794,7 @@ class FormTicket $stringtoprint .='})'; $stringtoprint .=''; } + $stringtoprint .= ajax_combobox($htmlname); return $stringtoprint; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 89f239db6c6..b3514f5fe0d 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1177,7 +1177,7 @@ class Ticket extends CommonObject } // Cache deja charge - $sql = "SELECT rowid, code, label, use_default, pos, description, public, active"; + $sql = "SELECT rowid, code, label, use_default, pos, description, public, active, force_severity, fk_parent"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category"; $sql .= " WHERE active > 0"; $sql .= " ORDER BY pos"; @@ -1196,6 +1196,8 @@ class Ticket extends CommonObject $this->cache_category_tickets[$obj->rowid]['pos'] = $obj->pos; $this->cache_category_tickets[$obj->rowid]['public'] = $obj->public; $this->cache_category_tickets[$obj->rowid]['active'] = $obj->active; + $this->cache_category_tickets[$obj->rowid]['force_severity'] = $obj->force_severity; + $this->cache_category_tickets[$obj->rowid]['fk_parent'] = $obj->fk_parent; $i++; } return $num;