YeapGuy Posted April 28, 2020 Share Posted April 28, 2020 Hello, How would I go about bot having orders automatically provisioned when there's an order note? I feel like this should be pretty easy but can't figure out how to do it. 0 Quote Link to comment Share on other sites More sharing options...
YeapGuy Posted April 30, 2020 Author Share Posted April 30, 2020 Bump 0 Quote Link to comment Share on other sites More sharing options...
YeapGuy Posted May 11, 2020 Author Share Posted May 11, 2020 No way to do this? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted May 11, 2020 Share Posted May 11, 2020 (edited) In PreModuleCreate hook point run a query to detect if there's a note. If the note can't be found, send abortcmd => true to stop the provisioning. Edited May 11, 2020 by Kian 0 Quote Link to comment Share on other sites More sharing options...
YeapGuy Posted May 11, 2020 Author Share Posted May 11, 2020 11 minutes ago, Kian said: In PreModuleCreate hook point run a query to detect if there's a note. If the note can't be found, send abortcmd => true to stop the provisioning. p.s. There are better ways to prevent bots from placing orders Thanks, could you provide me with more exact instructions? I'm new to this haha. And it's not for bots, I just want to leave the order for manual review if the customer wants something custom/special. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted May 11, 2020 Share Posted May 11, 2020 Begin by creating a file named as you prefer (eg. AbortCreate.php) in includes/hooks directory. The content of this file should be the following: <?php use WHMCS\Database\Capsule; add_hook('PreModuleCreate', 1, function($vars) { $Data = Capsule::select(Capsule::raw('SELECT t1.notes FROM tblorders AS t1 LEFT JOIN tblhosting AS t2 ON t1.id = t2.orderid WHERE t2.id = "' . $vars['params']['serviceid'] . '" AND t2.orderid != "0"')); if ($Data[0]->notes) { return array('abortcmd' => true); } }); Everytime Create function triggers, this hook looks for notes in the order. If the order has a note, it returns abortcmd true. This will stop the auto-provisioning of WHMCS. Keep in mind that you need further changes to my basic example. In fact unless at some point you remove the notes from the order, the script will keep aborting the provisioning. 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.