avoid some (look to be harmless) warnings:
[freeside.git] / FS / FS / cust_bill.pm
index 961d86e..ac1e450 100644 (file)
@@ -521,6 +521,7 @@ Returns all payment applications (see L<FS::cust_bill_pay>) for this invoice.
 
 sub cust_bill_pay {
   my $self = shift;
+  map { $_ } #return $self->num_cust_bill_pay unless wantarray;
   sort { $a->_date <=> $b->_date }
     qsearch( 'cust_bill_pay', { 'invnum' => $self->invnum } );
 }
@@ -535,6 +536,7 @@ Returns all applied credits (see L<FS::cust_credit_bill>) for this invoice.
 
 sub cust_credited {
   my $self = shift;
+  map { $_ } #return $self->num_cust_credit_bill unless wantarray;
   sort { $a->_date <=> $b->_date }
     qsearch( 'cust_credit_bill', { 'invnum' => $self->invnum } )
   ;
@@ -553,6 +555,7 @@ with matching pkgnum.
 
 sub cust_bill_pay_pkgnum {
   my( $self, $pkgnum ) = @_;
+  map { $_ } #return $self->num_cust_bill_pay_pkgnum($pkgnum) unless wantarray;
   sort { $a->_date <=> $b->_date }
     qsearch( 'cust_bill_pay', { 'invnum' => $self->invnum,
                                 'pkgnum' => $pkgnum,
@@ -562,6 +565,8 @@ sub cust_bill_pay_pkgnum {
 
 =item cust_credited_pkgnum PKGNUM
 
+=item cust_credit_bill_pkgnum PKGNUM
+
 Returns all applied credits (see L<FS::cust_credit_bill>) for this invoice
 with matching pkgnum.
 
@@ -569,6 +574,7 @@ with matching pkgnum.
 
 sub cust_credited_pkgnum {
   my( $self, $pkgnum ) = @_;
+  map { $_ } #return $self->num_cust_credit_bill_pkgnum($pkgnum) unless wantarray;
   sort { $a->_date <=> $b->_date }
     qsearch( 'cust_credit_bill', { 'invnum' => $self->invnum,
                                    'pkgnum' => $pkgnum,
@@ -576,6 +582,10 @@ sub cust_credited_pkgnum {
            );
 }
 
+sub cust_credit_bill_pkgnum {
+  shift->cust_credited_pkgnum(@_);
+}
+
 =item tax
 
 Returns the tax amount (see L<FS::cust_bill_pkg>) for this invoice.
@@ -1065,7 +1075,7 @@ sub send {
     }
     $invoice_from = $opt->{'invoice_from'};
     $balance_over = $opt->{'balance_over'} if $opt->{'balance_over'};
-    $notice_name = $opt=>{'notice_name'};
+    $notice_name = $opt->{'notice_name'};
   } else {
     $template = scalar(@_) ? shift : '';
     if ( scalar(@_) && $_[0]  ) {
@@ -2345,8 +2355,8 @@ sub print_generic {
 #  my( $cr_total, @cr_cust_credit ) = $self->cust_credit; #credits
   #my $balance_due = $self->owed + $pr_total - $cr_total;
   my $balance_due = $self->owed + $pr_total;
-  $invoice_data{'true_previous_balance'} = sprintf("%.2f", $self->previous_balance);
-  $invoice_data{'balance_adjustments'} = sprintf("%.2f", $self->previous_balance - $self->billing_balance);
+  $invoice_data{'true_previous_balance'} = sprintf("%.2f", ($self->previous_balance || 0) );
+  $invoice_data{'balance_adjustments'} = sprintf("%.2f", ($self->previous_balance || 0) - ($self->billing_balance || 0) );
   $invoice_data{'previous_balance'} = sprintf("%.2f", $pr_total);
   $invoice_data{'balance'} = sprintf("%.2f", $balance_due);