Browse Source

[Backend] Adresses : inBesanconLoop

feature/export_comptable
Guillaume 4 years ago
parent
commit
4e102a2f78
3 changed files with 22 additions and 5 deletions
  1. +2
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  2. +5
    -0
      ShopBundle/Resources/views/backend/default/block/form_address.html.twig
  3. +15
    -5
      ShopBundle/Services/Utils.php

+ 2
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml View File

email: Email email: Email
delivery: Livraison delivery: Livraison
maintenance: Maintenance maintenance: Maintenance
Address:
listLoopBesancon: Adresses de Besançon à spécifier (lat / long)




None: Aucune valeur None: Aucune valeur

+ 5
- 0
ShopBundle/Resources/views/backend/default/block/form_address.html.twig View File

<div class="col-12"> <div class="col-12">
{{ form_row(form.deliveryInfos) }} {{ form_row(form.deliveryInfos) }}
</div> </div>
{% if merchantUtils.getMerchantCurrent().isHubBesancon() %}
<div class="col-12">
{{ form_row(form.inBesanconLoop) }}
</div>
{% endif %}
<div class="col-6"> <div class="col-6">
{{ form_row(form.latitude) }} {{ form_row(form.latitude) }}
</div> </div>

+ 15
- 5
ShopBundle/Services/Utils.php View File



public function getGeocoderProvider() public function getGeocoderProvider()
{ {
$provider = false ;
$symfonyClient = new HttplugClient(); $symfonyClient = new HttplugClient();
$configGeocoderProvider = $this->parameterBag->get('geocoder.provider') ;


/* API du gouvernement */ /* API du gouvernement */
$provider = new Addok($symfonyClient, 'https://api-adresse.data.gouv.fr') ;

if($configGeocoderProvider == 'addok') {
$provider = new Addok($symfonyClient, 'https://api-adresse.data.gouv.fr') ;
}
/* Google Maps */ /* Google Maps */
//$provider = new GoogleMaps($symfonyClient, null, '') ;

elseif($configGeocoderProvider == 'googlemaps') {
$provider = new GoogleMaps($symfonyClient, null, $this->parameterBag->get('geocoder.api_key')) ;
}
/* Nominatim : OpenStreetMap */ /* Nominatim : OpenStreetMap */
//$provider = Nominatim::withOpenStreetMapServer($symfonyClient, 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion');
elseif($configGeocoderProvider == 'nominatim') {
$provider = Nominatim::withOpenStreetMapServer($symfonyClient, 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion');
}

if(!$provider) {
throw new \ErrorException('Aucun provider (geocoding) défini') ;
}


return $provider ; return $provider ;
} }

Loading…
Cancel
Save