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 VALUE = "<% $object->get($pre.'address1') |h %>"
25 onChange = "<% $onchange %>"
33 <TD ALIGN="right"><FONT ID="<% $pre %>address2_required" color="#ff0000" STYLE="<% $address2_label_style %>">*</FONT> <FONT ID="<% $pre %>address2_label" STYLE="<% $address2_label_style %>"><B>Unit #</B></FONT></TD>
36 NAME = "<%$pre%>address2"
37 VALUE = "<% $object->get($pre.'address2') |h %>"
39 onChange = "<% $onchange %>"
47 <TH ALIGN="right"><%$r%>City</TH>
51 VALUE = "<% $object->get($pre.'city') |h %>"
52 onChange = "<% $onchange %>"
57 <TH ALIGN="right" ID="<%$pre%>countylabel" <%$county_style%>><%$r%>County</TH>
59 <% include('/elements/select-county.html', %select_hash ) %>
61 <TH ALIGN="right"><%$r%>State</TH>
63 <% include('/elements/select-state.html', %select_hash ) %>
69 VALUE = "<% $object->get($pre.'zip') |h %>"
71 onChange = "<% $onchange %>"
79 <TH ALIGN="right"><%$r%>Country</TH>
80 <TD COLSPAN=5><% include('/elements/select-country.html', %select_hash ) %></TD>
84 <INPUT TYPE="hidden" NAME="geocode" VALUE="<% $opt{geocode} %>">
91 my $pre = $opt{'prefix'};
92 my $object = $opt{'object'};
93 my $onchange = $opt{'onchange'};
94 my $disabled = $opt{'disabled'};
96 my $conf = new FS::Conf;
98 my $r = $opt{'no_asterisks'} ? '' : qq!<font color="#ff0000">*</font> !;
100 #false laziness with ship state
101 my $countrydefault = $conf->config('countrydefault') || 'US';
102 $object->set($pre.'country', $countrydefault )
103 unless $object->get($pre.'country');
105 my $statedefault = $conf->config('statedefault')
106 || ($countrydefault eq 'US' ? 'CA' : '');
107 $object->set($pre.'state', $statedefault )
108 unless $object->get($pre.'state')
109 || $object->get($pre.'country') ne $countrydefault;
112 push @style, 'background-color: #dddddd"' if $disabled;
114 my @address2_label_style = ();
115 push @address2_label_style, 'visibility:hidden'
117 || ! $conf->exists('cust_main-require_address2')
118 || ( !$pre && !$opt{'same_checked'} );
120 my @counties = counties( $object->get($pre.'state'),
121 $object->get($pre.'country'),
123 my @county_style = ();
124 push @county_style, 'visibility:hidden'
125 unless scalar(@counties) > 1;
129 ? 'STYLE="'. join(';', @style). '"'
131 my $address2_label_style =
132 scalar(@address2_label_style)
133 ? 'STYLE="'. join(';', @address2_label_style). '"'
136 scalar(@county_style)
137 ? 'STYLE="'. join(';', @county_style). '"'
141 'county' => $object->get($pre.'county'),
142 'state' => $object->get($pre.'state'),
143 'country' => $object->get($pre.'country'),
145 'onchange' => $onchange,
146 'disabled' => $disabled,