if (empty($adresse['zip'])) { $adresse['zip'] = null; } if (empty($adresse['street'])) { $adresse['street'] = null; } if (empty($adresse['building'])) { $adresse['building'] = null; } $address = array('pays' => '', 'ville' => '', 'zip' => '', 'street' => '', 'building' => ''); if (!is_null($adresse['pays'])) { $countries = Maps::countrySearch($adresse['pays']); if (count($countries)) { $address['pays'] = $countries[0]['id']; } else { $country = Maps::countryCreate($adresse['pays']); $address['pays'] = $country; } } else { $address['pays'] = null; } if (!is_null($adresse['ville'])) { $city = Maps::citySearch($adresse['ville'], $address['pays']); if (count($city)) { $address['ville'] = $city[0]['id']; } else { $city = Maps::cityCreate($adresse['ville'], $address['pays']); $address['ville'] = $city; } } else { $address['ville'] = null;