Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision df601bd3

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID df601bd3fcca2c121c54f489e504dd676da75876
  • Vorgänger 52e39117
  • Nachfolger 0d33a925

Kunden-/Lieferantenstammdaten: Maps-Link mit Firmenadresse als Routing-Ausgang

Unterschiede anzeigen:

SL/Controller/CustomerVendor.pm
880 880
  $self->{cv}->name($name);
881 881
}
882 882

  
883
sub home_address_for_google_maps {
884
  my ($self)  = @_;
885

  
886
  my $address = $::instance_conf->get_address // '';
887
  $address    =~ s{^\s+|\s+$|\r+}{}g;
888
  $address    =~ s{\n+}{,}g;
889
  $address    =~ s{\s+}{ }g;
890

  
891
  return $address;
892
}
893

  
883 894
1;
js/kivi.CustomerVendor.js
77 77
    '#country'
78 78
  ];
79 79

  
80
  this.MapWidget = function(prefix)
80
  this.MapWidget = function(prefix, source_address)
81 81
  {
82 82
    var $mapSearchElements = [];
83 83
    var $widgetWrapper;
......
117 117
          searchString += stmt;
118 118
      }
119 119

  
120
      var url = 'https://maps.google.com/maps?q='+ encodeURIComponent(searchString);
120
      source_address = source_address || '';
121
      var query      = source_address != '' ? 'saddr=' + encodeURIComponent(source_address) + '&daddr=' : 'q=';
122
      var url        = 'https://maps.google.com/maps?' + query + encodeURIComponent(searchString);
121 123

  
122 124
      window.open(url, '_blank');
123 125
      window.focus();
templates/webpages/customer_vendor/tabs/billing.html
2 2
[%- USE HTML %]
3 3
[%- USE LxERP %]
4 4
[%- USE L %]
5
[%- USE JavaScript -%]
5 6

  
6 7
<div id="billing">
7 8
  <table width="100%">
......
88 89
        [% L.input_tag('cv.street', SELF.cv.street, size = 35) %]
89 90
        <span id="billing_map"></span>
90 91
        <script type="text/javascript">
91
          billingMapWidget = new kivi.CustomerVendor.MapWidget('cv_');
92
          billingMapWidget = new kivi.CustomerVendor.MapWidget('cv_', '[% JavaScript.escape(SELF.home_address_for_google_maps) %]');
92 93
          $(function() {
93 94
            billingMapWidget.render($('#billing_map'));
94 95
          });

Auch abrufbar als: Unified diff