From 6cd950830fa622fa6cbe87895dc58fb1c9868eef Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 Jun 2005 05:34:07 +0000 Subject: [PATCH] add multiple agent selection to agent-specific invoicing --- FS/FS/cust_bill.pm | 8 ++++++-- FS/FS/part_bill_event.pm | 2 +- httemplate/edit/part_bill_event.cgi | 11 ++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index f090978ca..a9bb7452b 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -550,7 +550,8 @@ emails or print. See L. TEMPLATENAME, if specified, is the name of a suffix for alternate invoices. AGENTNUM, if specified, means that this invoice will only be sent for customers -of the specified agent. +of the specified agent or agent(s). AGENTNUM can be a scalar agentnum (for a +single agent) or an arrayref of agentnums. INVOICE_FROM, if specified, overrides the default email invoice From: address. @@ -559,7 +560,10 @@ INVOICE_FROM, if specified, overrides the default email invoice From: address. sub send { my $self = shift; my $template = scalar(@_) ? shift : ''; - return 'N/A' if scalar(@_) && $_[0] && $self->cust_main->agentnum != shift; + if ( scalar(@_) && $_[0] ) { + my $agentnums = ref($_[0]) ? shift : [ shift ]; + return 'N/A' unless grep { $_ == $self->cust_main->agentnum } @$agentnums; + } my $invoice_from = scalar(@_) diff --git a/FS/FS/part_bill_event.pm b/FS/FS/part_bill_event.pm index 0d03ebf29..5731f7883 100644 --- a/FS/FS/part_bill_event.pm +++ b/FS/FS/part_bill_event.pm @@ -126,7 +126,7 @@ sub check { or $c =~ /^\s*\$cust_bill\->(comp|realtime_(card|ach|lec)|batch_card|send)\(\);\s*$/ - or $c =~ /^\s*\$cust_bill\->send(_if_newest)?\(\'[\w\-\s]+\'\s*(,\s*\d+\s*,\s*'[\w\@\.\-\+]*'\s*)?\);\s*$/ + or $c =~ /^\s*\$cust_bill\->send(_if_newest)?\(\'[\w\-\s]+\'\s*(,\s*(\d+|\[\s*\d+(,\s*\d+)*\s*\])\s*,\s*'[\w\@\.\-\+]*'\s*)?\);\s*$/ or $c =~ /^\s*\$cust_main\->apply_payments; \$cust_main->apply_credits; "";\s*$/ diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 99bc2609f..06bdaf647 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -83,11 +83,12 @@ sub select_pkgpart { sub select_agentnum { my $plandata = shift; - my $agentnum = $plandata->{'agentnum'}; - ''. join("\n", map { '