summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-10-08 05:44:40 +0000
committerivan <ivan>2009-10-08 05:44:40 +0000
commitbb8d487a57a75d8d55c89c5f7cb593c4bfeace85 (patch)
treed7a8094b1af886f8674ada1c4d8e05d646a43673
parent033f562f4e0b2a1bacf096f3e8f8c99590469dcf (diff)
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.
-rw-r--r--FS/FS/cust_bill.pm4
-rw-r--r--FS/FS/cust_main.pm12
2 files changed, 12 insertions, 4 deletions
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<FS::cust_bill>) 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<FS::cust_statement>) 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<FS::cust_credit>) 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<FS::cust_pay_void>) 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<FS::cust_pay_void>) 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<FS::cust_refund>) 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 } )
}