Jump to content

How te tell if invoice created by automation or manual order


weba

Recommended Posts

22 hours ago, weba said:

How can I tell for sure in the hook InvoiceCreation if the hook is running from automation(generate invoices/cron) or from a customers who is ordering stuff manually ?

untested, but I would assume that under both circumstances, the source value would be "autogen" - therefore, it might be a case of checking if the invoice table row contains an Order ID value (e.g using invoice id value as a reference), working on the assumption that if the source is autogen and an order id value exists, then it's been ordered by the client... a renewal invoice shouldn't contain an order id value.

Link to comment
Share on other sites

two further thoughts on this..

  1. a client manually renewing domains might generate an autogen invoice with no order ID - so if true, that may need to be taken into account too.
  2. invoices are created daily in the cron, so this should only occur once each day  and at a specific time of day... e.g if your daily cron runs at 2pm, but an autogen invoice is created at 1:55pm, then it can't have been created by the daily cron (unless you're manipulating the cron process), and so it should be a client order... so really, I think you only have to worry about those autogen invoices created less than x minutes (depends on how many invoices are being created by the cron) after the daily cron runs.. anything before that shouldn't be cron related, and neither should anything a long time (e.g an hour) after the daily cron.
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