Projet

Général

Profil

0001-misc-look-for-address-details-in-more-attributes-434.patch

Frédéric Péters, 29 mai 2020 09:34

Télécharger (2,13 ko)

Voir les différences:

Subject: [PATCH] misc: look for address details in more attributes (#43446)

 wcs/qommon/static/js/qommon.geolocation.js | 24 +++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
wcs/qommon/static/js/qommon.geolocation.js
59 59
    var data = $('.JsonpSingleSelectWidget.template-address select').select2('data');
60 60
    if (data) {
61 61
      var number_and_street = null;
62
      if (data[0].address.house_number && data[0].address.road) {
63
        number_and_street = data[0].address.house_number + ' ' + data[0].address.road;
62
      var address = undefined;
63
      if (typeof data[0].address == "object") {
64
        address = data[0].address;
64 65
      } else {
65
        number_and_street = data[0].address.road;
66
        address = data[0];
67
      }
68
      var road = address.road || address.nom_rue;
69
      var house_number = address.house_number || address.numero;
70
      var city = address.city || address.nom_commune;
71
      var postcode = address.postcode || address.code_postal;
72
      if (house_number && road) {
73
        number_and_street = house_number + ' ' + road;
74
      } else {
75
        number_and_street = road;
66 76
      }
67 77
      geoloc_prefill('number-and-street', number_and_street);
68
      geoloc_prefill('house', data[0].address.house_number);
69
      geoloc_prefill('road', data[0].address.road);
70
      geoloc_prefill('city', data[0].address.city);
71
      geoloc_prefill('postcode', data[0].address.postcode);
78
      geoloc_prefill('house', house_number);
79
      geoloc_prefill('road', road);
80
      geoloc_prefill('city', city);
81
      geoloc_prefill('postcode', postcode);
72 82
    }
73 83
  });
74 84
  if ($('.qommon-map').length == 0 && $('.JsonpSingleSelectWidget.template-address').length == 0) {
75
-