From: ivan Date: Thu, 8 Oct 2009 05:44:40 +0000 (+0000) Subject: avoid some (look to be harmless) warnings: X-Git-Tag: root_of_svc_elec_features~798 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=bb8d487a57a75d8d55c89c5f7cb593c4bfeace85 avoid some (look to be harmless) warnings: Argument "" isn't numeric in sprintf at /usr/local/share/perl/5.10.0/FS/cust_bill.pm line 2358. Argument "" isn't numeric in subtraction (-) at /usr/local/share/perl/5.10.0/FS/cust_bill.pm line 2359. Argument "" isn't numeric in addition (+) at /usr/local/share/perl/5.10.0/FS/cust_main.pm line 2788. --- diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 861bb4cd7..ac1e450d8 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -2355,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); diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 638036a15..8ec12757a 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2782,8 +2782,8 @@ sub bill { my @cust_bill = $self->cust_bill; my $balance = $self->balance; my $previous_balance = scalar(@cust_bill) - ? $cust_bill[$#cust_bill]->billing_balance - : 0; + ? ( $cust_bill[$#cust_bill]->billing_balance || 0 ) + : 0; $previous_balance += $cust_bill[$#cust_bill]->charged if scalar(@cust_bill); @@ -7306,6 +7306,7 @@ Returns all the invoices (see L) for this customer. sub cust_bill { my $self = shift; + map { $_ } #return $self->num_cust_bill unless wantarray; sort { $a->_date <=> $b->_date } qsearch('cust_bill', { 'custnum' => $self->custnum, } ) } @@ -7337,6 +7338,7 @@ Returns all the statements (see L) for this customer. sub cust_statement { my $self = shift; + map { $_ } #return $self->num_cust_statement unless wantarray; sort { $a->_date <=> $b->_date } qsearch('cust_statement', { 'custnum' => $self->custnum, } ) } @@ -7349,6 +7351,7 @@ Returns all the credits (see L) for this customer. sub cust_credit { my $self = shift; + map { $_ } #return $self->num_cust_credit unless wantarray; sort { $a->_date <=> $b->_date } qsearch( 'cust_credit', { 'custnum' => $self->custnum } ) } @@ -7362,6 +7365,7 @@ package when using experimental package balances. sub cust_credit_pkgnum { my( $self, $pkgnum ) = @_; + map { $_ } #return $self->num_cust_credit_pkgnum($pkgnum) unless wantarray; sort { $a->_date <=> $b->_date } qsearch( 'cust_credit', { 'custnum' => $self->custnum, 'pkgnum' => $pkgnum, @@ -7406,6 +7410,7 @@ package when using experimental package balances. sub cust_pay_pkgnum { my( $self, $pkgnum ) = @_; + map { $_ } #return $self->num_cust_pay_pkgnum($pkgnum) unless wantarray; sort { $a->_date <=> $b->_date } qsearch( 'cust_pay', { 'custnum' => $self->custnum, 'pkgnum' => $pkgnum, @@ -7421,6 +7426,7 @@ Returns all voided payments (see L) for this customer. sub cust_pay_void { my $self = shift; + map { $_ } #return $self->num_cust_pay_void unless wantarray; sort { $a->_date <=> $b->_date } qsearch( 'cust_pay_void', { 'custnum' => $self->custnum } ) } @@ -7433,6 +7439,7 @@ Returns all batched payments (see L) for this customer. sub cust_pay_batch { my $self = shift; + map { $_ } #return $self->num_cust_pay_batch unless wantarray; sort { $a->paybatchnum <=> $b->paybatchnum } qsearch( 'cust_pay_batch', { 'custnum' => $self->custnum } ) } @@ -7480,6 +7487,7 @@ Returns all the refunds (see L) for this customer. sub cust_refund { my $self = shift; + map { $_ } #return $self->num_cust_refund unless wantarray; sort { $a->_date <=> $b->_date } qsearch( 'cust_refund', { 'custnum' => $self->custnum } ) }