Jump to content

Ticket piping hook not working. please help


jerect

Recommended Posts

hi!, i am doing some customization on the ticket system to set a limit of tickets per moths,. i have done the client area and admin part. but the piping hook to avoid import an email when the counter is set to a certain number. does not work, i am a beginner at this, and sorry about my english i'm from Colombia.

please can you help me with this code, it imports every email no matter what and increment the count by 2 and not 1, as it should be:

add_hook('TicketPiping', 1, function($vars) {
$clienteid = Capsule::table('tblclients')->where('email', '=',$vars['email'])->value('id');
$producto = Capsule::table('tblhosting')->where('userid', $clienteid)->value('packageid');
$count = Capsule::table('tblticketlimits')->where('id', $clienteid)->value('count');
if ($producto == 3){
Capsule::table('tblticketlimits')->where('id', $clienteid)->increment('count',1);

Return $skipProcessing = false;
}
else if ($producto == 4 ){
Capsule::table('tblticketlimits')->where('id', $clienteid)->increment('count',1);

Return $skipProcessing = false;

}
else if ($producto == 5 && $count < 20){
Capsule::table('tblticketlimits')->where('id', $clienteid)->increment('count',1);

Return $skipProcessing = false;

}
else {

Return $skipProcessing = true;
}


});

thank you so much.

Link to comment
Share on other sites

the problem of increment by 2 was solved. it was because i was incrementing on openticketadmin hook too. but avoid to import a ticket based on product and count in a table is not working yet.

add_hook('TicketPiping', 1, function($vars) { 
$clienteid = Capsule::table('tblclients')->where('email', '=',$vars['email'])->value('id'); 
$producto = Capsule::table('tblhosting')->where('userid', $clienteid)->value('packageid'); 
$count = Capsule::table('tblticketlimits')->where('id', $clienteid)->value('count'); 
if ($producto ==  3 and $count >=10){ 

   Return $skipProcessing = true; 
} 
else if ($producto == 4 and $count >=15){ 

   Return  $skipProcessing = true; 

} 
else if ($producto == 5 and $count >=20){ 

    Return $skipProcessing = true; 
} 
else { 

   Return $skipProcessing = false; 
} 


});  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated