aperture Posted September 29, 2021 Share Posted September 29, 2021 Hi, I am looking for a way to determine the source of a new invoice. That being is the new invoice generated by a client action, like ordering a service. Or if it simply is generated by billing. Testing the InvoiceCreated hook for invoiceID gives us the new invoice number. However it is not possible to check this invoiceID against database tables. This seems to be because the invoice has yet to be finalized. Else we could have checked if the invoiceID was located in both tblorders.invoiceid and tblinvoices.id. Any match on both tables would indicate it was an order, and should there only be a match in tblinvoices.id it would be simply billing. Next we have the source variable, there it seems to be mainly autogen being used. I did check the classdoc for Invoice, there we have a runCreationHooks method with a String $source parameter, with 4 possible options: 'adminarea', 'api', 'autogen' or 'clientarea'. Now the whmcs hook InvoiceCreated states that the only values it will return are one of 'adminarea', 'api', 'autogen' or 'clientarea'. Does anyone have any tips, or have you perhaps dealt with this issue and found a way? 0 Quote Link to comment Share on other sites More sharing options...
aperture Posted September 30, 2021 Author Share Posted September 30, 2021 I should also mention that we are trying to determine this at the time of invoice creation, so we can edit lines depending on invoice source among other things. 0 Quote Link to comment Share on other sites More sharing options...
RadWebHosting Posted October 15, 2021 Share Posted October 15, 2021 Yo u should check the logs to see when the invoice was created (i.e. whether during your cron) 0 Quote Link to comment Share on other sites More sharing options...
aperture Posted October 19, 2021 Author Share Posted October 19, 2021 On 10/15/2021 at 2:19 PM, radwebhosting said: Yo u should check the logs to see when the invoice was created (i.e. whether during your cron) Thank you for your reply. The solution we landed on was comparing date to duedate- 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.