[freeside-commits] branch FREESIDE_4_BRANCH updated. 15acedbdf2547c1e55ea401ed1a1c1b09cc5b181

Mitch Jackson mitch at freeside.biz
Fri Nov 30 22:43:35 PST 2018


The branch, FREESIDE_4_BRANCH has been updated
       via  15acedbdf2547c1e55ea401ed1a1c1b09cc5b181 (commit)
      from  38b78f9f4485e5d6cc81377115c3ffe3b414d87c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 15acedbdf2547c1e55ea401ed1a1c1b09cc5b181
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Sat Dec 1 01:01:03 2018 -0500

    RT# 81830 Critical log event for corrupted invoice data

diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index ba36d9ef2..2b518d9d7 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -26,6 +26,7 @@ use FS::pkg_category;
 use FS::pkg_class;
 use FS::invoice_mode;
 use FS::L10N;
+use FS::Log;
 
 $DEBUG = 0;
 $me = '[FS::Template_Mixin]';
@@ -3462,6 +3463,27 @@ sub _items_cust_bill_pkg {
           if $DEBUG > 1;
  
         my $cust_pkg = $cust_bill_pkg->cust_pkg;
+
+        unless ( $cust_pkg ) {
+          # There is no related row in cust_pkg for this cust_bill_pkg.pkgnum.
+          # This invoice may have been broken by an unusual combination
+          # of manually editing package dates, and aborted package changes
+          # when the manually edited dates used are nonsensical.
+
+          my $error = sprintf
+            'cust_bill_pkg(billpkgnum:%s) '.
+            'is missing related row in cust_pkg(pkgnum:%s)! '.
+            'cust_bill(invnum:%s) is corrupted by bad database data, '.
+            'and should be investigated',
+              $cust_bill_pkg->billpkgnum,
+              $cust_bill_pkg->pkgnum,
+              $cust_bill_pkg->invnum;
+
+          FS::Log->new('FS::cust_bill_pkg')->critical( $error );
+          warn $error;
+          next;
+        }
+
         my $part_pkg = $cust_pkg->part_pkg;
 
         # which pkgpart to show for display purposes?

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Template_Mixin.pm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)




More information about the freeside-commits mailing list