From: Stéphane Jacob Date: Sun, 5 Jun 2011 18:50:04 +0000 (+0200) Subject: Activates geocoding reminder for new geocoding. X-Git-Tag: xorg/1.1.2~49 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=6859200d482b72f9dc6483a3c27621d6e945736d;p=platal.git Activates geocoding reminder for new geocoding. Signed-off-by: Stéphane Jacob --- diff --git a/classes/geocoder.php b/classes/geocoder.php index c5ff63e..01d5e3e 100644 --- a/classes/geocoder.php +++ b/classes/geocoder.php @@ -73,6 +73,20 @@ abstract class Geocoder { } return $firstLines; } + + // Returns the number of non geocoded addresses for a profile. + static public function countNonGeocoded($pid) + { + $count = XDB::fetchOneCell('SELECT COUNT(*) + FROM profile_addresses AS pa + WHERE pid = {?} AND type = \'home\' + AND NOT EXISTS (SELECT * + FROM profile_addresses_components AS pc + WHERE pa.pid = pc.pid AND pa.jobid = pc.jobid AND pa.groupid = pc.groupid + AND pa.type = pc.type AND pa.id = pc.id)', + $pid); + return $count; + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/include/reminder/profile_update.inc.php b/include/reminder/profile_update.inc.php index c1ab4df..3785b6d 100644 --- a/include/reminder/profile_update.inc.php +++ b/include/reminder/profile_update.inc.php @@ -103,7 +103,8 @@ class ReminderProfileUpdate extends Reminder return false; } return !$profile->has_photo || $profile->is_old - || !is_null(self::ListMergeIssues($profile)); + || !is_null(self::ListMergeIssues($profile)) + || Geocoder::countNonGeocoded($profile->id()) > 0; } }