jerect Posted January 28, 2017 Share Posted January 28, 2017 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. 0 Quote Link to comment Share on other sites More sharing options...
jerect Posted January 28, 2017 Author Share Posted January 28, 2017 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; } }); 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.