Kayako logo
Modifications & Extensions Modifications, extensions and guides for your Kayako help desk software.


Kayako develops robust helpdesk software, live chat and real-time visitor monitoring software.
Kayako is trusted by more than 30,000 organizations, including a number of Fortune 500 companies and government institutions.
Reply
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  (#1) Old
Matthew Offline
Member
 
Matthew's Avatar
 
Posts: 270
Join Date: Oct 2007
Location: Jakarta, Indonesia
Post Internal vs Display Names for Departments - 26-10-2008, 08:11 AM

This is a follow-up to the thread: http://forums.kayako.com/f63/interna...ay-name-13285/

Here's how to create a separate display name for each of your departments, that appears on the client-side department selection page. You also get a mouseover popup with a more detailed department description. See attached screenshot.

Why would you want to do this? A couple examples:
  1. You have many departments, and you clients are easily confused as to which department they should submit an issue to. You want to make the display name a bit more descriptive than than the internal name seen in the Staff CP.
  2. Your help desk routes tickets for multiple geographical sites. Each has their own template group for customizing interfaces elements, language, and access to knowledgebase/download items. Internally, you have departments that look like:
  • Staff Support (Dubai)
  • Staff Support (Jakarta)
  • Staff Support (Hong Kong)
  • etc.
The departments are staffed by different people of course, based in the different office locations. However, when company staff log into the web interface to issue a ticket, they should only need to see one department: Staff Support Services. So internal department names must be distinct, but the display names may be identical.
How To Do It

Warning: you need to modify your database and several core Kayako files. Do not attempt this unless you have experience with such. Don't ask me for help if you break something.

Backup these files:
  • \locale\en-us\departments.php
  • \modules\core\admin_departments.php
  • \includes\functions_departments.php
Step 1: Modify your database

In table swdepartments, you need to add two more fields:
  1. displaytitle (type=varchar, length=100, allow null=no, charset=utf8, collation=utf8_general_ci)
  2. titledesc (type=varchar, length=255, allow null=yes, charset=utf8, collation=utf8_general_ci)
Step 2: Add the language strings

Insert the following strings into the array in \locale\en-us\departments:
PHP Code:
    // Department Display Name Mod by Matthew Arciniega
    
'desc_departments' => 'Description'
    
'desc_depdescription' => 'This text will be displayed with departments listed on the client side. When you have many departments, use this text to help clients find the right one for their query.',   
    
'depdisplaytitle' => 'Display Title'
    
'desc_depdisplaytitle' => 'This is the department title as seen by clients when submitting a ticket through the web interface. Normally it is the same as the internal title, but it does not have to be.'
    
// End Mod 
Step 3: Modify department functions

In \includes\functions_departments.php, make the following changes:

In function insertDepartment, replace the function declaration with:
PHP Code:
    function insertDepartment($title$departmentmodule$tgroupidlist$type "1"$displayorder "1"$isdefault false$displaytitle$titledesc ""
In the same function, find this line...
PHP Code:
$dbCore->query("INSERT INTO `"TABLE_PREFIX ."departments` (`title`, `departmenttype`, `departmentmodule`, `isdefault`, `displayorder`) VALUES ('"$dbCore->escape($title) ."', '"iif($type=="1""public""private") ."', '"$dbCore->escape($departmentmodule) ."', '"$dbCore->escape($nisdefault) ."', '"$dbCore->escape($displayorder) ."');"); 
...and replace with:
PHP Code:
        // Department Description Mod by Matthew Arciniega
        
$dbCore->query("INSERT INTO `"TABLE_PREFIX ."departments` (`title`, `departmenttype`, `departmentmodule`, `isdefault`, `displayorder`, `displaytitle`, `titledesc`) VALUES ('"$dbCore->escape($title) ."', '"iif($type=="1""public""private") ."', '"$dbCore->escape($departmentmodule) ."', '"$dbCore->escape($nisdefault) ."', '"$dbCore->escape($displayorder) ."', '"$dbCore->escape($displaytitle) ."', '"$dbCore->escape($titledesc) ."');"); 
In function renderDepartmentForm, find this line...
PHP Code:
    printTextRow("title"$_SWIFT["language"]["deptitle"], $_SWIFT["language"]["desc_deptitle"], "text"$_POST["title"]); 
...and insert after it:
PHP Code:
    // Department Description Mod by Matthew Arciniega
    
printTextRow("displaytitle"$_SWIFT["language"]["depdisplaytitle"], $_SWIFT["language"]["desc_depdisplaytitle"], "text"$_POST["displaytitle"]);
    
printTextAreaRow("titledesc"$_SWIFT["language"]["desc_departments"], $_SWIFT["language"]["desc_depdescription"], $_POST["titledesc"] , "60""4"false"");
    
// End Mod 
In function updateDepartment, replace the function declaration with:
PHP Code:
function updateDepartment($departmentid$title$departmentmodule$tgroupidlist$type "1"$displayorder "1"$isdefault false$displaytitle$titledesc ""
In the same function, find this line...
PHP Code:
$dbCore->query("UPDATE `"TABLE_PREFIX ."departments` SET `title` = '"$dbCore->escape($title) ."', `departmenttype` = '"iif($type=="1""public""private") ."', `departmentmodule` = '"$dbCore->escape($departmentmodule) ."', `displayorder` = '"$dbCore->escape($displayorder) ."' WHERE `departmentid` = '"intval($departmentid) ."';"); 
...and replace with:
PHP Code:
    // Department Description Mod by Matthew Arciniega
    
$dbCore->query("UPDATE `"TABLE_PREFIX ."departments` SET `title` = '"$dbCore->escape($title) ."', `departmenttype` = '"iif($type=="1""public""private") ."', `departmentmodule` = '"$dbCore->escape($departmentmodule) ."', `displayorder` = '"$dbCore->escape($displayorder) ."', `displaytitle` = '"$dbCore->escape($displaytitle) ."', `titledesc` = '"$dbCore->escape($titledesc) ."' WHERE `departmentid` = '"intval($departmentid) ."';"); 
Step 4: Modify department actions

In \modules\core\admin_departments.php, locate the first occurrence of this code...
PHP Code:
        if (trim($_POST["title"]) == "")
        {
            
$errormessage $_SWIFT["language"]["requiredfieldempty"]; 
...and insert after it:
PHP Code:
        // Department Description Mod by Matthew Arciniega
        
} else if (trim($_POST["displaytitle"]) == "")
        {
            
$errormessage $_SWIFT["language"]["requiredfieldempty"];
        
// End Mod 
In the same handler, find this code...
PHP Code:
$depid $departments->insertDepartment($_POST["title"], $_POST["departmentmodule"], $_POST["tgroupid"], $_POST["type"], $_POST["displayorder"], $_POST["isdefault"]); 
...and replace it with:
PHP Code:
            // Department Description Mod by Matthew Arciniega
            
$depid $departments->insertDepartment($_POST["title"], $_POST["departmentmodule"], $_POST["tgroupid"], $_POST["type"], $_POST["displayorder"], $_POST["isdefault"], $_POST["displaytitle"], $_POST["titledesc"]); 
Now locate the second occurrence of this code...
PHP Code:
        if (trim($_POST["title"]) == "")
        {
            
$errormessage $_SWIFT["language"]["requiredfieldempty"]; 
...and insert after it:
PHP Code:
        // Department Description Mod by Matthew Arciniega
        
} else if (trim($_POST["displaytitle"]) == "")
        {
            
$errormessage $_SWIFT["language"]["requiredfieldempty"];
        
// End Mod 
Lastly, in the same handler, find this code...
PHP Code:
    // Department Description Mod by Matthew Arciniega
    
$dbCore->query("UPDATE `"TABLE_PREFIX ."departments` SET `title` = '"$dbCore->escape($title) ."', `departmenttype` = '"iif($type=="1""public""private") ."', `departmentmodule` = '"$dbCore->escape($departmentmodule) ."', `displayorder` = '"$dbCore->escape($displayorder) ."', `displaytitle` = '"$dbCore->escape($displaytitle) ."', `titledesc` = '"$dbCore->escape($titledesc) ."' WHERE `departmentid` = '"intval($departmentid) ."';"); 
Step 5: Edit Your Departments

In Admin CP->Manage Departments, edit each of your departments. At minimum, you need to add a Display Title. For departments where you don't need a separate display name, just use the same name as the original Title. Here's an example of what I did (note the use of bold tags in the string):
Title: Desktop Support
Display Title: <b>Desktop Support</b> (staff email, networking, PC & software configuration)
Adding descriptions for each department is optional. These will appear in mousover text when you hover over a radio button on the department selection page in the client side.

Step 6: Edit the submitdepartmentlist Template

In Admin CP->Templates->Manage Templates, navigate to the template group you want to modify (if not default), and edit the Tickets->submitdepartmentlist template.

Locate code that looks like this:
HTML Code:
<td width="1" align="left" valign="top" class="row2"><label for="departmentid[<{$item[departmentid]}>]"><input type="radio" name="departmentid" id="departmentid[<{$item[departmentid]}>]" value="<{$item[departmentid]}>"<{if $tgroup[departmentid] == $item[departmentid]}> checked<{/if}>></label></td>
        <td><span class="smalltext"><label for="departmentid[<{$item[departmentid]}>]" style="CURSOR: pointer;"><{$item[title]}></label></span></td> 
Replace it with:
HTML Code:
<td width="1" align="left" valign="top" class="row2"><label for="departmentid[<{$item[departmentid]}>]"><input type="radio" name="departmentid" title="<{$item[titledesc]}>" id="departmentid[<{$item[departmentid]}>]" value="<{$item[departmentid]}>"<{if $tgroup[departmentid] == $item[departmentid]}> checked<{/if}>></label></td>
        <td><span class="smalltext"><label for="departmentid[<{$item[departmentid]}>]" style="CURSOR: pointer;"><{$item[displaytitle]}></label></span></td> 
Do this for every template group where you need this mod.

Now you are done!
Attached Images
File Type: png Department Display Names.png (8.3 KB, 117 views)


Matthew Arciniega
Free: Ticket List & Search | Dept. Display Names
Free: Outlook/HTML Tickets| Staff Parser Log
Tutorials: SLA System
| Template Groups
KSS v3.20.02 | PHP: 5.2.6 | MySQL: 5.0.58 | CentOS 4

Last edited by Matthew; 26-10-2008 at 09:19 AM. Reason: minor cleanup
   
Reply With Quote
  (#2) Old
craigbrass Offline
Senior Member
 
Posts: 7,547
Join Date: Jun 2005
Location: Cumbria, UK
26-10-2008, 09:07 AM

Very nice Matthew! Thanks for sharing. This is one of the features I would like to see in the main distribution...


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

Click here for Kayako Software Development

My Addons: BlackBerry Ticket Client for Kayako - Windows Mobile Live Support Client for Kayako
   
Reply With Quote
  (#3) Old
tuwebfacil Offline
New Member
 
Posts: 11
Join Date: Oct 2004
01-08-2009, 02:40 PM

Quote:
Originally Posted by craigbrass View Post
Very nice Matthew! Thanks for sharing. This is one of the features I would like to see in the main distribution...
Agree!!

Thanks!!!
   
Reply With Quote
Reply

Tags
departments, description, display, names

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
Internal and External Department Names Saxi System administrator features (misc) 4 13-10-2008 02:05 PM



Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78