summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-11-19 00:12:38 -0800
committerIvan Kohler <ivan@freeside.biz>2014-11-19 00:12:38 -0800
commit933897259d1e64fdc12c612f924db3b039a9ffdf (patch)
tree439f1fa3694bdfa8eb0805e0b76cd3665602cb5f
parent36b23802990dc9220661ce118788893fce71f71d (diff)
option for residential-only requirement for individual tax exemption numbers, RT#32027
-rw-r--r--FS/FS/Conf.pm17
-rw-r--r--FS/FS/Upgrade.pm6
-rw-r--r--FS/FS/cust_main_exemption.pm11
-rw-r--r--httemplate/edit/cust_main/billing.html1
4 files changed, 29 insertions, 6 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index cb4274f39..8fb6220df 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -5161,19 +5161,30 @@ and customer address. Include units.',
{
'key' => 'tax-cust_exempt-groups',
- 'section' => '',
+ 'section' => 'billing',
'description' => 'List of grouping possibilities for tax names, for per-customer exemption purposes, one tax name per line. For example, "GST" would indicate the ability to exempt customers individually from taxes named "GST" (but not other taxes).',
'type' => 'textarea',
},
{
'key' => 'tax-cust_exempt-groups-require_individual_nums',
- 'section' => '',
- 'description' => 'When using tax-cust_exempt-groups, require an individual tax exemption number for each exemption from different taxes.',
+ 'section' => 'deprecated',
+ 'description' => 'Deprecated: see tax-cust_exempt-groups-number_requirement',
'type' => 'checkbox',
},
{
+ 'key' => 'tax-cust_exempt-groups-num_req',
+ 'section' => 'billing',
+ 'description' => 'When using tax-cust_exempt-groups, control whether individual tax exemption numbers are required for exemption from different taxes.',
+ 'type' => 'select',
+ 'select_hash' => [ '' => 'Not required',
+ 'residential' => 'Required for residential customers only',
+ 'all' => 'Required for all customers',
+ ],
+ },
+
+ {
'key' => 'cust_main-default_view',
'section' => 'UI',
'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index 7aa7ce37e..381fd5fc5 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -133,6 +133,12 @@ If you need to continue using the old Form 477 report, turn on the
}
+ # boolean tax-cust_exempt-groups-require_individual_nums is now -num_req all
+ if ( $conf->exists('tax-cust_exempt-groups-require_individual_nums') ) {
+ $conf->set('tax-cust_exempt-groups-num_req', 'all');
+ $conf->delete('tax-cust_exempt-groups-require_individual_nums');
+ }
+
}
sub upgrade_overlimit_groups {
diff --git a/FS/FS/cust_main_exemption.pm b/FS/FS/cust_main_exemption.pm
index 6492e2286..4fe6b7178 100644
--- a/FS/FS/cust_main_exemption.pm
+++ b/FS/FS/cust_main_exemption.pm
@@ -115,9 +115,14 @@ sub check {
return $error if $error;
my $conf = new FS::Conf;
- if ( ! $self->exempt_number && $conf->exists('tax-cust_exempt-groups-require_individual_nums') ) {
- return 'Tax exemption number required for '. $self->taxname. ' exemption';
- }
+ return 'Tax exemption number required for '. $self->taxname. ' exemption'
+ if ! $self->exempt_number
+ && ( $conf->exists('tax-cust_exempt-groups-require_individual_nums')
+ || $conf->config('tax-cust_exempt-groups-num_req') eq 'all'
+ || ( $conf->config('tax-cust_exempt-groups-num_req') eq 'residential'
+ && ! $self->cust_main->company
+ )
+ );
$self->SUPER::check;
}
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index 16ddb2e19..1f44905f8 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -448,6 +448,7 @@
% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
% if ( $conf->exists('cust_class-tax_exempt')
% || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
+% || $conf->config('tax-cust_exempt-groups-num_req') =~ /\w/
% || ! $curuser->access_right('Edit customer tax exemptions')
% )
% {