[freeside-commits] freeside/FS/FS cust_bill.pm,1.364,1.365

Ivan,,, ivan at wavetail.420.am
Thu Dec 1 12:05:26 PST 2011


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

Modified Files:
	cust_bill.pm 
Log Message:
don't email HTML invoice when invoice_email_pdf_note is on, RT#15425

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.364
retrieving revision 1.365
diff -u -w -d -r1.364 -r1.365
--- cust_bill.pm	29 Nov 2011 01:23:16 -0000	1.364
+++ cust_bill.pm	1 Dec 2011 20:05:23 -0000	1.365
@@ -1045,6 +1045,17 @@
       'Disposition' => 'inline',
     );
 
+
+    my $htmldata;
+    my $image = '';
+    my $barcode = '';
+    if ( $conf->exists('invoice_email_pdf')
+         and scalar($conf->config('invoice_email_pdf_note')) ) {
+
+      $htmldata = join('<BR>', $conf->config('invoice_email_pdf_note') );
+
+    } else {
+
     $args{'from'} =~ /\@([\w\.\-]+)/;
     my $from = $1 || 'example.com';
     my $content_id = join('.', rand()*(2**32), $$, time). "\@$from";
@@ -1061,7 +1072,7 @@
     }
     my $image_data = $conf->config_binary( $logo, $agentnum);
 
-    my $image = build MIME::Entity
+      $image = build MIME::Entity
       'Type'       => 'image/png',
       'Encoding'   => 'base64',
       'Data'       => $image_data,
@@ -1069,7 +1080,6 @@
       'Content-ID' => "<$content_id>",
     ;
    
-    my $barcode;
     if($conf->exists('invoice-barcode')){
 	my $barcode_content_id = join('.', rand()*(2**32), $$, time). "\@$from";
 	$barcode = build MIME::Entity
@@ -1082,6 +1092,9 @@
 	$opt{'barcode_cid'} = $barcode_content_id;
     }
 
+      $htmldata = $self->print_html({ 'cid'=>$content_id, %opt });
+    }
+
     $alternative->attach(
       'Type'        => 'text/html',
       'Encoding'    => 'quoted-printable',
@@ -1092,7 +1105,7 @@
                          '    </title>',
                          '  </head>',
                          '  <body bgcolor="#e8e8e8">',
-                         $self->print_html({ 'cid'=>$content_id, %opt }),
+                         $htmldata,
                          '  </body>',
                          '</html>',
                        ],
@@ -1100,6 +1113,7 @@
       #'Filename'    => 'invoice.pdf',
     );
 
+
     my @otherparts = ();
     if ( $cust_main->email_csv_cdr ) {
 
@@ -1138,7 +1152,7 @@
 
       $related->add_part($alternative);
 
-      $related->add_part($image);
+      $related->add_part($image) if $image;
 
       my $pdf = build MIME::Entity $self->mimebuild_pdf(\%opt);
 
@@ -1154,10 +1168,9 @@
       #   image/png
 
       $return{'content-type'} = 'multipart/related';
-      if($conf->exists('invoice-barcode')){
+      if ($conf->exists('invoice-barcode') && $barcode) {
 	  $return{'mimeparts'} = [ $alternative, $image, $barcode, @otherparts ];
-      }
-      else {
+      } else {
 	  $return{'mimeparts'} = [ $alternative, $image, @otherparts ];
       }
       $return{'type'} = 'multipart/alternative'; #Content-Type of first part...



More information about the freeside-commits mailing list