summaryrefslogtreecommitdiff
path: root/httemplate/elements/coord-links.html
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-04-25 16:14:47 -0700
committerIvan Kohler <ivan@freeside.biz>2014-04-25 16:14:47 -0700
commitc931539d1b09590c37576efff8128ae9095c758a (patch)
treecd6160088b63c1db7395bcf20f30ec93789bf9a8 /httemplate/elements/coord-links.html
parent4b2a48f5247303f07a00b42eb3091145be1150e2 (diff)
optimize package view with tons of packages, RT#28526
Diffstat (limited to 'httemplate/elements/coord-links.html')
-rw-r--r--httemplate/elements/coord-links.html24
1 files changed, 16 insertions, 8 deletions
diff --git a/httemplate/elements/coord-links.html b/httemplate/elements/coord-links.html
index 4c263c638..c885ade87 100644
--- a/httemplate/elements/coord-links.html
+++ b/httemplate/elements/coord-links.html
@@ -23,7 +23,17 @@
<%init>
-my ($latitude, $longitude, $name, $agentnum) = @_;
+my %opt = ();
+my ($latitude, $longitude, $name, $agentnum);
+if ( ref($_[0]) ) {
+ %opt = %{ $_[0] };
+ $latitude = $opt{latitude};
+ $longitude = $opt{longitude};
+ $name = $opt{name};
+ $agentnum = $opt{agentnum};
+} else {
+ ($latitude, $longitude, $name, $agentnum) = @_;
+}
my $query = 'name='. uri_escape_utf8($name).
';lat='. $latitude.
@@ -35,12 +45,10 @@ $m->interp->apply_escapes($js_name, 'js_string');
$js_name =~ s/^'//;
$js_name =~ s/'$//;
-my @origin;
-my $origin;
#for directions link
-if ( $agentnum =~ /^\d+$/ ) {
- @origin = FS::Conf->new->config('company_address', $agentnum);
- $origin = join (/,/,@origin);
- $origin = uri_escape($origin);
-}
+my @origin = $opt{company_address}
+ ? @{ $opt{company_address} }
+ : FS::Conf->new->config('company_address', $agentnum);
+my $origin = uri_escape(join(',', @origin));
+
</%init>