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>
62 <TD><% include('/elements/select-county.html', %select_hash ) %></TD>
63 <TH ALIGN="right" WIDTH="1"><%$r%>State</TH>
65 <% include('/elements/select-state.html', %select_hash ) %>
72 VALUE = "<% $object->get($pre.'zip') |h %>"
74 onChange = "<% $onchange %>"
82 <TH ALIGN="right"><%$r%>Country</TH>
83 <TD COLSPAN=6><% include('/elements/select-country.html', %select_hash ) %></TD>
87 <INPUT TYPE="hidden" NAME="geocode" VALUE="<% $opt{geocode} %>">
94 my $pre = $opt{'prefix'};
95 my $object = $opt{'object'};
96 my $onchange = $opt{'onchange'};
97 my $disabled = $opt{'disabled'};
99 my $conf = new FS::Conf;
101 my $r = $opt{'no_asterisks'} ? '' : qq!<font color="#ff0000">*</font> !;
103 #false laziness with ship state
104 my $countrydefault = $conf->config('countrydefault') || 'US';
105 $object->set($pre.'country', $countrydefault )
106 unless $object->get($pre.'country');
108 my $statedefault = $conf->config('statedefault')
109 || ($countrydefault eq 'US' ? 'CA' : '');
110 $object->set($pre.'state', $statedefault )
111 unless $object->get($pre.'state')
112 || $object->get($pre.'country') ne $countrydefault;
115 push @style, 'background-color: #dddddd"' if $disabled;
117 my @address2_label_style = ();
118 push @address2_label_style, 'visibility:hidden'
120 || ! $conf->exists('cust_main-require_address2')
121 || ( !$pre && !$opt{'same_checked'} );
123 my @counties = counties( $object->get($pre.'state'),
124 $object->get($pre.'country'),
126 my @county_style = ();
127 push @county_style, 'display:none' # 'visibility:hidden'
128 unless scalar(@counties) > 1;
132 ? 'STYLE="'. join(';', @style). '"'
134 my $address2_label_style =
135 scalar(@address2_label_style)
136 ? 'STYLE="'. join(';', @address2_label_style). '"'
139 scalar(@county_style)
140 ? 'STYLE="'. join(';', @county_style). '"'
144 'county' => $object->get($pre.'county'),
145 'state' => $object->get($pre.'state'),
146 'country' => $object->get($pre.'country'),
148 'onchange' => $onchange,
149 'disabled' => $disabled,