diff options
author | Mark Wells <mark@freeside.biz> | 2015-02-04 21:12:56 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-02-04 21:12:56 -0800 |
commit | 60f71e8b94fcd4403ad59c0508de59f90eb6edc5 (patch) | |
tree | b1e630a9e47b402faa322f845332daf98492560e /FS/FS/part_fee.pm | |
parent | 745e36b35b36607f450d16944469f52e362bf934 (diff) |
allow fees to be grouped with taxes on the invoice, #32223
Diffstat (limited to 'FS/FS/part_fee.pm')
-rw-r--r-- | FS/FS/part_fee.pm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/FS/FS/part_fee.pm b/FS/FS/part_fee.pm index a10b06634..954f70b34 100644 --- a/FS/FS/part_fee.pm +++ b/FS/FS/part_fee.pm @@ -2,7 +2,6 @@ package FS::part_fee; use strict; use base qw( FS::o2m_Common FS::Record ); -use vars qw( $DEBUG ); use FS::Record qw( qsearch qsearchs ); use FS::pkg_class; use FS::cust_bill_pkg_display; @@ -10,7 +9,8 @@ use FS::part_pkg_taxproduct; use FS::agent; use FS::part_fee_usage; -$DEBUG = 0; +our $DEBUG = 0; +our $default_class; =head1 NAME @@ -54,6 +54,9 @@ the invoice =item disabled - 'Y' if the fee is disabled =item classnum - the L<FS::pkg_class> that the fee belongs to, for reporting +and placement on multisection invoices. Unlike packages, fees I<must> be +assigned to a class; they will default to class named "Fees", which belongs +to the same invoice section that normally contains taxes. =item taxable - 'Y' if this fee should be considered a taxable sale. Currently, taxable fees will be treated like they exist at the customer's @@ -134,6 +137,13 @@ sub check { $self->set('amount', 0) unless $self->amount; $self->set('percent', 0) unless $self->percent; + $default_class ||= qsearchs('pkg_class', { classname => 'Fees' }) + or die "default package fee class not found; run freeside-upgrade to continue.\n"; + + if (!$self->get('classnum')) { + $self->set('classnum', $default_class->classnum); + } + my $error = $self->ut_numbern('feepart') || $self->ut_textn('comment') |