Jump to content

Automatically Open Ticket When Invoice is Overdue


Mechanic

Recommended Posts

On 19/01/2021 at 20:53, Mechanic said:

I want to open a ticket automatically when an invoice becomes overdue.

to the user or an admin ?

11 hours ago, steven99 said:

Don't think there is a hook for when WHMCS declares an invoice overdue, so a cron hook that checks any unpaid invoice if past the due date and if so takes action would be one method. 

my first thought too... another way, if WHMCS is sending overdue invoice reminders to the users, would be to use a hook to let those emails )or at least the first) trigger the ticket creation.

Link to comment
Share on other sites

14 hours ago, steven99 said:

Don't think there is a hook for when WHMCS declares an invoice overdue, so a cron hook that checks any unpaid invoice if past the due date and if so takes action would be one method. 

 

1 hour ago, brian! said:

my first thought too... another way, if WHMCS is sending overdue invoice reminders to the users, would be to use a hook to let those emails )or at least the first) trigger the ticket creation.

 

Thank you for those ideas. Do you think email templates can be used on a per service basis, and a custom date can be added? For example, a notice that says the service will be suspended on the due date + 5days  and terminated on the suspension date + 15 days ?

 

 

1 hour ago, brian! said:

to the user or an admin ?

 

To the user. 

Link to comment
Share on other sites

3 hours ago, brian! said:

if WHMCS is sending overdue invoice reminders to the users, would be to use a hook to let those emails )or at least the first) trigger the ticket creation.

That is actually a better idea as the cron method would need some way to track if a ticket was opened.   Using InvoicePaymentReminder may work but could potentially open multiple tickets unless method of tracking is done.   Another would be to use EmailPreSend and check the messagename to see if it is a second or third reminder or whenever you want to open the ticket. 

Link to comment
Share on other sites

20 hours ago, Mechanic said:

Do you think email templates can be used on a per service basis, and a custom date can be added?

yes (with some effort) and yes.

20 hours ago, Mechanic said:

For example, a notice that says the service will be suspended on the due date + 5days  and terminated on the suspension date + 15 days ?

on any invoice email template, you should be able to do that directly in the template itself - and it shouldn't break the Smarty Security Policy in doing so.

Due Date: {$invoice_date_due}
Suspension Date: {"$invoice_date_due +5 Days"|date_format:'Y-m-d'}
Termination Date: {"$invoice_date_due +20 Days"|date_format:'Y-m-d'}

there would be two further problems that I think you would have to address - firstly, changing the date format to suit your WHMCS date format - e.g dd/mm/yy, mm/dd/yy or whatever) and second the conditionality that this content only applies to certain products...

if you're going to do this in the template, then you might be able to do it by looping through the $invoice_items array and seeing if your product's name is in one of the descriptions - though I suspect that would require you to use strstr and that would need to be added as a valid option to the Smarty Security Policy (not difficult)...

if that's not an option, then you might need to use a hook, get the service id of each hosting product on the invoice (assuming don't need to check domains, addons etc) and then use the service id to get the product ID and if product found, return a boolean variable to be used with an if statement in the template.

out of curiosity, if WHMCS is sending email overdue reminders, why do you want to open a ticket to them too ? I would have thought the user receiving email reminder(s) and seeing the reminders/notifications in the client area too should be enough.

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