handle missing customer records without erroring out
[freeside.git] / httemplate / search / cust_bill.html
index 27b1471..3a5db35 100755 (executable)
                  sub { sprintf('$%.2f', shift->charged     ) },
                  sub { time2str('%b %d %Y', shift->_date ) },
                  sub { my $cust_main = shift->cust_main;
-                       $cust_main->get('last'). ', '. $cust_main->first;
+                       $cust_main
+                         ? $cust_main->get('last'). ', '. $cust_main->first
+                         : 'WARNING: can't find cust_main.custnum '.
+                           shift->custnum. ' (cust_bill.invnum '.
+                           shift->invnum. ')';
                      },
                  sub { my $cust_main = shift->cust_main;
-                       $cust_main->company;
+                       $cust_main ? $cust_main->company : '';
                      },
                ],
                'links' => [