Mechanic Posted January 19, 2021 Share Posted January 19, 2021 Hi, I want to open a ticket automatically when an invoice becomes overdue. I do not need this for all products/services. I only need to open a ticket for a few products/services or a for a single product group. Any help and suggestion is welcome. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted January 21, 2021 Share Posted January 21, 2021 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. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 21, 2021 Share Posted January 21, 2021 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. 0 Quote Link to comment Share on other sites More sharing options...
Mechanic Posted January 21, 2021 Author Share Posted January 21, 2021 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. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted January 21, 2021 Share Posted January 21, 2021 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. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 22, 2021 Share Posted January 22, 2021 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. 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.