X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_ApplicationCommon.pm;h=ec694ca583959252c32a6ce962fef499a19ad4e3;hb=d4c01ecffef02ef160d8c367270324e3d6a1c75d;hp=24274e7017e1adef43735204be556779e3ffe66d;hpb=5e05724a635a22776f1b973f5d7e77989da4e048;p=freeside.git diff --git a/FS/FS/cust_bill_ApplicationCommon.pm b/FS/FS/cust_bill_ApplicationCommon.pm index 24274e701..ec694ca58 100644 --- a/FS/FS/cust_bill_ApplicationCommon.pm +++ b/FS/FS/cust_bill_ApplicationCommon.pm @@ -33,6 +33,8 @@ represent application of things to invoices, currently payments =head1 METHODS +=over 4 + =item insert =cut @@ -113,6 +115,8 @@ sub apply_to_lineitems { my @apply = (); + my $conf = new FS::Conf; + local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; local $SIG{QUIT} = 'IGNORE'; @@ -125,6 +129,8 @@ sub apply_to_lineitems { my $dbh = dbh; my @open = $self->cust_bill->open_cust_bill_pkg; #FOR UPDATE...? + @open = grep { $_->pkgnum == $self->pkgnum } @open + if $conf->exists('pkg-balances') && $self->pkgnum; warn "$me ". scalar(@open). " open line items for invoice ". $self->cust_bill->invnum. ": ". join(', ', @open). "\n" if $DEBUG; @@ -359,6 +365,18 @@ sub cust_bill { qsearchs( 'cust_bill', { 'invnum' => $self->invnum } ); } +=item applied_to_invoice + +Returns a string representing the invoice (see L), for example: +"applied to Invoice #54 (3/20/2008)" + +=cut + +sub applied_to_invoice { + my $self = shift; + 'applied to '. $self->cust_bill->invnum_date_pretty; +} + =item lineitem_breakdown_table =cut