How to change the number of digits in the ticket code?

In order to set a different number of digits in the ticket code, some source code modifications will have to be made. The file that will have to be edited is:

/administrator/components/com_rsticketspro/helpers/ticket.php

Here, around line 695, you will be able to find the code section which generated the ticket code:

 
    // random
    if ($department->get('generation_rule') == 1)
    {
    // add the department prefix
    $code = $department->get('prefix') . '-' . strtoupper(RSTicketsProHelper::generateNumber(10));
    $db->setQuery("SELECT id FROM #__rsticketspro_tickets WHERE code='".$code."'");
      while ($db->loadResult())
      {
      // add the department prefix
      $code = $department->get('prefix') . '-' . strtoupper(RSTicketsProHelper::generateNumber(10));
      $db->setQuery("SELECT id FROM #__rsticketspro_tickets WHERE code='".$code."'");
      }
    }
    // sequential
    else
    {
    $code = $department->get('next_number');
    $code = str_pad($code, 10, 0, STR_PAD_LEFT);
    // add the department prefix
    $code = $department->get('prefix') . '-' . $code;
    $db->setQuery("UPDATE #__rsticketspro_departments SET `next_number` = `next_number` + 1 WHERE id='".$department_id."' LIMIT 1");
    $db->query();
    }
 

In the above code section, the following code lines should be adjusted:

$code = $department->get('prefix') . '-' . strtoupper(RSTicketsProHelper::generateNumber(10));

- the above code line should be modified in both places where it is found and only the value 10 should be modified in the code section to another number of your choice. The value represents the number of digits found by default in the ticket code when the "random" generation rule is set.

$code = str_pad($code, 10, 0, STR_PAD_LEFT);

- in this code line the value 10 should again be changed to another value of your choice. This value represents the number of digits set for a ticket when the "sequential" generation rule is set.


6 persons found this article helpful.


Was this article helpful?

Yes No
Sorry about that