[freeside-commits] branch master updated. 006f36a6d2ee10664c3207b47ff046de447ea8bb

Christopher Burger burgerc at freeside.biz
Tue Dec 11 15:02:09 PST 2018


The branch, master has been updated
       via  006f36a6d2ee10664c3207b47ff046de447ea8bb (commit)
      from  aa0c6cc1247b802d58b4c890339bcacf4d3f567a (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 006f36a6d2ee10664c3207b47ff046de447ea8bb
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue Dec 11 18:01:30 2018 -0500

    RT# 74693 - Added Bulk edit of rates only

diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi
index 552327836..722c699a2 100755
--- a/httemplate/browse/cust_main_county.cgi
+++ b/httemplate/browse/cust_main_county.cgi
@@ -260,6 +260,21 @@ if ( $country && $state &&
 }
 $cgi->delete('county');
 
+my $city = '';
+if ( $country && $state && $county &&
+     $cgi->param('city') =~
+       /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]]+)$/
+   )
+{
+  $city = $1;
+  if ( $city eq '__NONE__' ) {
+    $title = "No city, $title";
+  } else {
+    $title = "$city city, $title";
+  }
+}
+$cgi->delete('city');
+
 $title = " for $title" if $title;
 
 my $taxclass = '';
@@ -279,12 +294,18 @@ my $filter_change =
   "window.location = '". $cgi->self_url.
   ";country=' + encodeURIComponent( document.getElementById('country').options[document.getElementById('country').selectedIndex].value ) + ".
   "';state='   + encodeURIComponent( document.getElementById('state').options[document.getElementById('state').selectedIndex].value ) +".
-  "';county='  + encodeURIComponent( document.getElementById('county').options[document.getElementById('county').selectedIndex].value );";
+  "';county='  + encodeURIComponent( document.getElementById('county').options[document.getElementById('county').selectedIndex].value )";
+
+$filter_change .= " +';city='  + encodeURIComponent( document.getElementById('city').options[document.getElementById('city').selectedIndex].value )"
+  if $conf->exists('enable_taxclasses');
+
+$filter_change .= ";";
 
 #restore this so pagination works
 $cgi->param('country',  $country) if $country;
 $cgi->param('state',    $state  ) if $state;
 $cgi->param('county',   $county ) if $county;
+$cgi->param('city',     $city )   if $city;
 $cgi->param('taxclass', $county ) if $taxclass;
 
 my $html_posttotal =
@@ -338,6 +359,31 @@ if ( scalar(@counties) > 1 ) {
     '</SELECT>';
 }
 
+if ( $conf->exists('enable_taxclasses') ) {
+  my @cities = ( $country && $state && $county ) ? cities($county, $state, $country) : ();
+  if ( scalar(@cities) > 1 ) {
+    $html_posttotal .=
+      ' show city: '.
+      include('/elements/select-city.html',
+              'country'              => $country,
+              'state'                => $state,
+              'county'               => $county,
+              'city'                 => $city,
+              'onchange'             => $filter_change,
+              'empty_label'          => '(all)',
+              'empty_data_label'     => '(none)',
+              'empty_data_value'     => '__NONE__',
+              'disable_empty'        => 0,
+              'disable_cityupdate'   => 1,
+      );
+  } else {
+    $html_posttotal .=
+      '<SELECT NAME="city" ID="city" STYLE="display:none">'.
+      '  <OPTION VALUE="" SELECTED>'.
+      '</SELECT>';
+  }
+}
+
 $html_posttotal .= ' )';
 
 my $bulk_popup_link = 
@@ -412,6 +458,8 @@ my $html_foot = <<END;
 |
 <A HREF="javascript:void(0);" onClick="bulkPopup('edit');">Bulk edit selected</A>
 |
+<A HREF="javascript:void(0);" onClick="bulkPopup('edit_rate_only');">Bulk edit rate only selected</A>
+|
 <A HREF="${p}misc/tax_edit_excel.html",">bulk edit with excel file</A>
 END
 
@@ -434,6 +482,15 @@ if ( $county ) {
     $count_query .= ' AND county  = '. dbh->quote($county);
   }
 }
+if ( $city ) {
+  if ( $city eq '__NONE__' ) {
+    $hashref->{'city'} = '';
+    $count_query .= " AND ( city = '' OR city IS NULL ) ";
+  } else {
+    $hashref->{'city'} = $city;
+    $count_query .= ' AND city  = '. dbh->quote($city);
+  }
+}
 if ( $taxclass ) {
   $hashref->{'taxclass'} = $taxclass;
   $count_query .= ( $count_query =~ /WHERE/i ? ' AND ' : ' WHERE ' ).
diff --git a/httemplate/edit/bulk-cust_main_county.html b/httemplate/edit/bulk-cust_main_county.html
index 8b1234825..650fa7857 100644
--- a/httemplate/edit/bulk-cust_main_county.html
+++ b/httemplate/edit/bulk-cust_main_county.html
@@ -3,6 +3,7 @@
 <FORM ACTION="<% popurl(1)."process/bulk-cust_main_county.html" %>" METHOD="POST">
 
 <INPUT TYPE="hidden" NAME="action" VALUE="<% $action %>">
+<INPUT TYPE="hidden" NAME="rate_only" VALUE="<% $rate_only %>">
 <INPUT TYPE="hidden" NAME="taxnum" VALUE="<% join(',', @taxnum) %>">
 
 <TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
@@ -45,11 +46,13 @@
   </TR>
 % }
 
-<% include('/elements/tr-input-text.html',
+% unless ($rate_only) {
+  <% include('/elements/tr-input-text.html',
              'field' => 'taxname',
              'label' => 'Tax name'
           )
-%>
+  %>
+% }
 
 <% include('/elements/tr-input-percentage.html',
              'field' => 'tax',
@@ -57,27 +60,29 @@
           )
 %>
 
-<% include('/elements/tablebreak-tr-title.html', value=>'Exemptions' ) %>
+% unless ($rate_only) {
+  <% include('/elements/tablebreak-tr-title.html', value=>'Exemptions' ) %>
 
-<% include('/elements/tr-checkbox.html',
+  <% include('/elements/tr-checkbox.html',
              'field' => 'setuptax',
              'value' => 'Y',
              'label' => 'This tax not applicable to setup fees',
           )
-%>
+  %>
 
-<% include('/elements/tr-checkbox.html',
+  <% include('/elements/tr-checkbox.html',
              'field' => 'recurtax',
              'value' => 'Y',
              'label' => 'This tax not applicable to recurring fees',
           )
-%>
+  %>
 
-<% include('/elements/tr-input-money.html',
+  <% include('/elements/tr-input-money.html',
              'field' => 'exempt_amount',
              'label' => 'Monthly exemption per customer ($25 "Texas tax")',
           )
-%>
+  %>
+% }
 
 </TABLE>
 
@@ -97,8 +102,13 @@ $cgi->param('taxnum') =~ /^([\d,]+)$/
    or $m->comp('/elements/errorpage-popup.html', $cgi->param('error') || 'Nothing selected');
 my @taxnum = split(',', $1);
 
-$cgi->param('action') =~ /^(add|edit)$/ or die "unknown action";
+$cgi->param('action') =~ /^(add|edit|edit_rate_only)$/ or die "unknown action";
 my $action = $1;
+my $rate_only;
+if ($action eq "edit_rate_only") {
+  $action = "edit";
+  $rate_only = 1;
+}
 my $title = "Bulk $action tax rate";
 
 my @cust_main_county =
diff --git a/httemplate/edit/process/bulk-cust_main_county.html b/httemplate/edit/process/bulk-cust_main_county.html
index b5a0258b1..55832e9c5 100644
--- a/httemplate/edit/process/bulk-cust_main_county.html
+++ b/httemplate/edit/process/bulk-cust_main_county.html
@@ -27,6 +27,8 @@ my @taxnum = split(',', $1);
 $cgi->param('action') =~ /^(add|edit)$/ or die "unknown action";
 my $action = $1;
 
+my $rate_only = $cgi->param('rate_only') if $cgi->param('rate_only');
+
 my $error = '';
 foreach my $taxnum ( @taxnum ) {
 
@@ -35,8 +37,13 @@ foreach my $taxnum ( @taxnum ) {
 
   if ( $action eq 'edit' || $cust_main_county->tax == 0 ) { #let's replace
 
-    foreach (qw( taxname tax exempt_amount setuptax recurtax )) {
-      $cust_main_county->set( $_ => scalar($cgi->param($_)) )
+    if ($rate_only) {
+      $cust_main_county->set( tax => scalar($cgi->param('tax')) );
+    }
+    else {
+      foreach (qw( taxname tax exempt_amount setuptax recurtax )) {
+        $cust_main_county->set( $_ => scalar($cgi->param($_)) )
+      }
     }
 
     $error = $cust_main_county->replace and last;

-----------------------------------------------------------------------

Summary of changes:
 httemplate/browse/cust_main_county.cgi             | 59 +++++++++++++++++++++-
 httemplate/edit/bulk-cust_main_county.html         | 30 +++++++----
 httemplate/edit/process/bulk-cust_main_county.html | 11 +++-
 3 files changed, 87 insertions(+), 13 deletions(-)




More information about the freeside-commits mailing list