X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Felements%2Ftr-select-cust_location.html;h=36ee7b6e5eb4025b067045c47ee0f070521fdbb7;hb=1b3abef9815111c52b1370ba5168a592ae9cfcb0;hp=b804f4548bfd96864359d3aa4d52b521332da32b;hpb=0af38652da3b3be7da2d35b048285ef6f2194e1a;p=freeside.git
diff --git a/httemplate/elements/tr-select-cust_location.html b/httemplate/elements/tr-select-cust_location.html
index b804f4548..36ee7b6e5 100644
--- a/httemplate/elements/tr-select-cust_location.html
+++ b/httemplate/elements/tr-select-cust_location.html
@@ -2,24 +2,23 @@
Example:
- include('/elements/tr-select-cust_location.html',
- 'cgi' => $cgi,
+ <& /elements/tr-select-cust_location.html,
+ 'cgi' => $cgi,
- 'cust_main' => $cust_main,
- #or
- 'prospect_main' => $prospect_main,
+ 'cust_main' => $cust_main,
+ #or
+ 'prospect_main' => $prospect_main,
- #optional
- 'empty_label' => '(default service address)',
- )
+ #optional
+ 'empty_label' => '(default service address)',
+ &>
%doc>
-<% include('/elements/xmlhttp.html',
- 'url' => $p.'misc/location.cgi',
- 'subs' => [ 'get_location' ],
- )
-%>
+<& /elements/xmlhttp.html,
+ 'url' => $p.'misc/location.cgi',
+ 'subs' => [ 'get_location' ],
+&>
+<& /elements/location.html,
+ 'object' => $cust_location,
+ #'onchange' ? probably not
+ 'disabled' => $disabled,
+ 'no_asterisks' => 1,
+ 'no_bold' => $opt{'no_bold'},
+ 'alt_format' => $opt{'alt_format'},
+ 'enable_coords' => 1,
+ 'enable_censustract' => 1,
+&>
+
+% unless ( $prospect_main ) {
+
+% }
+
<%init>
my $conf = new FS::Conf;
@@ -257,9 +245,7 @@ if ( $cgi->param('error') ) {
my $editable = $cust_main ? 0 : 1; #could use explicit control
my $addnew = $cust_main ? 1 : ( $locationnum>0 ? 0 : 1 );
-my @location_fields = qw( address1 address2 city county state zip country
- latitude longitude
- );
+my @location_fields = FS::cust_main->location_fields;
if ( $opt{'alt_format'} ) {
push @location_fields, qw( location_type location_number location_kind );
}
@@ -281,9 +267,15 @@ if ( $locationnum && $locationnum > 0 ) {
}
}
+$cust_location->coord_auto('Y');
+
my $location_sort = sub {
+ #enabled w/label_prefix _location # $a->locationname cmp $b->locationname
+ # or
$a->country cmp $b->country
+ or lc($a->state) cmp lc($b->state)
or lc($a->city) cmp lc($b->city)
+ or lc($a->county) cmp lc($b->county)
or lc($a->address1) cmp lc($b->address1)
or lc($a->address2) cmp lc($b->address2)
};
@@ -298,7 +290,7 @@ push @cust_location, $cust_location
@cust_location = sort $location_sort grep !$_->disabled, @cust_location;
$cust_location = $cust_location[0]
- if ( $prospect_main )
+ if $prospect_main
&& !$opt{'is_optional'}
&& @cust_location;