From 3f96e56bc5e1a4857c16273be5e04af9ac09fa8f Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 23 Oct 2011 23:05:32 +0200 Subject: [PATCH] Do not notify non geocoded addresses if they are saved from a script. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- bin/formatAddresses.php | 2 +- classes/address.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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); -- 2.1.4