rebuke Posted March 31, 2011 Share Posted March 31, 2011 At present it seems the DailyCronJob hook is called *after* WHMCS has done its normal daily cron stuff. Does anybody know if it's possible to get it called *before* this happens, or if there's another undocumented hook or whatever? Basically what I'm trying to do is add a billable item set to appear on next invoice, such that when WHMCS generates the invoice it will automagically have the item on it (this is for VoIP call charges, which are a very variable amount etc). I could do it by having a separate cron job that kicks off something that uses e.g. the API and ensure that runs before the WHMCS cron job, but that seems a bit of an ugly solution to me that's liable to go wrong... 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 31, 2011 Share Posted March 31, 2011 You could probably use the "InvoiceCreationPreEmail" hook point to alter the invoice before it is sent as an email 0 Quote Link to comment Share on other sites More sharing options...
rebuke Posted March 31, 2011 Author Share Posted March 31, 2011 I was just looking at that as an option - do you know if it's possible to use an API function from within an action hook (in a nice way - obviously I could just stick a CURL request in or whatever, but that seems mad), as using the UpdateInvoice API would seem the 'nicest' way to add an item to the invoice (since it will then presumably handle updating the totals etc for me rather than having to manipulate lots of SQL tables etc)? The other option I looked at was creating a module that has an UpdateUsage function, but even that appears to be called *after* the invoices have been generated... 0 Quote Link to comment Share on other sites More sharing options...
atDev Posted March 31, 2011 Share Posted March 31, 2011 Hi, Using the API via CURL in the hooks is a bit cumbersome but I just wanted to add that is the way we currently do it and it works fine. 0 Quote Link to comment Share on other sites More sharing options...
Chrisw Posted March 31, 2011 Share Posted March 31, 2011 why not do this: 1.) remove WHMCS cron 2.) Create a wrapper script for the cron 3.) execute your code first 4.) execute WHMCS cron file 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.