You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2011-03-28 18:29:23

abdora
Member
Registered: 2011-03-21
Posts: 16

Ticket Rules

I would like to create a new ticket rule when I associate ticket category whit task category. How can I do it?!

Offline

#2 2011-03-29 08:43:52

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,278

Re: Ticket Rules

It's not possible because ticket rules are played at the creation of the ticket and task category is affected after the creation


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#3 2011-03-29 13:57:37

abdora
Member
Registered: 2011-03-21
Posts: 16

Re: Ticket Rules

Ok, I resolved the problem temporarily but I don't know how's is the correct solution.

Fist I subscribe the method getAdditionalFields from class TaskCategory to create the field "Associated" hows a lang is $LANG['setup'][76]="Associated with";(english) and $LANG['setup'][76]="Associado a"(portuguese).

subscribe method:
function  getAdditionalFields() {
        global $LANG;

          return  array(array('name'  => 'ticketcategories_id',//receives the category of the ticket;
                              'label' => $LANG['setup'][76],
                              'type'  => 'dropdownValue',
                              'list'  => true),
                        array('name'  => $this->getForeignKeyField(),
                                        'label' => $LANG['setup'][75],
                                        'type'  => 'parent',
                                        'list'  => false));
        }

Every time hows create a task category I'll have  to associate a task category with a ticket category. Makes no sense set a task hows a category is not associated. For example if I have a Catalog category and a user create a Incident task? Thus when I open a new task I listed only the task categories associate a ticket category. For this I modified the structure of the dropdown.

In a method show() of the dropdown.class.php:

//if I have set ticketcategories_id I include in array of parameters;
      if(isset ($params["ticketcategories_id"]) && $params["ticketcategories_id"] >= 0) {
          $param = array_merge($param, array('ticketcategories_id' => $params["ticketcategories_id"]));
      }
     
      $default="<select name='".$params['name']."' id='dropdown_".$params['name'].$params['rand']."'>";
      $default.="<option value='".$params['value']."'>$name</option></select>";
      ajaxDropdown($use_ajax,"/ajax/dropdownValue.php",$param,$default,$params['rand']);

      In method show of TicketTask.class.php when I create a dropdown:
       
      Dropdown::show('TaskCategory', array('ticketcategories_id' => $ticket->fields["ticketcategories_id"]));
   
     In parameter option I step a id of the ticket category;

     In dropdwonValue.php I created a new restriction in select to get only task categories associated:

     if(isset ($_POST["ticketcategories_id"])) {
        $where .="AND ticketcategories_id =".$_POST["ticketcategories_id"];
     }

    I would like to know if I resolved correctly this problem;

Offline

#4 2011-03-29 14:23:08

abdora
Member
Registered: 2011-03-21
Posts: 16

Re: Ticket Rules

I forgot! I create a new column ticketcategories_id in the table taskcategories.

Offline

Board footer

Powered by FluxBB