summaryrefslogtreecommitdiff
path: root/httemplate/elements/coord-links.html
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-04-25 16:15:08 -0700
committerIvan Kohler <ivan@freeside.biz>2014-04-25 16:15:08 -0700
commit4bb41a18e2ad78c1422dca1298a6e6464c38f5fb (patch)
tree5e08daad620c9e8268dff1a5f5956ef4a179f7d0 /httemplate/elements/coord-links.html
parent207978f5897048e616e2c49a6e11cf8af35b0444 (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>