Esempio n. 1
0
 public function format()
 {
     $this->text = trim($this->text);
     $this->phones = Phone::formatFormArray($this->phones, $this->error, $this->pub);
     if ($this->removed == 1) {
         if (!S::user()->checkPerms('directory_private') && Phone::hasPrivate($this->phones)) {
             Platal::page()->trigWarning("L'adresse ne peut être supprimée car elle contient des informations pour lesquelles vous n'avez le droit d'édition.");
         } else {
             $this->text = '';
             return true;
         }
     }
     $this->formatPostalAddress();
     if ($this->changed == 1) {
         $gmapsGeocoder = new GMapsGeocoder();
         $gmapsGeocoder->getGeocodedAddress($this);
         $componants = array();
         foreach ($this->components as $component) {
             $componants[] = Geocoder::getComponentId($component);
         }
         $this->componentsIds = implode(',', $componants);
     }
     if ($this->componentsIds == '') {
         $this->latitude = null;
         $this->longitude = null;
     }
     return true;
 }