Jump to content

Not send invoice reminders for invoices over a certain value


webfrogstudios

Recommended Posts

Hi Guys & Gals,

 

I have a situation where in my WHMCS I don't want reminders to be sent for any invoices over $1400

 

We build websites as well as providing hosting so we want our hosting invoices to go out automatically but the invoices for our websites do not have a fixed due date :P

 

Can anyone think of a solution for me? Basically I don't want automatic reminders to be sent for any invoices over $1400 across the board,

 

I look forward to hearing any suggestions,

 

Thanks in advance

Link to comment
Share on other sites

Use the EmailPreSend hook.

 

Target your invoice reminder email template name, should be "Invoice Payment Reminder"

 

$vars['messagename'] holds the email template name for the mail being sent

$vars['relid'] holds the invoice ID for the reminder mail.

 

So, check the messagename var and see if it holds the "Invoice Payment Reminder" value.

If so, make an sql query or internal getinvoice API call to get the invoice total amount.

 

If total is > 1400, abort by returning $merge_fields['abortsend'] = true;

 

Done

 

Yes, i'm lazy today so...no code, sorry :)

Link to comment
Share on other sites

Use the EmailPreSend hook.

 

Target your invoice reminder email template name, should be "Invoice Payment Reminder"

 

$vars['messagename'] holds the email template name for the mail being sent

$vars['relid'] holds the invoice ID for the reminder mail.

 

So, check the messagename var and see if it holds the "Invoice Payment Reminder" value.

If so, make an sql query or internal getinvoice API call to get the invoice total amount.

 

If total is > 1400, abort by returning $merge_fields['abortsend'] = true;

 

Done

 

Yes, i'm lazy today so...no code, sorry :)

 

Thanks Mbit,

 

Okay so i add a php file into the includes/hooks/ folder and that is where i place the code?

 

Excuse me if i sound ignorant ... its because i am :P as i have never modified WHMCS before.

 

I am going to take a punt here ....

 


if (!defined("WHMCS"))
   die("This file cannot be accessed directly");

function dont_send_over_value($vars) {

    $check_template = 'Invoice Payment Reminder';
    $this_template = $vars['messagename'];

    if($this_template == $check_template){


    $invoice_num = $vars['relid'];


  //api call to get invoice amount based on above id ... stuck here no idea how to use the api results xml
      $invoice_amount = //RESULT ABOVE

                      if($invoice_amount > 1399) {
                      $merge_fields['abortsend'] = true;
                       }

      }




}

add_hook("EmailPreSend",1,"dont_send_over_value");

 

The above may be totally and utterly wrong but at least i tried :P

 

Please throw me a bone ? :P

 

Thanks again

Link to comment
Share on other sites

  • 8 months later...

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