Jump to content

Discerning Renewal Invoices from New Order Invoices in hooks


Hal9000

Recommended Posts

Hi there!

I am faced with a problem I don't really know how to solve.

Under some circumstances, I want the "Invoice Created" email not to be sent. For this, I am using the "EmailPreSend" hook. So far, so good.
However, inside the hook I need a way to determine if the invoice (which I can get through $vars['relid']) was created from a new order, or if it was created via daily cron for renewal of services.

My first attempt, which seemed logical, was to check if there is an order with the invoiceid set in the "tblorders" table. Sadly, I found out that this column only gets set AFTER the invoice creation email is being sent.

Any ideas how I could get the information I need, or am I doomed?

Link to comment
Share on other sites

  • 4 weeks later...

There is a renewals field on the tblorders, if that's filled in it's a domain renewal 🙂

Although I think you're using "renewal" to mean more than just domains - the recurring / next invoice for servcies etc - in which case, you'd really only know by checking if it's the 1st invoice for that id

i.e. (tblhosting/tbldomains/tblupgrades/etc).orderid=tblorders.id 

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