5 include( '/elements/location.html',
6 'object' => $cust_main, # or $cust_location
7 'prefix' => $pre, #only for cust_main objects
8 'onchange' => $javascript,
9 'disabled' => $disabled,
10 'same_checked' => $same_checked,
11 'geocode' => $geocode, #passed through
12 'no_asterisks' => 0, #set true to disable the red asterisks next
19 <TH ALIGN="right"><%$r%>Address</TH>
22 NAME = "<%$pre%>address1"
23 ID = "<%$pre%>address1"
24 VALUE = "<% $object->get($pre.'address1') |h %>"
26 onChange = "<% $onchange %>"
34 <TD ALIGN="right"><FONT ID="<% $pre %>address2_required" color="#ff0000" <% $address2_label_style %>>*</FONT> <FONT ID="<% $pre %>address2_label" <% $address2_label_style %>><B>Unit #</B></FONT></TD>
37 NAME = "<%$pre%>address2"
38 ID = "<%$pre%>address2"
39 VALUE = "<% $object->get($pre.'address2') |h %>"
41 onChange = "<% $onchange %>"
49 <TH ALIGN="right"><%$r%>City</TH>
54 VALUE = "<% $object->get($pre.'city') |h %>"
55 onChange = "<% $onchange %>"
60 <TH ALIGN="right" ID="<%$pre%>countylabel" <%$county_style%>><%$r%>County</TH>
62 <% include('/elements/select-county.html', %select_hash ) %>
64 <TH ALIGN="right"><%$r%>State</TH>
66 <% include('/elements/select-state.html', %select_hash ) %>
73 VALUE = "<% $object->get($pre.'zip') |h %>"
75 onChange = "<% $onchange %>"
83 <TH ALIGN="right"><%$r%>Country</TH>
84 <TD COLSPAN=5><% include('/elements/select-country.html', %select_hash ) %></TD>
88 <INPUT TYPE="hidden" NAME="geocode" VALUE="<% $opt{geocode} %>">
95 my $pre = $opt{'prefix'};
96 my $object = $opt{'object'};
97 my $onchange = $opt{'onchange'};
98 my $disabled = $opt{'disabled'};
100 my $conf = new FS::Conf;
102 my $r = $opt{'no_asterisks'} ? '' : qq!<font color="#ff0000">*</font> !;
104 #false laziness with ship state
105 my $countrydefault = $conf->config('countrydefault') || 'US';
106 $object->set($pre.'country', $countrydefault )
107 unless $object->get($pre.'country');
109 my $statedefault = $conf->config('statedefault')
110 || ($countrydefault eq 'US' ? 'CA' : '');
111 $object->set($pre.'state', $statedefault )
112 unless $object->get($pre.'state')
113 || $object->get($pre.'country') ne $countrydefault;
116 push @style, 'background-color: #dddddd"' if $disabled;
118 my @address2_label_style = ();
119 push @address2_label_style, 'visibility:hidden'
121 || ! $conf->exists('cust_main-require_address2')
122 || ( !$pre && !$opt{'same_checked'} );
124 my @counties = counties( $object->get($pre.'state'),
125 $object->get($pre.'country'),
127 my @county_style = ();
128 push @county_style, 'visibility:hidden'
129 unless scalar(@counties) > 1;
133 ? 'STYLE="'. join(';', @style). '"'
135 my $address2_label_style =
136 scalar(@address2_label_style)
137 ? 'STYLE="'. join(';', @address2_label_style). '"'
140 scalar(@county_style)
141 ? 'STYLE="'. join(';', @county_style). '"'
145 'county' => $object->get($pre.'county'),
146 'state' => $object->get($pre.'state'),
147 'country' => $object->get($pre.'country'),
149 'onchange' => $onchange,
150 'disabled' => $disabled,