diff options
author | ivan <ivan> | 2001-10-15 12:16:42 +0000 |
---|---|---|
committer | ivan <ivan> | 2001-10-15 12:16:42 +0000 |
commit | a984fa561b6493ae41215c3d26013767f9ce79cb (patch) | |
tree | 91545fa0be38a55c501d67a26ab58fb1c8054e9d /FS | |
parent | 05eafa5ab3ded207d716685b32edf6946187514a (diff) |
print reasons with credits on invoices
use straight eval, not Safe::reval in cust_main::bill for now, as i have no
idea how to call methods on a share()'ed scalar. hmm.
add cust_pkg::cust_main method
s/eidiot/idiot/ in httemplate/misc/bill.cgi
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_bill.pm | 8 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 20 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 23 |
3 files changed, 33 insertions, 18 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index f61137f54..b65df89c4 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -389,8 +389,12 @@ sub print_text { #something more elaborate if $_->amount ne $_->cust_credit->credited ? + my $reason = substr($_->cust_credit->reason,0,32); + $reason .= '...' if length($reason) < length($_->cust_credit->reason); + $reason = " ($reason) " if $reason; push @buf,[ - "Credit #". $_->crednum. " (". time2str("%x",$_->cust_credit->_date) .")", + "Credit #". $_->crednum. " (". time2str("%x",$_->cust_credit->_date) .")". + $reason, $money_char. sprintf("%10.2f",$_->amount) ]; } @@ -489,7 +493,7 @@ sub print_text { =head1 VERSION -$Id: cust_bill.pm,v 1.11 2001-09-03 22:07:38 ivan Exp $ +$Id: cust_bill.pm,v 1.12 2001-10-15 12:16:41 ivan Exp $ =head1 BUGS diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index f99a15e69..dce73c0ba 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -843,10 +843,11 @@ sub bill { }; $setup_prog = $1; - my $cpt = new Safe; - #$cpt->permit(); #what is necessary? - $cpt->share(qw( $cust_pkg )); #can $cpt now use $cust_pkg methods? - $setup = $cpt->reval($setup_prog); + #my $cpt = new Safe; + ##$cpt->permit(); #what is necessary? + #$cpt->share(qw( $cust_pkg )); #can $cpt now use $cust_pkg methods? + #$setup = $cpt->reval($setup_prog); + $setup = eval $setup_prog; unless ( defined($setup) ) { $dbh->rollback if $oldAutoCommit; return "Error reval-ing part_pkg->setup pkgpart ". $part_pkg->pkgpart. @@ -871,10 +872,11 @@ sub bill { }; $recur_prog = $1; - my $cpt = new Safe; - #$cpt->permit(); #what is necessary? - $cpt->share(qw( $cust_pkg )); #can $cpt now use $cust_pkg methods? - $recur = $cpt->reval($recur_prog); + #my $cpt = new Safe; + ##$cpt->permit(); #what is necessary? + #$cpt->share(qw( $cust_pkg )); #can $cpt now use $cust_pkg methods? + #$recur = $cpt->reval($recur_prog); + $recur = eval $recur_prog; unless ( defined($recur) ) { $dbh->rollback if $oldAutoCommit; return "Error reval-ing part_pkg->recur pkgpart ". @@ -1825,7 +1827,7 @@ sub append_fuzzyfiles { =head1 VERSION -$Id: cust_main.pm,v 1.40 2001-10-15 10:42:28 ivan Exp $ +$Id: cust_main.pm,v 1.41 2001-10-15 12:16:42 ivan Exp $ =head1 BUGS diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 1bcf74f78..cbf4ae50d 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -115,8 +115,7 @@ sub insert { my $error = $self->ut_number('custnum'); return $error if $error; - return "Unknown customer ". $self->custnum - unless qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); + return "Unknown customer ". $self->custnum unless $self->cust_main; $self->SUPER::insert; @@ -189,8 +188,7 @@ sub check { return $error if $error; if ( $self->custnum ) { - return "Unknown customer" - unless qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); + return "Unknown customer ". $self->custnum unless $self->cust_main; } return "Unknown pkgpart" @@ -433,6 +431,17 @@ sub labels { map { [ $_->label ] } qsearch ( 'cust_svc', { 'pkgnum' => $self->pkgnum } ); } +=item cust_main + +Returns the parent customer object (see L<FS::cust_main>). + +=cut + +sub cust_main { + my $self = shift; + qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); +} + =back =head1 SUBROUTINES @@ -576,7 +585,7 @@ sub order { =head1 VERSION -$Id: cust_pkg.pm,v 1.9 2001-10-09 23:10:16 ivan Exp $ +$Id: cust_pkg.pm,v 1.10 2001-10-15 12:16:42 ivan Exp $ =head1 BUGS @@ -598,8 +607,8 @@ moved to check ? =head1 SEE ALSO -L<FS::Record>, L<FS::cust_main>, L<FS::part_pkg>, L<FS::cust_svc> -, L<FS::pkg_svc>, schema.html from the base documentation +L<FS::Record>, L<FS::cust_main>, L<FS::part_pkg>, L<FS::cust_svc>, +L<FS::pkg_svc>, schema.html from the base documentation =cut |