[freeside-commits] branch master updated. 1fc6e684436955f6980dd8d9129f6a95d5af595e

Mark Wells mark at 420.am
Mon Mar 5 12:34:18 PST 2012


The branch, master has been updated
       via  1fc6e684436955f6980dd8d9129f6a95d5af595e (commit)
      from  e8bea83739d07ee36cbe0d3c62c3423b25bcd71d (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 1fc6e684436955f6980dd8d9129f6a95d5af595e
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Mar 5 12:33:32 2012 -0800

    stop tax district lookup from enabling city dropdown, #16757

diff --git a/httemplate/elements/city.html b/httemplate/elements/city.html
index 29495df..f6d2b4b 100644
--- a/httemplate/elements/city.html
+++ b/httemplate/elements/city.html
@@ -15,11 +15,20 @@ Example:
     disabled      => 0, #bool
 #    disable_empty => 1, #defaults to 1, disable the empty option
 #    empty_label   => 'all', #label for empty option
+#    disable_select => 1, # disable the selector (just show a text input)
     style         => [ 'attribute:value', 'another:value' ],
   );
 
 </%doc>
 
+% if ( $disable_select ) {
+<SCRIPT TYPE="text/javascript">
+function <% $pre %>county_changed(what, callback) {}
+</SCRIPT>
+% }
+% else {
+
+
 <% include('/elements/xmlhttp.html',
               'url'  => $p.'misc/cities.cgi',
               'subs' => [ $pre. 'get_cities' ],
@@ -87,6 +96,8 @@ Example:
 
 </SCRIPT>
 
+% } #!disable_select
+
 <INPUT TYPE     = "text"
        NAME     = "<%$pre%>city"
        ID       = "<%$pre%>city"
@@ -96,6 +107,8 @@ Example:
        <% $text_style %>
 >
 
+% if ( !$disable_select ) {
+
 <SELECT NAME     = "<%$pre%>city_select"
         ID       = "<%$pre%>city_select"
         onChange = "<%$pre%>city_select_changed(this); <% $opt{'onchange'} %>"
@@ -112,7 +125,7 @@ Example:
 % }
 
 </SELECT>
-
+% }
 %#           VALUE    = "<% $curr_value |h %>"
 <%init>
 
@@ -120,6 +133,11 @@ my %opt = @_;
 
 my $pre = $opt{'prefix'};
 
+my $conf = new FS::Conf;
+# Using tax_district_method implies that there's not a preloaded city/county
+# tax district table.
+my $disable_select = 1 if $conf->config('tax_district_method');
+
 my $text_style   = $opt{'style'} ? [ @{ $opt{'style'} } ] : [];
 my $select_style = $opt{'style'} ? [ @{ $opt{'style'} } ] : [];
 
@@ -128,7 +146,7 @@ push @$select_style, @{ $opt{'select_style'} } if $opt{'select_style'};
 
 my @cities = cities( $opt{'county'}, $opt{'state'}, $opt{'country'} );
 my $saved_city = '';
-if ( scalar(@cities) > 1 || $cities[0] ) {
+if ( scalar(@cities) > 1 || $cities[0] and !$disable_select ) {
   push @$text_style, 'display:none';
 } else {
   push @$select_style, 'display:none';

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

Summary of changes:
 httemplate/elements/city.html |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list