summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-06-30 03:24:08 -0500
committerJonathan Prykop <jonathan@freeside.biz>2015-06-30 03:24:08 -0500
commitd13dae1c37c36c27f1ac9fd134c5d8b3a4fb9754 (patch)
tree45450ba72942d1539acecaa797133ba01d68f5a9 /httemplate
parent633af1c0e996b16d0e18a7cdff05490ea7d46ca6 (diff)
RT#29285: State field not needed for New Zealand
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/edit/cust_main/basics.html7
-rw-r--r--httemplate/elements/city.html5
-rw-r--r--httemplate/elements/location.html13
-rw-r--r--httemplate/elements/standardize_locations.js4
-rw-r--r--httemplate/view/cust_main/contacts.html2
5 files changed, 19 insertions, 12 deletions
diff --git a/httemplate/edit/cust_main/basics.html b/httemplate/edit/cust_main/basics.html
index e16aafafc..32a03bbe6 100644
--- a/httemplate/edit/cust_main/basics.html
+++ b/httemplate/edit/cust_main/basics.html
@@ -46,7 +46,7 @@
var ship_locked_agents = <% encode_json(\%ship_locked_agents) %>;
var ship_fields = [
- 'locationname', 'address1', 'city', 'state', 'zip', 'country',
+ 'locationname', 'address1',<% $conf->exists('cust_main-no_city_in_address') ? '' : q( 'city',) %> 'state', 'zip', 'country',
'latitude', 'longitude', 'district'
];
@@ -307,7 +307,10 @@ foreach (qsearch('agent',{})) {
my $agent_ship_location = $cust_main->ship_location;
$ship_locked_agents{$agentnum} = +{
map { $_ => $agent_ship_location->$_ }
- qw(locationname address1 city state zip country latitude longitude district)
+ (
+ qw(locationname address1 state zip country latitude longitude district),
+ ($conf->exists('cust_main-no_city_in_address') ? () : 'city')
+ )
};
}
diff --git a/httemplate/elements/city.html b/httemplate/elements/city.html
index 5f4d4e09e..4e9a60940 100644
--- a/httemplate/elements/city.html
+++ b/httemplate/elements/city.html
@@ -159,6 +159,11 @@ my $disable_select = 1 if $conf->config('tax_district_method');
$opt{'disable_empty'} = 1 unless exists($opt{'disable_empty'});
+if ($conf->exists('cust_main-no_city_in_address')) {
+ $opt{'disable_text'} = 1;
+ $disable_select = 1;
+}
+
my $text_style = $opt{'style'} ? [ @{ $opt{'style'} } ] : [];
my $select_style = $opt{'style'} ? [ @{ $opt{'style'} } ] : [];
diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html
index 90f20265a..b5f0a963c 100644
--- a/httemplate/elements/location.html
+++ b/httemplate/elements/location.html
@@ -169,15 +169,14 @@ Example:
<TR>
-% if ($conf->exists('city_not_required')) {
-<input type="hidden" name="<% ($select_hash{'prefix'}) ? $select_hash{'prefix'} : '' %>city" value=" "/>
-%} else {
- <<%$th%> ALIGN="right"><%$r%><% mt('City') |h %></<%$th%>>
+ <<%$th%> ALIGN="right">
+% unless ($conf->exists('cust_main-no_city_in_address')) {
+ <% $r %><% mt('City') |h %>
+% }
+ </<%$th%>>
<TD WIDTH="1"><% include('/elements/city.html', %select_hash, 'text_style' => \@style ) %></TD>
-
<<%$th%> ALIGN="right" WIDTH="1" ID="<%$pre%>countylabel" <%$county_style%>><%$r%>County</<%$th%>>
<TD WIDTH="1"><% include('/elements/select-county.html', %select_hash ) %></TD>
-% }
<<%$th%> ALIGN="right" WIDTH="1"><%$r%><% mt('State') |h %></<%$th%>>
<TD WIDTH="1">
<% include('/elements/select-state.html', %select_hash ) %>
@@ -291,7 +290,7 @@ Example:
var clear_coords_on_change = [
'<%$pre%>address1',
'<%$pre%>address2',
- '<%$pre%>city',
+ <% $conf->exists('cust_main-no_city_in_address') ? '' : qq('${pre}city',) %>
'<%$pre%>state',
'<%$pre%>zip',
'<%$pre%>country'
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index ff7183b26..1a01daa6f 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -13,7 +13,7 @@ function form_address_info() {
% }
% for my $pre (@prefixes) {
% # normal case
-% for my $field (qw(address1 address2 city state zip country)) {
+% for my $field (qw(address1 address2 state zip country), ($conf->exists('cust_main-no_city_in_address') ? () : 'city')) {
returnobj['<% $pre %><% $field %>'] = cf.elements['<% $pre %><% $field %>'].value;
% } #for $field
% if ( $withcensus ) {
@@ -145,7 +145,7 @@ function replace_address() {
var clean = newaddr['<% $pre %>addr_clean'] == 'Y';
var error = newaddr['<% $pre %>error'];
if ( clean ) {
-% foreach my $field (qw(address1 address2 city state zip addr_clean )) {
+% foreach my $field (qw(address1 address2 state zip addr_clean ),($conf->exists('cust_main-no_city_in_address') ? () : 'city')) {
cf.elements['<% $pre %><% $field %>'].value = newaddr['<% $pre %><% $field %>'];
% } #foreach $field
diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html
index 22a7b9584..e3d5d63cb 100644
--- a/httemplate/view/cust_main/contacts.html
+++ b/httemplate/view/cust_main/contacts.html
@@ -100,7 +100,7 @@
% if ( $location->county ) {
(<% $location->county |h %> county)\
% }
-,<% state_label( $location->state, $location->country ) |h %>
+<% ($location->city || $location->county) ? ', ' : ''%><% state_label( $location->state, $location->country ) |h %>
<% $location->zip %>
</TD>
</TR>