Example #1
0
     $zipcode = Maps::zipcodeSearch($adresse['zip'], $address['ville']);
     if (count($zipcode)) {
         $address['zip'] = $zipcode[0]['id'];
     } else {
         $zipcode = Maps::zipcodeNew($adresse['zip'], $address['ville']);
         $address['zip'] = $zipcode;
     }
 } 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;
Example #2
0
     }
     if (!empty($adresse['cp'])) {
         $zipcodes = Maps::zipcodeSearch($adresse['cp']);
         if (count($zipcodes)) {
             $address['zip'] = $zipcodes[0]['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