reggiep Posted January 24, 2010 Posted January 24, 2010 I am currently using Hesk as our helpdesk which is brilliant and free. One thing it does not have, however, is the ability to assign jobs to different staff. I thought an easy (not for me!) way to do this would be to edit the subject line so it had the tech's name at the end e.g. "printer broken - Allocated to Dave". I guess to achieve this I need to edit the admin's view php page of the ticket so they can edit the subject but I just don't have the skills to do this. Can anyone suggest some code to show a field with the ability to edit on a page or maybe a site with tutorials that I could go to to learn how to do this for myself? thanks
maniac Posted January 24, 2010 Posted January 24, 2010 (edited) I am currently using Hesk as our helpdesk which is brilliant and free. One thing it does not have, however, is the ability to assign jobs to different staff. I thought an easy (not for me!) way to do this would be to edit the subject line so it had the tech's name at the end e.g. "printer broken - Allocated to Dave". I guess to achieve this I need to edit the admin's view php page of the ticket so they can edit the subject but I just don't have the skills to do this. Can anyone suggest some code to show a field with the ability to edit on a page or maybe a site with tutorials that I could go to to learn how to do this for myself? thanks The coding for Hesk is well written, I added this feature to it when I used to use it for my helpdesk which displayed a drop down box at the bottom of the view ticket screen with all the users names in, you could select the user and click update and it allocated it to that person. I also added an extra collumn to the main display to show who the ticket was allocated to and also an extra line at the top of the ticket display to show the same information. All you need to do is add an extra field to the mySQL database, then for the collumn display and the display at the top of the ticket replicate some of the lines from the HESK script, changing the database field it references to your newly added one. For the allocation bit, I took the script which displays all the usernames at login and adapted it with a simple form submit button which updated the database - again this was stolen from elsewhere in the program. I had zero experience with PHP when I did this a long time ago, if you start looking through the PHP files, it's relatively easy to work out what they do, just have a play with a seperate copy of it like I did, and eventually you'll get the right bits of code in the right places and it will work. I don't have the code anymore unfortunitely, so I can't share it - sorry. Mike. Edited January 24, 2010 by maniac 1
reggiep Posted January 24, 2010 Author Posted January 24, 2010 @Maniac, Thanks, I have been trying my best to work out where I could steal bits from within Hesk. Using the login box is a stroke of genius. I shall have a play with that.
Danny159 Posted January 25, 2010 Posted January 25, 2010 Do you mean you want a dropdown box with staff members in that is pulled from sql db and made into a dropdown menu? Dan
reggiep Posted January 25, 2010 Author Posted January 25, 2010 @Danny159 That is the sort of thing yes! I am still struggling at the moment.
Danny159 Posted January 25, 2010 Posted January 25, 2010 Ahh easy when you know how =) Here you go: $resultt = mysql_query("SELECT * FROM users ORDER BY id"); echo " Select Someone..."; while ($row = mysql_fetch_array($resultt)) { $id = $row["id"]; $c_name = $row["name"]; $c_email = $row["email"]; echo "$c_name - $c_email"; } echo ""; ?> Hope this helps Dan 1
reggiep Posted January 25, 2010 Author Posted January 25, 2010 Thanks, Not quite sure what I need to do with it but I'll try inserting it in different parts of different pages!
Danny159 Posted January 25, 2010 Posted January 25, 2010 Do you know PHP? Post some of your code and I will put it in for you and explain Dan
reggiep Posted January 25, 2010 Author Posted January 25, 2010 (edited) Ok here goes! define('IN_SCRIPT',1); define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); require(HESK_PATH . 'language/'.$hesk_settings['language'].'.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/database.inc.php'); hesk_session_start(); hesk_isLoggedIn(); hesk_dbConnect(); /* Check permissions for this feature */ hesk_checkPermission('can_view_tickets'); $can_del_notes = hesk_checkPermission('can_del_notes',0); $can_reply = hesk_checkPermission('can_reply_tickets',0); $can_delete = hesk_checkPermission('can_del_tickets',0); $can_edit = hesk_checkPermission('can_edit_tickets',0); $trackingID = strtoupper(hesk_input($_REQUEST['track'])); if (empty($trackingID)) { print_form(); } /* Get ticket info */ $sql = "SELECT * FROM `".$hesk_settings['db_pfix']."tickets` WHERE `trackid`='$trackingID' LIMIT 1"; $result = hesk_dbQuery($sql); if (hesk_dbNumRows($result) != 1) { hesk_error($hesklang['ticket_not_found']); } $ticket = hesk_dbFetchAssoc($result); /* Get category name and ID */ $sql = "SELECT * FROM `".$hesk_settings['db_pfix']."categories` WHERE `id`=$ticket[category] LIMIT 1"; $result = hesk_dbQuery($sql); /* If this category has been deleted use the default category with ID 1 */ if (hesk_dbNumRows($result) != 1) { $sql = "SELECT * FROM `".$hesk_settings['db_pfix']."categories` WHERE `id`=1 LIMIT 1"; $result = hesk_dbQuery($sql); } $category = hesk_dbFetchAssoc($result); /* Is this user allowed to view tickets inside this category? */ hesk_okCategory($category['id']); /* Delete post action */ if (isset($_GET['delete_post']) && $can_delete) { $n = hesk_isNumber($_GET['delete_post']); if ($n) { $sql = "DELETE FROM `".$hesk_settings['db_pfix']."replies` WHERE `id`=$n LIMIT 1"; $res = hesk_dbQuery($sql); $_SESSION['HESK_NOTICE'] = $hesklang['repd']; $_SESSION['HESK_MESSAGE'] = $hesklang['repl']; } header('Location: admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999)); exit(); } /* Delete notes action */ if (isset($_GET['delnote'])) { $n = hesk_isNumber($_GET['delnote']); if ($n) { if ($can_del_notes) { $sql = "DELETE FROM `".$hesk_settings['db_pfix']."notes` WHERE `id`=$n LIMIT 1"; } else { $sql = "DELETE FROM `".$hesk_settings['db_pfix']."notes` WHERE `id`=$n AND `who`=$_SESSION[id] LIMIT 1"; } $res = hesk_dbQuery($sql); } header('Location: admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999)); exit(); } This is the beginning of a long page of code. i can see how your code would get some info out of a database but my server is hosted externally so i am not sure how to call from my own mysql tables, I can guess. I could make a table called users or techs and populate that through phpmyadmin and then call that with your php script? Edited January 25, 2010 by reggiep
Marci Posted January 25, 2010 Posted January 25, 2010 Alternatively, rethink how you use the ticket categories...? Quick and easy to implement... we have a category for each technician.
Danny159 Posted January 28, 2010 Posted January 28, 2010 This is a bit confusing but that bit of code should work, if you get it in the right place on the right file!!! Dan
Marci Posted January 28, 2010 Posted January 28, 2010 but my server is hosted externally so i am not sure how to call from my own mysql tables You don't - you call from the server's MySQL database which runs locally on your webserver. Add a table to the server's MySQL database (same one that Hesk uses) for your own info...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now