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

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  (#1) Old
deeps Offline
New Member
 
Posts: 25
Join Date: Aug 2007

SupportSuite
Owned License
Yet another mod to the user lookup facility when creating a new ticket - 18-09-2007, 08:46 AM

SupportSuite version 3.11.01 stable

When creating a new ticket, you can search for the user (or contact) the ticket relates to, and it'll typically show their name and email address(es).

When creating a new phone ticket, you can click the search button next to phone number, type in user/contact name, and click an email address and have that inserted as a phone number. Oops! This mod prevents that from happening, forcing user email addresses to only ever be inserted in the email address field. Similarly, clicking phone numbers (see below) will also only be put in the phone number field.

This mod only affects users, not contacts.

However, it's not too big a task to expand this concept to contacts too.

In my particular situation, I don't have more than one phone number per user, so I'm using 'phone' field in the 'users' table to specify a phone number. Doing this manually via SQL at the moment (see New fields in 'edit users' page).

Assuming a user has
- A name
- A phone number
- An email address
clicking their name in the search box will result in all 3 fields being filled out!

If they don't have one of the above fields registered, it'll still try. In my tests in Firefox 2.0.0.6, this didn't result in any errors, however, your mileage may vary.

Changes provided in form of diff/patch files again, both attached and included below.

Code:
patch /path/to/kayako/modules/core/functions_userlookup.php userlookup.diff.txt
Code:
deeps@tickets:~/kayako$ cat userlookup.diff
*** trunk/upload/modules/core/functions_userlookup.php  2007-09-18 09:06:11.000000000 +0200
--- branches/deepsdev/upload/modules/core/functions_userlookup.php      2007-09-18 09:21:04.000000000 +0200
***************
*** 44,50 ****
                }

                // Ok, now build the user list
!               $dbCore->query("SELECT users.userid, users.fullname FROM `". TABLE_PREFIX ."users` AS users WHERE users.userid IN (". buildIN($_useridlist) .");");
                while ($dbCore->nextRecord())
                {
                        $_userlist[$dbCore->Record["userid"]] = $dbCore->Record;
--- 44,50 ----
                }

                // Ok, now build the user list
!               $dbCore->query("SELECT users.userid, users.fullname, users.phone FROM `". TABLE_PREFIX ."users` AS users WHERE users.userid IN (". buildIN($_useridlist) .");");
                while ($dbCore->nextRecord())
                {
                        $_userlist[$dbCore->Record["userid"]] = $dbCore->Record;
***************
*** 69,83 ****
                } else {
                        $usericon = 'icon_yellowbigdot.gif';
                }
!               $_usernode = &$usersnode->addItem(new HTML_TreeNode(array('text' => " ". addslashes($val["fullname"]) ." ". iif($emailcount>1, '('.intval($emailcount).')'), 'link' => "javascript:windowPlaceEmail(\'". addslashes($val["emails"][0]) ."\', \'".addslashes($_GET["formname"])."\', \'". addslashes($_GET["formfield"]) ."\')", 'icon' => $usericon, 'expandedIcon' => $usericon, 'expanded' => true)));

                if ($emailcount > 0)
                {
                        foreach ($val["emails"] as $emailkey=>$emailval)
                        {
!                               $_emailnode = &$_usernode->addItem(new HTML_TreeNode(array('text' => " ". addslashes($emailval), 'link' => "javascript:windowPlaceEmail(\'". addslashes($emailval) ."\', \'".addslashes($_GET["formname"])."\', \'". addslashes($_GET["formfield"]) ."\')", 'icon' => "icon_msgsmallyellow.gif", 'expandedIcon' => "icon_msgsmallyellow.gif", 'expanded' => true)));
                        }
                }
        }

        if ($module->isRegistered(MODULE_TEAMWORK))
--- 69,87 ----
                } else {
                        $usericon = 'icon_yellowbigdot.gif';
                }
!               $_usernode = &$usersnode->addItem(new HTML_TreeNode(array('text' => " ". addslashes($val["fullname"]) ." ". iif($emailcount>1, '('.intval($emailcount).')'), 'link' => "javascript:windowPlaceEmail(\'". addslashes($val["fullname"]) ."\', \'".addslashes($_GET["formname"])."\', \'opt_username\');javascript:windowPlaceEmail(\'". addslashes($val["emails"][0]) ."\', \'".addslashes($_GET["formname"])."\', \'opt_useremail\');javascript:windowPlaceEmail(\'". addslashes($val["phone"]) ."\', \'".addslashes($_GET["formname"])."\', \'opt_userphone\')", 'icon' => $usericon, 'expandedIcon' => $usericon, 'expanded' => true)));

                if ($emailcount > 0)
                {
                        foreach ($val["emails"] as $emailkey=>$emailval)
                        {
!                               $_emailnode = &$_usernode->addItem(new HTML_TreeNode(array('text' => " ". addslashes($emailval), 'link' => "javascript:windowPlaceEmail(\'". addslashes($emailval) ."\', \'".addslashes($_GET["formname"])."\', \'opt_useremail\')", 'icon' => "icon_msgsmallyellow.gif", 'expandedIcon' => "icon_msgsmallyellow.gif", 'expanded' => true)));
                        }
                }
+               if (!empty($val["phone"]))
+               {
+                       $_emailnode = &$_usernode->addItem(new HTML_TreeNode(array('text' => " ". $_SWIFT["language"]["c_mobile"].addslashes($val["phone"]), 'link' => "javascript:windowPlaceEmail(\'". addslashes($val["phone"]) ."\', \'".addslashes($_GET["formname"])."\', \'opt_userphone\')", 'icon' => "icon_ticketphone.gif", 'expandedIcon' => "icon_ticketphone.gif", 'expanded' => true)));
+               }
        }

        if ($module->isRegistered(MODULE_TEAMWORK))
This hasn't been extensively tested, use at your own risk! Bug reports also welcome

Deeps.
Attached Files
File Type: txt userlookup.diff.txt (3.4 KB, 15 views)

Last edited by deeps : 18-09-2007 at 08:47 AM. Reason: including attached file
   
Reply With Quote
  (#2) Old
craigbrass Offline
Senior Member
 
Posts: 4,951
Join Date: Jun 2005
Location: Cumbria, UK

SupportSuite
Owned License
18-09-2007, 09:01 AM

Another great share, well done!


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

Icon Headquarters - Its Elixir - Web2Messenger
   
Reply With Quote
  (#3) Old
Siora Offline
Member
 
Siora's Avatar
 
Posts: 1,238
Join Date: Apr 2007
Location: Toronto Canada

SupportSuite
Owned License
18-09-2007, 12:45 PM

Forgive me for not understanding but how do we go about implementing this mod?


Mehul
Siora Solutions Inc.
www.sioraIT.com
   
Reply With Quote
  (#4) Old
craigbrass Offline
Senior Member
 
Posts: 4,951
Join Date: Jun 2005
Location: Cumbria, UK

SupportSuite
Owned License
18-09-2007, 01:30 PM

You use SSH on your server and run like patch /path/to/kayako/modules/core/functions_userlookup.php userlookup.diff.txt. It changes the file for you.


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

Icon Headquarters - Its Elixir - Web2Messenger
   
Reply With Quote
  (#5) Old
Siora Offline
Member
 
Siora's Avatar
 
Posts: 1,238
Join Date: Apr 2007
Location: Toronto Canada

SupportSuite
Owned License
18-09-2007, 01:40 PM

Okay so if I don't have access to do such a task can I modify the file manually? I'm sure I can I just need to understand the code to ensure I know which lines to modify and with what code.


Mehul
Siora Solutions Inc.
www.sioraIT.com
   
Reply With Quote
  (#6) Old
deeps Offline
New Member
 
Posts: 25
Join Date: Aug 2007

SupportSuite
Owned License
18-09-2007, 01:46 PM

if you look at the diff file, each block of changes is split by a row of ***************.

The first block below up until the hyphens is the original source, the line prefixed with a ! is indicating where the changes take place. Below the hyphens is what the updated code looks like.

I've marked the original line in italics, and the updated line in bold.

Where lines are prefixed with + or -, it means they were added / removed.

Google for more information, the application used to generate this information is GNU diff.

Deeps.

Code:
***************
*** 44,50 ****
                }

                // Ok, now build the user list
!               $dbCore->query("SELECT users.userid, users.fullname FROM `". TABLE_PREFIX ."users` AS users WHERE users.userid IN (". buildIN($_useridlist) .");");
                while ($dbCore->nextRecord())
                {
                        $_userlist[$dbCore->Record["userid"]] = $dbCore->Record;
--- 44,50 ----
                }

                // Ok, now build the user list
!               $dbCore->query("SELECT users.userid, users.fullname, users.phone FROM `". TABLE_PREFIX ."users` AS users WHERE users.userid IN (". buildIN($_useridlist) .");");
                while ($dbCore->nextRecord())
                {
                        $_userlist[$dbCore->Record["userid"]] = $dbCore->Record;
   
Reply With Quote
  (#7) Old
Siora Offline
Member
 
Siora's Avatar
 
Posts: 1,238
Join Date: Apr 2007
Location: Toronto Canada

SupportSuite
Owned License
18-09-2007, 01:52 PM

Thanks Deeps, that explains a lot and should help out others who aren't familiar with this style.


Mehul
Siora Solutions Inc.
www.sioraIT.com
   
Reply With Quote
  (#8) Old
craigbrass Offline
Senior Member
 
Posts: 4,951
Join Date: Jun 2005
Location: Cumbria, UK

SupportSuite
Owned License
18-09-2007, 02:22 PM

It was the same situation for me a few years ago until I started using X-Cart which uses it for upgrades. I am personally not a fan and would rather modify by hand.


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

Icon Headquarters - Its Elixir - Web2Messenger
   
Reply With Quote
  (#9) Old
Siora Offline
Member
 
Siora's Avatar
 
Posts: 1,238
Join Date: Apr 2007
Location: Toronto Canada

SupportSuite
Owned License
29-09-2007, 03:09 PM

I just tried this mod but it doesn't seem to populate the phone number. If I click the user's name it populates only the name and email not their phone number. Any ideas?


Mehul
Siora Solutions Inc.
www.sioraIT.com
   
Reply With Quote
  (#10) Old
deeps Offline
New Member
 
Posts: 25
Join Date: Aug 2007

SupportSuite
Owned License
01-10-2007, 07:11 AM

Are you clicking users or contacts? Where are the user's phone numbers stored?

As explained in the original post, this mod only works with users, not contacts, and requires for the user's phone number to be stored in the [TABLE_PREFIX]users table in the 'phone' field, which is by default sitting blank and unused.
   
Reply With Quote
  (#11) Old
Siora Offline
Member
 
Siora's Avatar
 
Posts: 1,238
Join Date: Apr 2007
Location: Toronto Canada

SupportSuite
Owned License
01-10-2007, 11:49 AM

I am clicking on users but I think I added phone#'s as a custom feild when user's register. I guess that explains why it doesn't work. Hmmmm...Is there a way to redirect where the mod looks for the phone number?

How do you guys get your phone numbers to store in the phone feild of the user's table?


Mehul
Siora Solutions Inc.
www.sioraIT.com
   
Reply With Quote
  (#12) Old
Siora Offline
Member
 
Siora's Avatar
 
Posts: 1,238
Join Date: Apr 2007
Location: Toronto Canada

SupportSuite
Owned License
05-04-2008, 02:28 PM

So how do we get the phone number to populate?


Mehul
Siora Solutions Inc.
www.sioraIT.com
   
Reply With Quote
  (#13) Old
Bleckfield Offline
New Member
 
Posts: 4
Join Date: Mar 2008

SupportSuite
Owned License
14-05-2008, 04:47 PM

Weve got this installed, and it works great...

When we log a ticket and search for the user it auto populates the telephone no. the email and the name. However if we link to the input page with the user ID it only inputs the name and email address. Is there a way to get it to put the phone number on this too?

Another thing is, when we view the ticket it shows their phone number underneath the original request. If they send an e-mail into the support desk it doesnt include this bit on the ticket, meaning that we have to look up their info in our sugarcrm database (just slows things down if we need to speak to them on the phone). Anyone got any ideas how we can get it to show the users phone number even if they e-mail into the helpdesk.

Unfortunately i dont know where to start looking
   
Reply With Quote
Reply


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

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




Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

Kayako provides online help desk software and support solutions; enabling companies to improve their support and reduce costs.

Our three main products include: SupportSuite, eSupport and LiveResponse



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