X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-cust_location.html;h=36ee7b6e5eb4025b067045c47ee0f070521fdbb7;hb=9d1c56465919772772ec8b11fec196c8506865bb;hp=7ffbd6c14a53720f2b806616379d94a577593a91;hpb=468c9e660eb0edb2033f0f8dbb4458f20280082c;p=freeside.git diff --git a/httemplate/elements/tr-select-cust_location.html b/httemplate/elements/tr-select-cust_location.html index 7ffbd6c14..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)', + &> -<% 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; @@ -258,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 ); } @@ -285,8 +270,12 @@ 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) }; @@ -301,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;