Do not save latitudes and longitudes for empty addresses.
[platal.git] / classes / address.php
index 7080158..a532c8d 100644 (file)
@@ -596,6 +596,10 @@ class Address
             }
             $this->componentsIds = implode(',', $componants);
         }
+        if ($this->componentsIds == '') {
+            $this->latitude = null;
+            $this->longitude = null;
+        }
 
         return true;
     }
@@ -700,6 +704,12 @@ class Address
                                               VALUES  ({?}, {?}, {?}, {?}, {?}, {?})',
                                  $this->pid, $this->jobid, $this->groupid, $this->type, $this->id, $component_id);
                 }
+            } else {
+                // If the address was not geocoded, notifies it to the appropriate ML.
+                $mailer = new PlMailer('profile/no_geocoding.mail.tpl');
+                $mailer->assign('text', $this->text);
+                $mailer->assign('primary_key', $this->pid . '-' . $this->jobid . '-' . $this->groupid . '-' . $this->type . '-' . $this->id);
+                $mailer->send();
             }
 
             if ($this->type == self::LINK_PROFILE) {