[freeside-commits] branch master updated. 933897259d1e64fdc12c612f924db3b039a9ffdf

Ivan ivan at 420.am
Wed Nov 19 00:12:40 PST 2014


The branch, master has been updated
       via  933897259d1e64fdc12c612f924db3b039a9ffdf (commit)
      from  36b23802990dc9220661ce118788893fce71f71d (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 933897259d1e64fdc12c612f924db3b039a9ffdf
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Nov 19 00:12:38 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 cb4274f..8fb6220 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 7aa7ce3..381fd5f 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 6492e22..4fe6b71 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 16ddb2e..1f44905 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           |   11 ++++++++---
 httemplate/edit/cust_main/billing.html |    1 +
 4 files changed, 29 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list