[freeside-commits] freeside/FS/FS cust_bill.pm, 1.326, 1.327 cust_pay.pm, 1.91, 1.92

Ivan,,, ivan at wavetail.420.am
Wed Mar 16 15:37:33 PDT 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv6802/FS/FS

Modified Files:
	cust_bill.pm cust_pay.pm 
Log Message:
remove separate _statement templates, RT#11912

Index: cust_pay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay.pm,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -w -d -r1.91 -r1.92
--- cust_pay.pm	7 Dec 2010 22:26:16 -0000	1.91
+++ cust_pay.pm	16 Mar 2011 22:37:31 -0000	1.92
@@ -544,7 +544,7 @@
   my $error = '';
 
   if (    ( exists($opt->{'manual'}) && $opt->{'manual'} )
-       || ! $conf->exists('invoice_html_statement')
+       #|| ! $conf->exists('invoice_html_statement')
        || ! $cust_bill
      )
   {
@@ -599,7 +599,7 @@
 
     } else {
 
-      warn "payment_receipt is on, but no payment_receipt_msgnum or invoice_html_statement is configured\n";
+      warn "payment_receipt is on, but no payment_receipt_msgnum\n";
 
     }
 
@@ -613,6 +613,8 @@
     $error = $queue->insert(
       'invnum'   => $cust_bill->invnum,
       'template' => 'statement',
+      'notice_name' => 'Statement',
+      'no_coupon'   => 1,
     );
 
   }

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.326
retrieving revision 1.327
diff -u -w -d -r1.326 -r1.327
--- cust_bill.pm	10 Mar 2011 02:40:28 -0000	1.326
+++ cust_bill.pm	16 Mar 2011 22:37:31 -0000	1.327
@@ -911,6 +911,7 @@
     'unsquelch_cdr' => $conf->exists('voip-cdr_email'),
     'template'      => $args{'template'},
     'notice_name'   => ( $args{'notice_name'} || 'Invoice' ),
+    'no_coupon'     => $args{'no_coupon'},
   );
 
   my $cust_main = $self->cust_main;
@@ -1259,11 +1260,12 @@
   my $self = qsearchs('cust_bill', { 'invnum' => $opt{invnum} } )
     or die "invalid invoice number: " . $opt{invnum};
 
-  my @args = ( $opt{template} );
-  push @args, $opt{invoice_from}
-    if exists($opt{invoice_from}) && $opt{invoice_from};
+  my %args = ( 'template' => $opt{template} );
+  $args{$_} = $opt{$_}
+    foreach grep { exists($opt{$_}) && $opt{$_} }
+              qw( invoice_from notice_name no_coupon );
 
-  my $error = $self->email( @args );
+  my $error = $self->email( \%args );
   die $error if $error;
 
 }
@@ -1272,16 +1274,18 @@
 sub email {
   my $self = shift;
 
-  my( $template, $invoice_from, $notice_name );
+  my( $template, $invoice_from, $notice_name, $no_coupon );
   if ( ref($_[0]) ) {
     my $opt = shift;
     $template = $opt->{'template'} || '';
     $invoice_from = $opt->{'invoice_from'};
     $notice_name = $opt->{'notice_name'} || 'Invoice';
+    $no_coupon = $opt->{'no_coupon'} || 0;
   } else {
     $template = scalar(@_) ? shift : '';
     $invoice_from = shift if scalar(@_);
     $notice_name = 'Invoice';
+    $no_coupon = 0;
   }
 
   $invoice_from ||= $self->_agent_invoice_from ||    #XXX should go away
@@ -1308,6 +1312,7 @@
       'subject'     => $subject,
       'template'    => $template,
       'notice_name' => $notice_name,
+      'no_coupon'   => $no_coupon,
     )
   );
   die "can't email invoice: $error\n" if $error;
@@ -2295,7 +2300,7 @@
   my $template = $params{template} ? $params{template} : $self->_agent_template;
   my $templatefile = "invoice_$format";
   $templatefile .= "_$template"
-    if length($template);
+    if length($template) && $conf->exists($templatefile."_$template");
   my @invoice_template = map "$_\n", $conf->config($templatefile)
     or die "cannot load config data $templatefile";
 
@@ -2643,7 +2648,9 @@
   warn "$me substituting variables in notes, footer, smallfooter\n"
     if $DEBUG > 1;
 
-  foreach my $include (qw( notes footer smallfooter coupon )) {
+  my @include = (qw( notes footer smallfooter ));
+  push @include, 'coupon' unless $params{'no_coupon'};
+  foreach my $include (@include) {
 
     my $inc_file = $conf->key_orbase("invoice_${format}$include", $template);
     my @inc_src;



More information about the freeside-commits mailing list