X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_pkg.pm;h=bb071739ef7b07b52b52f95197070836961f48ac;hp=6bd39d4b94bcd3b1acfa1a013827544e8b61527c;hb=d72073a19a37641e1f8fb888b827be9d7ac74bed;hpb=876eb5c57cbd2b6686ad875b84d9400a3418719c diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index 6bd39d4b9..bb071739e 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -276,6 +276,23 @@ sub cust_bill { qsearchs( 'cust_bill', { 'invnum' => $self->invnum } ); } +=item previous_cust_bill_pkg + +Returns the previous cust_bill_pkg for this package, if any. + +=cut + +sub previous_cust_bill_pkg { + my $self = shift; + qsearchs({ + 'table' => 'cust_bill_pkg', + 'hashref' => { 'pkgnum' => $self->pkgnum, + 'sdate' => { op=>'<', value=>$self->sdate }, + }, + 'order_by' => 'ORDER BY sdate DESC LIMIT 1', + }); +} + =item details [ OPTION => VALUE ... ] Returns an array of detail information for the invoice line item.