[freeside-commits] branch FREESIDE_3_BRANCH updated. b05ecb709b4ff5cd10a4df93af3e1ca9b79732e2
Ivan
ivan at 420.am
Wed Nov 19 00:12:44 PST 2014
The branch, FREESIDE_3_BRANCH has been updated
via b05ecb709b4ff5cd10a4df93af3e1ca9b79732e2 (commit)
from eaa349aa44febf4271b0b16dcffb894f360df834 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b05ecb709b4ff5cd10a4df93af3e1ca9b79732e2
Author: Ivan Kohler <ivan at freeside.biz>
Date: Wed Nov 19 00:12:41 2014 -0800
option for residential-only requirement for individual tax exemption numbers, RT#32027
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 46cac19..c7a3dcb 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -5168,19 +5168,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 a7be5c8..dbac17e 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -125,6 +125,12 @@ If you need to continue using the old Form 477 report, turn on the
$conf->set($newname, 'location');
}
+ # 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 c6f3d5e..dcbfb8f 100644
--- a/FS/FS/cust_main_exemption.pm
+++ b/FS/FS/cust_main_exemption.pm
@@ -1,8 +1,8 @@
package FS::cust_main_exemption;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearchs );
use FS::Conf;
use FS::cust_main;
@@ -117,13 +117,27 @@ 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;
}
+=item cust_main
+
+=cut
+
+sub cust_main {
+ my $self = shift;
+ qsearchs('cust_main', { custnum=>$self->custnum } );
+}
+
=back
=head1 BUGS
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index d52fb3c..f1daebe 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')
% )
% {
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Conf.pm | 17 ++++++++++++++---
FS/FS/Upgrade.pm | 6 ++++++
FS/FS/cust_main_exemption.pm | 24 +++++++++++++++++++-----
httemplate/edit/cust_main/billing.html | 1 +
4 files changed, 40 insertions(+), 8 deletions(-)
More information about the freeside-commits
mailing list