summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorivan <ivan>2003-04-01 01:22:31 +0000
committerivan <ivan>2003-04-01 01:22:31 +0000
commitd32d042f8a318c47a3d1d958409374b58181e79d (patch)
tree230bbe277acf7ed45d14b1999530e28ccf5c0d22 /FS/FS
parent5cd4431111f10bd75ef7abebaf995f6b9c84231f (diff)
correct last_bill problems with $0 invoice (non-existant) edge cases
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/cust_main.pm2
-rw-r--r--FS/FS/cust_pkg.pm4
2 files changed, 6 insertions, 0 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index f8578f901..c5a5982d3 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -1005,6 +1005,8 @@ sub bill {
# only for figuring next bill date, nothing else, so, reset $sdate again
# here
$sdate = $cust_pkg->bill || $cust_pkg->setup || $time;
+ $cust_pkg->last_bill($sdate)
+ if $cust_pkg->dbdef_table->column('last_bill');
$mon += $part_pkg->freq;
until ( $mon < 12 ) { $mon -= 12; $year++; }
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 5132abecf..8529e08ca 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -477,6 +477,10 @@ Useful for billing metered services.
sub last_bill {
my $self = shift;
+ if ( $self->dbdef_table->column('manual_flag') ) {
+ return $self->setfield('last_bill', $_[1]) if @_;
+ return $self->getfield('last_bill') if $self->getfield('last_bill');
+ }
my $cust_bill_pkg = qsearchs('cust_bill_pkg', { 'pkgnum' => $self->pkgnum,
'edate' => $self->bill, } );
$cust_bill_pkg ? $cust_bill_pkg->sdate : $self->setup || 0;