} else { $address['zip'] = null; } if (!is_null($adresse['street'])) { $street = Maps::streetSearch($adresse['street'], $address['ville']); if (count($street)) { $address['street'] = $street[0]['id']; } else { $street = Maps::streetCreate($adresse['street'], $address['ville']); $address['street'] = $street; } } else { $address['street'] = null; } if (!is_null($adresse['building'])) { $building = Maps::buildingSearch($adresse['building'], $address['street']); if (count($building)) { $address['building'] = $building[0]['id']; } else { $building = Maps::buildingNew($adresse['building'], $address['street']); $address['building'] = $building; } } else { $address['building'] = null; } // On lance la création de l'adresse Maps::addressNew($person->get('id'), $address['ville'], $address['zip'], $address['street'], $address['building'], 'reel'); $person->contact_details_add($contact['MAIL']); $person->tag_add('Sénateur PS'); $person->tag_add($contact['REGION']); $query = $link->prepare('DELETE FROM `TABLE 30` WHERE `id` = :id');
} else { $zipcode = Maps::zipcodeNew($adresse['cp'], $address['city']); $address['zip'] = $zipcode; } } if (!empty($adresse['rue'])) { $streets = Maps::streetSearch($adresse['rue'], $address['city']); if (count($streets)) { $address['street'] = $streets[0]['id']; } else { $street = Maps::streetCreate($adresse['rue'], $address['city']); $address['street'] = $street; } } if (!empty($adresse['numero']) && !is_null($adresse['numero'])) { $buildings = Maps::buildingSearch($adresse['numero'], $address['street']); if (count($buildings)) { $address['building'] = $buildings[0]['id']; } else { $building = Maps::buildingNew($adresse['numero'], $address['street']); $address['building'] = $building; } } Maps::addressNew($person->get('id'), $address['city'], $address['zip'], $address['street'], $address['building'], 'reel'); } // On rajoute les coordonnées téléphoniques if (!empty($contact['Téléphonebureau'])) { $person->contact_details_add($contact['Téléphonebureau'], 'fixe'); } if (!empty($contact['Téléphone2bureau'])) { $person->contact_details_add($contact['Téléphone2bureau'], 'fixe');