X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg_taxclass.pm;h=d8ddb15124dbff411695c74b0273085fdbe996c5;hp=824fd177a968190e4c8cbd8887dbdf4046f75968;hb=57bb423fe457ba4e13726877f53bcdf944f828f8;hpb=63a268637b2d51a8766412617724b9436439deb6 diff --git a/FS/FS/part_pkg_taxclass.pm b/FS/FS/part_pkg_taxclass.pm index 824fd177a..d8ddb1512 100644 --- a/FS/FS/part_pkg_taxclass.pm +++ b/FS/FS/part_pkg_taxclass.pm @@ -4,7 +4,7 @@ use strict; use vars qw( @ISA ); use Scalar::Util qw( blessed ); use FS::UID qw( dbh ); -use FS::Record; # qw( qsearch qsearchs ); +use FS::Record qw(qsearch); # qsearchs ); use FS::cust_main_county; @ISA = qw(FS::Record); @@ -30,8 +30,16 @@ FS::part_pkg_taxclass - Object methods for part_pkg_taxclass records =head1 DESCRIPTION -An FS::part_pkg_taxclass object represents a tax class. FS::part_pkg_taxclass -inherits from FS::Record. The following fields are currently supported: +An FS::part_pkg_taxclass object declares the existence of a taxable sales +class. FS::part_pkg_taxclass inherits from FS::Record. + +FS::part_pkg_taxclass is not used in tax calculation. It is only used to +list a set of valid tax class names for use in the user interface. When +using internal taxes, the actual matching of tax definitions to package +tax class is a string match between tax class names. This is arguably +a bug. + +The following fields are currently supported: =over 4 @@ -211,6 +219,26 @@ sub _upgrade_data { # class method } +=head1 CLASS METHODS + +=over 4 + +=item taxclass_names + +Returns a list of all the non-disabled tax classes. If tax classes aren't +enabled, returns a single empty string. + +=cut + +sub taxclass_names { + if ( FS::Conf->new->exists('enable_taxclasses') ) { + return map { $_->get('taxclass') } + qsearch('part_pkg_taxclass', { disabled => '' }); + } else { + return ( '' ); + } +} + =head1 BUGS Other tables (cust_main_county, part_pkg, agent_payment_gateway) have a text