$self->{cv}->name($name);
}
+sub home_address_for_google_maps {
+ my ($self) = @_;
+
+ my $address = $::instance_conf->get_address // '';
+ $address =~ s{^\s+|\s+$|\r+}{}g;
+ $address =~ s{\n+}{,}g;
+ $address =~ s{\s+}{ }g;
+
+ return $address;
+}
+
1;
'#country'
];
- this.MapWidget = function(prefix)
+ this.MapWidget = function(prefix, source_address)
{
var $mapSearchElements = [];
var $widgetWrapper;
searchString += stmt;
}
- var url = 'https://maps.google.com/maps?q='+ encodeURIComponent(searchString);
+ source_address = source_address || '';
+ var query = source_address != '' ? 'saddr=' + encodeURIComponent(source_address) + '&daddr=' : 'q=';
+ var url = 'https://maps.google.com/maps?' + query + encodeURIComponent(searchString);
window.open(url, '_blank');
window.focus();
[%- USE HTML %]
[%- USE LxERP %]
[%- USE L %]
+[%- USE JavaScript -%]
<div id="billing">
<table width="100%">
[% L.input_tag('cv.street', SELF.cv.street, size = 35) %]
<span id="billing_map"></span>
<script type="text/javascript">
- billingMapWidget = new kivi.CustomerVendor.MapWidget('cv_');
+ billingMapWidget = new kivi.CustomerVendor.MapWidget('cv_', '[% JavaScript.escape(SELF.home_address_for_google_maps) %]');
$(function() {
billingMapWidget.render($('#billing_map'));
});