Craig Brass Systems Forum: Update Ticket Properties Problem - Craig Brass Systems Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Update Ticket Properties Problem

#1
User is offline   Zac 

  • Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 28-January 09
Hey guys,

First of all, what a beautiful and well done API you guys have made. I am having some trouble updating the ticket properties for some reason. This is my code,

CODE
$paramsProps = array('user' => $user,
'password' => $pass,
'email' => 'zcarter@siue.edu',
'ticketId' => $ticketID,
'newStatus' => $_POST['ticketstatus'],
'newPriority' => $_POST['priority']
);

echo"$_POST[priority] - $_POST['ticketstatus']";

$updateProps = call_user_func_array(array('CBS_KayakoAPI','updateTicketProperties'), $paramsProps);


All values are being successfully passed such as the username, pass, ticket id, ticketstatus, and priority. I have even replaced those variables with hard-coded values like 1, 2, 3 etc.

But for some reason, this will only update the ticket status, not the priority and it throws a warning out on me.

"Warning: Invalid argument supplied for foreach() in /home/nobull/public_html/support/modules/tickets/functions_ticketcore.php on line 825"

Any idea why?

Thanks for your help! dry.gif dry.gif
0

#2
User is offline   Andrew Gillard 

  • Staff - Lead Developer
  • Pip
  • Group: Developers
  • Posts: 97
  • Joined: 04-March 07
  • Gender:Male
  • Location:Basingstoke, United Kingdom
Apologies for the delay in replying - I've been a little busy lately.

I can't, unfortunately, see anything immediately wrong with your code or ours that would stop it working. What version of Kayako are you running?

The priority-not-updating problem is curious. Our code calls the changePriority() method on an instance of the TicketMain() class - changePriority() being defined on line 1512 of /modules/tickets/functions_ticketmain.php - and I can't see any real reason why it wouldn't change the priority in that method.

As for the foreach() warning, that line is attempting to foreach over the cache of ticket statuses:
CODE
foreach ($_SWIFT["statuscache"] as $key=>$val)


One potential solution would be to rebuild that cache by using:
CODE
require_once "modules/tickets/functions_tickets.php";
rebuildStatusCache();

before we call changePriority() and changeStatus() (i.e. insert it at line 700) in integrationapi/lib/api.class.php, but I've never seen that problem in our tests, so it shouldn't really be necessary.
Andrew Gillard
Lead Developer - Craig Brass Systems
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users