X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_pkg.pm;h=fbc67c542bcb3b5dbf5b3e84d05a96aac877f74a;hb=1b8a2cc3b3697f3921e26a31691acfabacc1efd6;hp=6bd39d4b94bcd3b1acfa1a013827544e8b61527c;hpb=794a4505360fec404e2b9d5c6daf79f750186bfe;p=freeside.git diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index 6bd39d4b9..fbc67c542 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -175,6 +175,17 @@ sub insert { } } + my $cust_tax_adjustment = $self->get('cust_tax_adjustment'); + if ( $cust_tax_adjustment ) { + $cust_tax_adjustment->billpkgnum($self->billpkgnum); + $error = $cust_tax_adjustment->replace; + warn $error; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; @@ -224,6 +235,7 @@ sub check { || $self->ut_numbern('sdate') || $self->ut_numbern('edate') || $self->ut_textn('itemdesc') + || $self->ut_textn('itemcomment') ; return $error if $error; @@ -276,6 +288,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. @@ -364,7 +393,9 @@ sub desc { if ( $self->pkgnum > 0 ) { $self->itemdesc || $self->part_pkg->pkg; } else { - $self->itemdesc || 'Tax'; + my $desc = $self->itemdesc || 'Tax'; + $desc .= ' '. $self->itemcomment if $self->itemcomment =~ /\S/; + $desc; } }