Kayako logo
Modifications & Addon Releases Modification guides and addons are posted here to share with the community. Do not post requests in here!

Notices

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  (#1) Old
Dynadata Offline
Member
 
Posts: 171
Join Date: Feb 2008
Location: Netherlands
Change Ticket ID depending of your department - 28-03-2008, 09:02 AM

This is a small tutorial how you can change your ticket ID into the first characters of your department.
So when you want to submit a ticket in the "General" department your ticket ID won't be "DTR-806371" for example but "GEN-806371" (the first 3 charactors of your department).

See also post #4.

Open:
Code:
\modules\tickets\functions_ticketcore.php
Search for:
Code:
function createTicket
Seach inside that function for:
Code:
$ticketmaskid = generateTicketMask(); // Generate the unique ticket mask
Replace this line by:
Code:
$ticketmaskid = generateTicketMask($departmentid); // Generate the unique ticket mask
Search for:
Code:
function generateTicketMask()
Replace this whole function by:
Code:
function generateTicketMask($departmentid)
 {
  global $dbCore, $_SWIFT;
 
  mt_srand ((double) microtime() * 1000000);
  $num = mt_rand(100000,999999);
 
  $dbCore->query("SELECT `title` FROM `". TABLE_PREFIX ."departments` WHERE `departmentid` = '". $dbCore->escape($departmentid) ."';");
  $dbCore->nextRecord();
  $department_title = strtoupper(substr($dbCore->Record["title"], 0, 3));
 
  $ticketmaskid = $department_title . "-" . $num;
 
  $_maskcheck = $dbCore->queryFetch("SELECT ticketmaskid FROM `". TABLE_PREFIX ."tickets` WHERE `ticketmaskid` = '". $dbCore->escape($ticketmaskid) ."';");
  if (!empty($_maskcheck["ticketmaskid"]))
  {
   return generateTicketMask();
  }
  return $ticketmaskid;
 }
Save the file and enjoy!

Last edited by Dynadata; 28-03-2008 at 03:25 PM.
   
Reply With Quote
  (#2) Old
supportskins Offline
Senior Member
 
supportskins's Avatar
 
Posts: 3,536
Join Date: Aug 2006
Location: Mumbai, India
28-03-2008, 09:13 AM

Nice! Thanks for sharing



Professional and Affordable Kayako Skins - Specialists in Kayako Skinning & Customization - Professional Paid Support
Our Skins and Services - http://www.supportskins.com/store/
SupportSkins.com - http://www.supportskins.com/
   
Reply With Quote
  (#3) Old
craigbrass Offline
Senior Member
 
Posts: 5,328
Join Date: Jun 2005
Location: Cumbria, UK
28-03-2008, 10:31 AM

Indeed. Something like this should be included in the software by default and managable via the ACP...


Craig Brass - Kayako Forum Squatter (Note: I am NOT a staff member)

Icon Headquarters - Its Elixir - Web2Messenger
   
Reply With Quote
  (#4) Old
Dynadata Offline
Member
 
Posts: 171
Join Date: Feb 2008
Location: Netherlands
28-03-2008, 10:37 AM

I changed the code at this moment just a little bit more and you could do this to if you are in my situation:
If you have for example 3 groups:
- Guest
- Registered
- Service

You also have 4 departments:
- General (only viewable for the "Guest" and "Registered" group)
- Service (only viewable for the "Guest" and "Registered" group)
- Hardware (only viewable for the "Group1" group)
- Software (only viewable for the "Group1" group)

The departments "Hardware" and "Software" are a kind of sub departments.
Now I have one user who is a member of "Group1".
When he/she submit a new ticket the ticket ID would be "HAR-123456" or "SOF-123456".
But because those are sub departments of "Service" I want the ticket ID's start with "SER-123456".
If you have the same situation as I descriped above then follow this tutorial.

Before we start make sure that the name of your "default" departments (those who will be viewable for the "Guest" and the "Registered" group) does have the same name as your group name. (So if your department is called "Service" your group should also be named "Service". This does not affect the standerd 2 groups like the "Guest" and the "Registered" group.)

Open:
Code:
\modules\tickets\functions_ticketcore.php
Search for:
Code:
function createTicket
Seach inside that function for:
Code:
$ticketmaskid = generateTicketMask(); // Generate the unique ticket mask
Replace this line by:
Code:
$ticketmaskid = generateTicketMask($departmentid, $userid); // Generate the unique ticket mask 
Search for:
Code:
function generateTicketMask()
Replace this whole function by:
Code:
 
function generateTicketMask($departmentid, $userid)
{
global $dbCore, $_SWIFT;
mt_srand ((double) microtime() * 1000000);
$num = mt_rand(100000,999999);
 
$dbCore->query("SELECT ". TABLE_PREFIX ."usergroups.usergroupid, title FROM ". TABLE_PREFIX ."usergroups INNER JOIN ". TABLE_PREFIX ."users ON ". TABLE_PREFIX ."usergroups.usergroupid = ". TABLE_PREFIX ."users.usergroupid WHERE userid = '". $dbCore->escape($userid) ."';");
$dbCore->nextRecord();
$record = $dbCore->Record["title"];
$usergroupid = $dbCore->Record["usergroupid"];
 
if ($usergroupid != 1 && $usergroupid != 2)
{
$department_title = strtoupper(substr($record, 0, 3));
}
else
{
$dbCore->query("SELECT `title` FROM `". TABLE_PREFIX ."departments` WHERE `departmentid` = '". $dbCore->escape($departmentid) ."';");
$dbCore->nextRecord();
$record = $dbCore->Record["title"];
$department_title = strtoupper(substr($record, 0, 3)); 
}
$ticketmaskid = $department_title . "-" . $num;
 
$_maskcheck = $dbCore->queryFetch("SELECT ticketmaskid FROM `". TABLE_PREFIX ."tickets` WHERE `ticketmaskid` = '". $dbCore->escape($ticketmaskid) ."';");
if (!empty($_maskcheck["ticketmaskid"]))
{
return generateTicketMask();
}
return $ticketmaskid;
}
Save the file and enjoy!

Last edited by Dynadata; 28-03-2008 at 03:24 PM.
   
Reply With Quote
Reply

Tags
department, depending, ticket

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
The SLA system explained with example implementation Matthew SupportSuite, eSupport and LiveResponse 29 27-08-2008 01:39 PM
Change submit ticket text based on department handsonweb Developers & Code 1 30-04-2008 11:05 PM
Status change when changing Department of Ticket Xeserve Wont Implement / Already Implemented 8 02-02-2008 07:53 PM
New Build: 3.10.02 STABLE Ryan Lederman News and Announcements 0 05-03-2007 09:53 PM



Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46