Le voici, donc on n'a plus que l'affichage des catégories liée au
template + lien vers la search page des catégories de ticket.
David
++
Le Mon, 12 Dec 2011 09:55:27 +0100 MoYo <[email protected]> a écrit:
>Le 12/12/2011 09:38, David DURIEUX a écrit :
>> Le Mon, 12 Dec 2011 09:19:51 +0100
>> MoYo<[email protected]> a écrit:
>>
>>> Le 11/12/2011 00:36, David DURIEUX a écrit :
>>>> Bonjour,
>>>>
>>>> Il manque un onglet afin d'assigner un template de ticket à une
>>>> catégorie, ceci à partir du form de templates de ticket. J'ai donc
>>>> codé cet ajout qui permet de gagner du temps de gestion.
>>>>
>>>> Je joins une capture d'écran du résultat.
>>>>
>>>>
>>> Bonjour,
>>>
>>> avoir un état récapitulatif me semble une bonne idée. Faire de
>>> l'association directement à ce niveau me semble dangereux.
>>>
>>> On associe des catégories à un gabarit mais sans aucune information
>>> sur le fait que celles-ci sont déjà associées ou pas à un autre
>>> gabarit.
>>> Ce genre de modifications est réalisable via les modifications
>>> massives du moteur de recherche qui permet d'afficher les
>>> informations existantes, de filtrer sur celles-ci...
>>>
>>> ++
>>>
>>> Julien
>>>
>> Oui en effet pour l'association, par contre il faut mettre un lien
>> vers la search page des catégories de tickets (pour éviter de faire
>> menu>
>> configuration> intitulé> catégorie de ticket qui est fastidieux)
>>
>> Tu veux que je modifie le patch du coup ?
>>
>Oui avec plaisir.
>
>++
>
>Julien
>
>
>> David
>> ++
>>
>> _______________________________________________
>> Glpi-dev mailing list
>> [email protected]
>> https://mail.gna.org/listinfo/glpi-dev
>
>
>_______________________________________________
>Glpi-dev mailing list
>[email protected]
>https://mail.gna.org/listinfo/glpi-dev
Index: inc/itilcategory.class.php
===================================================================
--- inc/itilcategory.class.php (revision 16416)
+++ inc/itilcategory.class.php (working copy)
@@ -212,7 +212,93 @@
function cleanDBonPurge() {
Rule::cleanForItemCriteria($this);
}
+
+
+ function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
+ global $LANG;
+ if (Session::haveRight("entity_dropdown","r")) {
+ switch ($item->getType()) {
+ case 'TicketTemplate' :
+ $ong[1] = $this->getTypeName();
+ return $ong;
+ }
+ }
+ return '';
+ }
+
+
+ static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
+
+ self::showForTicketTemplate($item, $withtemplate);
+ return true;
+ }
+
+
+ static function showForTicketTemplate(TicketTemplate $tt, $withtemplate='') {
+ global $DB, $LANG, $CFG_GLPI;
+
+ $itilcategory = new self();
+ $ID = $tt->fields['id'];
+
+ if (!$tt->getFromDB($ID) || !$tt->can($ID, "r")) {
+ return false;
+ }
+ $ttm = new self();
+
+ $rand = mt_rand();
+
+ echo "<div class='center'>";
+
+ $query = "SELECT `glpi_itilcategories`.*
+ FROM `glpi_itilcategories`
+ WHERE (`tickettemplates_id_incident` = '$ID')
+ OR (`tickettemplates_id_demand` = '$ID')
+ ORDER BY `name`";
+
+ if ($result=$DB->query($query)) {
+ echo "<table class='tab_cadre_fixe'>";
+ echo "<tr><th colspan='3'>";
+ echo "<a href='".Toolbox::getItemTypeSearchURL($itilcategory->getType())."'>";
+ echo self::getTypeName($DB->numrows($result));
+ echo "</a>";
+ echo "</th></tr>";
+ $used_incident = array();
+ $used_demand = array();
+ if ($DB->numrows($result)) {
+ echo "<th>".$LANG['common'][16]."</th>";
+ echo "<th>".$LANG['job'][1]."</th>";
+ echo "<th>".$LANG['job'][2]."</th>";
+ echo "</tr>";
+
+ while ($data=$DB->fetch_assoc($result)) {
+ echo "<tr class='tab_bg_2'>";
+ $itilcategory->getFromDB($data['id']);
+ echo "<td>".$itilcategory->getLink(1)."</td>";
+ if ($data['tickettemplates_id_incident'] == $ID) {
+ echo "<td align='center'>
+ <img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14'/></td>";
+ $used_incident[] = $data["id"];
+ } else {
+ echo "<td> </td>";
+ }
+ if ($data['tickettemplates_id_demand'] == $ID) {
+ echo "<td align='center'>
+ <img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14'/></td>";
+ $used_demand[] = $data["id"];
+ } else {
+ echo "<td> </td>";
+ }
+ }
+
+ } else {
+ echo "<tr><th colspan='3'>".$LANG['search'][15]."</th></tr>";
+ }
+
+ echo "</table></div>";
+ }
+ }
+
}
?>
Index: inc/tickettemplate.class.php
===================================================================
--- inc/tickettemplate.class.php (revision 16416)
+++ inc/tickettemplate.class.php (working copy)
@@ -229,6 +229,7 @@
$this->addStandardTab('TicketTemplatePredefinedField', $ong, $options);
$this->addStandardTab('TicketTemplateHiddenField', $ong, $options);
$this->addStandardTab('TicketTemplate', $ong, $options);
+ $this->addStandardTab('ITILCategory', $ong, $options);
$this->addStandardTab('Log', $ong, $options);
return $ong;
_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev