diff options
author | ivan <ivan> | 2010-05-21 19:57:49 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-05-21 19:57:49 +0000 |
commit | c39c00055d9b109a7239ed10d458c84c8e61815f (patch) | |
tree | 35860476054c4caad26954b8cdc7f35670ddbfa9 | |
parent | f0097d06a2a96a49340fc2420f1713aa692d45a8 (diff) |
fix 'Use of uninitialized value' spew, fallout from RT#7266
-rw-r--r-- | FS/FS/cust_bill.pm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 2c678954f..272b1b21e 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -4320,8 +4320,7 @@ Returns an SQL fragment to retreive the amount owed (charged minus credited and =cut sub owed_sql { - my $class = shift; - my ($start, $end) = @_; + my ($class, $start, $end) = @_; 'charged - '. $class->paid_sql($start, $end). ' - '. $class->credited_sql($start, $end); @@ -4334,8 +4333,7 @@ Returns an SQL fragment to retreive the net amount (charged minus credited). =cut sub net_sql { - my $class = shift; - my ($start, $end) = @_; + my ($class, $start, $end) = @_; 'charged - '. $class->credited_sql($start, $end); } @@ -4348,7 +4346,9 @@ Returns an SQL fragment to retreive the amount paid against this invoice. sub paid_sql { my ($class, $start, $end) = @_; $start &&= "AND cust_bill_pay._date <= $start"; - $end &&= "AND cust_bill_pay._date > $end"; + $end &&= "AND cust_bill_pay._date > $end"; + $start = '' unless defined($start); + $end = '' unless defined($end); "( SELECT COALESCE(SUM(amount),0) FROM cust_bill_pay WHERE cust_bill.invnum = cust_bill_pay.invnum $start $end )"; } @@ -4362,7 +4362,9 @@ Returns an SQL fragment to retreive the amount credited against this invoice. sub credited_sql { my ($class, $start, $end) = shift; $start &&= "AND cust_credit_bill._date <= $start"; - $end &&= "AND cust_credit_bill._date > $end"; + $end &&= "AND cust_credit_bill._date > $end"; + $start = '' unless defined($start); + $end = '' unless defined($end); "( SELECT COALESCE(SUM(amount),0) FROM cust_credit_bill WHERE cust_bill.invnum = cust_credit_bill.invnum $start $end )"; } |