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
14 'address1_label' => 'Address', #label for address
20 <TH ALIGN="right"><%$r%><% $opt{'address1_label'} || 'Address' %></TH>
23 NAME = "<%$pre%>address1"
24 ID = "<%$pre%>address1"
25 VALUE = "<% $object->get($pre.'address1') |h %>"
27 onChange = "<% $onchange %>"
35 <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>
38 NAME = "<%$pre%>address2"
39 ID = "<%$pre%>address2"
40 VALUE = "<% $object->get($pre.'address2') |h %>"
42 onChange = "<% $onchange %>"
50 <TH ALIGN="right"><%$r%>City</TH>
55 VALUE = "<% $object->get($pre.'city') |h %>"
56 onChange = "<% $onchange %>"
61 <TH ALIGN="right" ID="<%$pre%>countylabel" <%$county_style%>><%$r%>County</TH>
63 <% include('/elements/select-county.html', %select_hash ) %>
65 <TH ALIGN="right"><%$r%>State</TH>
67 <% include('/elements/select-state.html', %select_hash ) %>
74 VALUE = "<% $object->get($pre.'zip') |h %>"
76 onChange = "<% $onchange %>"
84 <TH ALIGN="right"><%$r%>Country</TH>
85 <TD COLSPAN=5><% include('/elements/select-country.html', %select_hash ) %></TD>
89 <INPUT TYPE="hidden" NAME="geocode" VALUE="<% $opt{geocode} %>">
96 my $pre = $opt{'prefix'};
97 my $object = $opt{'object'};
98 my $onchange = $opt{'onchange'};
99 my $disabled = $opt{'disabled'};
101 my $conf = new FS::Conf;
103 my $r = $opt{'no_asterisks'} ? '' : qq!<font color="#ff0000">*</font> !;
105 #false laziness with ship state
106 my $countrydefault = $conf->config('countrydefault') || 'US';
107 $object->set($pre.'country', $countrydefault )
108 unless $object->get($pre.'country');
110 my $statedefault = $conf->config('statedefault')
111 || ($countrydefault eq 'US' ? 'CA' : '');
112 $object->set($pre.'state', $statedefault )
113 unless $object->get($pre.'state')
114 || $object->get($pre.'country') ne $countrydefault;
117 push @style, 'background-color: #dddddd"' if $disabled;
119 my @address2_label_style = ();
120 push @address2_label_style, 'visibility:hidden'
122 || ! $conf->exists('cust_main-require_address2')
123 || ( !$pre && !$opt{'same_checked'} );
125 my @counties = counties( $object->get($pre.'state'),
126 $object->get($pre.'country'),
128 my @county_style = ();
129 push @county_style, 'visibility:hidden'
130 unless scalar(@counties) > 1;
134 ? 'STYLE="'. join(';', @style). '"'
136 my $address2_label_style =
137 scalar(@address2_label_style)
138 ? 'STYLE="'. join(';', @address2_label_style). '"'
141 scalar(@county_style)
142 ? 'STYLE="'. join(';', @county_style). '"'
146 'county' => $object->get($pre.'county'),
147 'state' => $object->get($pre.'state'),
148 'country' => $object->get($pre.'country'),
150 'onchange' => $onchange,
151 'disabled' => $disabled,