X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fcoord-links.html;h=db04dad97787c47dd4d2c4b685416f9e4bc22911;hp=02a224a00124f1453e2408f962b538b0bb991f5e;hb=HEAD;hpb=d18cf10c30afa6dce46c31cb87a1733202518cb8 diff --git a/httemplate/elements/coord-links.html b/httemplate/elements/coord-links.html index 02a224a00..db04dad97 100644 --- a/httemplate/elements/coord-links.html +++ b/httemplate/elements/coord-links.html @@ -23,22 +23,37 @@ <%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. ';lon='. $longitude; my $js_name = $name; -$js_name =~ s/[<>"]/ /g; +$js_name =~ s/[<>"']/ /g; $m->interp->apply_escapes($js_name, 'js_string'); $js_name =~ s/^'//; $js_name =~ s/'$//; -my $origin; +my $conf = new FS::Conf; +my $apikey = $conf->config('google_maps_api_key'); + #for directions link -if ( $agentnum =~ /^\d+$/ ) { - $origin = FS::Conf->new->config('company_address', $agentnum); - $origin = uri_escape($origin); -} +my @origin = $opt{company_address} + ? @{ $opt{company_address} } + : ( $conf->config('company_physical_address', $agentnum) + ? $conf->config('company_physical_address', $agentnum) + : $conf->config('company_address', $agentnum) ); +my $origin = uri_escape(join(',', @origin)); +