[freeside-commits] branch master updated. d372a6b46727cd3d86f70e4c9c567a97f5f1f077

Mark Wells mark at 420.am
Tue Apr 23 11:37:59 PDT 2013


The branch, master has been updated
       via  d372a6b46727cd3d86f70e4c9c567a97f5f1f077 (commit)
      from  8e83c67a7c8fdb375e9c48f6dac92b1fcd5b5e3a (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 d372a6b46727cd3d86f70e4c9c567a97f5f1f077
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Apr 23 11:36:54 2013 -0700

    option to show district on 3.0 tax report, #22137

diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm
index 9a4990a..a61d67e 100644
--- a/FS/FS/cust_main_county.pm
+++ b/FS/FS/cust_main_county.pm
@@ -147,13 +147,10 @@ If the taxname field is set, it will look like
 If the taxclass is set, then it will be
 "Anytown, Alameda County, CA, US (International)".
 
-Currently it will not contain the district, even if the city+county+state
-is not unique.
-
-OPTIONS may contain "no_taxclass" (hides taxclass) and/or "no_city"
-(hides city).  It may also contain "out", in which case, if this 
-region (district+city+county+state+country) contains no non-zero 
-taxes, the label will read "Out of taxable region(s)".
+OPTIONS may contain "with_taxclass", "with_city", and "with_district" to show
+those fields.  It may also contain "out", in which case, if this region 
+(district+city+county+state+country) contains no non-zero taxes, the label 
+will read "Out of taxable region(s)".
 
 =cut
 
@@ -175,12 +172,15 @@ sub label {
   my $label = $self->country;
   $label = $self->state.", $label" if $self->state;
   $label = $self->county." County, $label" if $self->county;
-  if (!$opt{no_city}) {
+  if ($opt{with_city}) {
     $label = $self->city.", $label" if $self->city;
+    if ($opt{with_district} and $self->district) {
+      $label = $self->district . ", $label";
+    }
   }
   # ugly labels when taxclass and taxname are both non-null...
   # but this is how the tax report does it
-  if (!$opt{no_taxclass}) {
+  if ($opt{with_taxclass}) {
     $label = "$label (".$self->taxclass.')' if $self->taxclass;
   }
   $label = $self->taxname." ($label)" if $self->taxname;
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
index 42a52d1..479b990 100755
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -250,8 +250,10 @@ my $conf = new FS::Conf;
 my $out = 'Out of taxable region(s)';
 
 my %label_opt = ( out => 1 ); #enable 'Out of Taxable Region' label
-$label_opt{no_city} = 1     unless $cgi->param('show_cities');
-$label_opt{no_taxclass} = 1 unless $cgi->param('show_taxclasses');
+$label_opt{with_city} = 1     if $cgi->param('show_cities');
+$label_opt{with_district} = 1 if $cgi->param('show_districts');
+
+$label_opt{with_taxclass} = 1 if $cgi->param('show_taxclasses');
 
 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
 
@@ -487,7 +489,8 @@ my $tot_tax = 0;
 my $tot_credit = 0;
 
 my @loc_params = qw(country state county);
-push @loc_params, qw(city district) if $cgi->param('show_cities');
+push @loc_params, 'city' if $cgi->param('show_cities');
+push @loc_params, 'district' if $cgi->param('show_districts');
 
 foreach my $r ( qsearch({ 'table'     => 'cust_main_county', })) {
   my $taxnum = $r->taxnum;
@@ -522,7 +525,7 @@ foreach my $r ( qsearch({ 'table'     => 'cust_main_county', })) {
   }
 
   if ( $cgi->param('show_taxclasses') ) {
-    my $base_label = $r->label(%label_opt, 'no_taxclass' => 1);
+    my $base_label = $r->label(%label_opt, 'with_taxclass' => 0);
     $base_regions{$base_label} ||=
     {
       label   => $base_label,
diff --git a/httemplate/search/report_tax.html b/httemplate/search/report_tax.html
index 2ab0e0b..8a207aa 100755
--- a/httemplate/search/report_tax.html
+++ b/httemplate/search/report_tax.html
@@ -34,9 +34,21 @@
 
 %    if ( $city ) {
    <TR>
-     <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="show_cities" VALUE="1"></TD>
+     <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="show_cities" VALUE="1" onclick="toggle_show_cities(this)"></TD>
      <TD>Show cities</TD>
    </TR>
+   <TR>
+     <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="show_districts" VALUE="1" DISABLED></TD>
+     <TD>Show districts</TD>
+   </TR>
+  <SCRIPT TYPE="text/javascript">
+  function toggle_show_cities() {
+    what = document.getElementsByName('show_cities')[0];
+    what.form.show_districts.disabled = !what.checked;
+    what.form.show_districts.checked  = what.checked;
+  }
+  toggle_show_cities();
+  </SCRIPT>
 % } 
 
 %    if ( $conf->exists('enable_taxclasses') ) {

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

Summary of changes:
 FS/FS/cust_main_county.pm         |   18 +++++++++---------
 httemplate/search/report_tax.cgi  |   11 +++++++----
 httemplate/search/report_tax.html |   14 +++++++++++++-
 3 files changed, 29 insertions(+), 14 deletions(-)




More information about the freeside-commits mailing list