vbatra Posted June 14, 2016 Share Posted June 14, 2016 I want to set the ticket status to "Open" whenever a reply is made by an admin, I am doing so because WHMCS do not log the change in ticket status a response is made to the ticket, my idea is to force my staff to change the ticket status through the dropdown. Below is my code for it but I am getting error 500 with this code. <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function set_ticket_open($vars) { $tid = $vars['ticketid']; UPDATE `tbltickets` SET `status`="Open" WHERE `id`="$tid"; } add_hook("TicketAdminReply",1,"set_ticket_open"); ?> Can anyone help me with fixing this code or give me any other code that can log the status change in database according to the status selected during "add response". 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted June 14, 2016 Share Posted June 14, 2016 use Capsule, it's your friend <?php use Illuminate\Database\Capsule\Manager as Capsule; [color=#007700]if (![/color][color=#0000BB]defined[/color][color=#007700]([/color][color=#DD0000]"WHMCS"[/color][color=#007700])) die([/color][color=#DD0000]"This file cannot be accessed directly"[/color][color=#007700]); function [/color][color=#0000BB]set_ticket_open[/color][color=#007700]([/color][color=#0000BB]$vars[/color][color=#007700]) { [/color][color=#0000BB]$tid [/color][color=#007700]= [/color][color=#0000BB]$vars[/color][color=#007700][[/color][color=#DD0000]'ticketid'[/color][color=#007700]]; $query=Capsule::table('tbltickets')->where('[color=#DD0000]id[/color]', $tid)->update(array('status' => "Open")); } [color=#0000BB]add_hook[/color]([color=#DD0000]"TicketAdminReply"[/color],[color=#0000BB]1[/color],[color=#DD0000]"set_ticket_open"[/color]); ?> [/color] Also, as far as php errors go, you will be able to debug these by turning on display errors in admin -> setup -> general settings -> other. Just don't forget to turn that off when done. 0 Quote Link to comment Share on other sites More sharing options...
vbatra Posted June 14, 2016 Author Share Posted June 14, 2016 Thanks its working fine... 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.