Quellcode durchsuchen

Recherche communes : intégration code commune

feature/export_comptable
Guillaume vor 4 Jahren
Ursprung
Commit
e6f2a93b1e
2 geänderte Dateien mit 16 neuen und 3 gelöschten Zeilen
  1. +4
    -1
      ShopBundle/Controller/CitiesController.php
  2. +12
    -2
      ShopBundle/Services/Utils.php

+ 4
- 1
ShopBundle/Controller/CitiesController.php Datei anzeigen

@@ -39,8 +39,11 @@ class CitiesController extends AbstractController

$return = [] ;
foreach($result as $city) {

$codesPostaux = $city->codesPostaux ;

$return[] = [
'label' => $city->nom,
'label' => '<span class="city">'.$city->nom.'</span> <span class="zip">'.$codesPostaux[0].'</span>',
'value' => $city->code
] ;
}

+ 12
- 2
ShopBundle/Services/Utils.php Datei anzeigen

@@ -252,10 +252,20 @@ class Utils
return $result;
}

public function getZipByCity($city)
public function getZipByCity($city, $code = null)
{
$zip = null ;
$returnCitiesSearchZip = json_decode($this->callCitiesApi('get', 'communes', ['nom' => $city, 'fields' => 'nom,codesPostaux'])) ;

$paramsSearch = [
'nom' => $city,
'fields' => 'nom,codesPostaux'
] ;

if($code != null && $code != 0) {
$paramsSearch['code'] = $code ;
}

$returnCitiesSearchZip = json_decode($this->callCitiesApi('get', 'communes', $paramsSearch)) ;

if($returnCitiesSearchZip) {
foreach($returnCitiesSearchZip as $citySearchZip) {

Laden…
Abbrechen
Speichern