Craig Brass Systems Forum: AutoEmail bug - Craig Brass Systems Forum

Jump to content

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

AutoEmail bug including fix

#1
User is offline   dylan.lindgren 

  • Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 30-July 09
Hey all,

For some reason the the Autoemail option in the API wasn't working for me correctly. It didnt matter if i put TRUE or FALSE as the parameter for SendAuto, it still sent the email. I delved into the code behind it and found this line which toggles whether to send an Autoemail or not.

CODE
$ticketIdData = @createTicket(POST_CLIENT, 0, $userId, $fullName, $email, $subject, $message, '0', $priorityId, $_SWIFT['tgroup']['ticketstatusid'], $departmentId, 0, $_SWIFT['language']['charset'], '', $_SWIFT['tgroup']['tgroupid'], false, $attachments, ($sendAuto?'true':'false'));


I thought that in-line if statement about the $sendAuto variable looked weird so I broke it out as its own seperate if statement

CODE
if($sendAuto):
   $sendAuto = true;
else:
   $sendAuto = false;
endif;
        
$ticketIdData = @createTicket(POST_CLIENT, 0, $userId, $fullName, $email, $subject, $message, '0', $priorityId, $_SWIFT['tgroup']['ticketstatusid'], $departmentId, 0, $_SWIFT['language']['charset'], '', $_SWIFT['tgroup']['tgroupid'], false, $attachments, $sendAuto);


and its now working for me

I dont know if its a problem with my PHP environment or what, but if its happening to me it could be happening to others so I thought i'd give you a heads up.

Thanks,

Dylan.
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
Hm, well spotted. The actual problem was that the inline statement (ternary operator) was putting true or false into a string, and strings nearly always evaluate to true (only exceptions are empty strings and strings containing a single character of 0). I will fix it and release a new version later today smile.gif

Thanks for bringing this to our attention.
Andrew Gillard
Lead Developer - Craig Brass Systems
0

#3
User is offline   Andrew Gillard 

  • Staff - Lead Developer
  • Pip
  • Group: Developers
  • Posts: 97
  • Joined: 04-March 07
  • Gender:Male
  • Location:Basingstoke, United Kingdom
I've now updated our released version to include this fix. Please see the Details & Download topic.
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