diff options
author | ivan <ivan> | 2008-05-30 03:55:52 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-05-30 03:55:52 +0000 |
commit | 35571f30f46e8743b54fcb887fbc4fdeca2d7a33 (patch) | |
tree | d6fd9f401dfce24ddf29d0c73fb9fa10061bd16e | |
parent | 44353b07fd20146fbb8145680bd16d54e76178ad (diff) |
1.7 sucks. add a "balance over" option to the 1.7 style agent-specific invoice send event
-rw-r--r-- | FS/FS/cust_bill.pm | 8 | ||||
-rwxr-xr-x | httemplate/edit/part_bill_event.cgi | 13 |
2 files changed, 20 insertions, 1 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 3f5a4ea57..8c17efa19 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -750,6 +750,9 @@ single agent) or an arrayref of agentnums. INVOICE_FROM, if specified, overrides the default email invoice From: address. +AMOUNT, if specified, only sends the invoice if the total amount owed on this +invoice and all older invoices is greater than the specified amount. + =cut sub queueable_send { @@ -780,6 +783,11 @@ sub send { ? shift : ( $self->_agent_invoice_from || $conf->config('invoice_from') ); + my $balance_over = ( scalar(@_) && $_[0] !~ /^\s*$/ ) ? shift : 0; + + return '' + unless $self->cust_main->total_owed_date($self->_date) > $balance_over; + my @invoicing_list = $self->cust_main->invoicing_list; $self->email($template, $invoice_from) diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 3b6b06b92..7c4b8a8f5 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -252,7 +252,11 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % % 'send_agent' => { % 'name' => 'Send invoice (email/print/fax) ', -% 'code' => '$cust_bill->send(\'%%%agent_templatename%%%\', [ %%%agentnum%%% ], \'%%%agent_invoice_from%%%\');', +% 'code' => '$cust_bill->send( \'%%%agent_templatename%%%\', +% [ %%%agentnum%%% ], +% \'%%%agent_invoice_from%%%\', +% %%%agent_balanceover%%% +% );', % 'html' => sub { % '<TABLE BORDER=0> % <TR> @@ -271,6 +275,13 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % <INPUT TYPE="text" NAME="agent_invoice_from" VALUE="%%%agent_invoice_from%%%"> % </TD> % </TR> +% <TR> +% <TD ALIGN="right">if balance (this invoice and previous) over +% </TD> +% <TD> +% '. $money_char. '<INPUT TYPE="text" SIZE="7" NAME="agent_balanceover" VALUE="%%%agent_balanceover%%%"> +% </TD> +% </TR> % </TABLE>'; % }, % 'weight' => 50, |