From: Stéphane Jacob Date: Sun, 23 Oct 2011 21:05:32 +0000 (+0200) Subject: Do not notify non geocoded addresses if they are saved from a script. X-Git-Tag: xorg/1.1.4~69 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=3f96e56bc5e1a4857c16273be5e04af9ac09fa8f;p=platal.git Do not notify non geocoded addresses if they are saved from a script. Signed-off-by: Stéphane Jacob --- diff --git a/bin/formatAddresses.php b/bin/formatAddresses.php index d207748..2e25835 100755 --- a/bin/formatAddresses.php +++ b/bin/formatAddresses.php @@ -116,7 +116,7 @@ while ($address = $it->next()) { $address->changed = ($geocoding_required ? 1 : 0); $address->format(); if ($address->delete()) { - $address->save(); + $address->save(false); } else { ++$skipped; } diff --git a/classes/address.php b/classes/address.php index 915152f..af0e2f0 100644 --- a/classes/address.php +++ b/classes/address.php @@ -685,7 +685,7 @@ class Address return (!$this->text || $this->text == ''); } - public function save() + public function save($notify_ungeocoded = true) { if (!$this->isEmpty()) { XDB::execute('INSERT IGNORE INTO profile_addresses (pid, jobid, groupid, type, id, flags, text, postalText, pub, comment, @@ -704,7 +704,7 @@ class Address VALUES ({?}, {?}, {?}, {?}, {?}, {?})', $this->pid, $this->jobid, $this->groupid, $this->type, $this->id, $component_id); } - } else { + } elseif ($notify_ungeocoded) { // 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);