From d44de0c43a075abac72153ab4bd8b0ee3e0278ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 24 Jun 2010 11:34:58 +0200 Subject: [PATCH] Fixes job addresses import formatting (Closes #1152). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- upgrade/newdirectory-0.0.1/addresses.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/upgrade/newdirectory-0.0.1/addresses.php b/upgrade/newdirectory-0.0.1/addresses.php index 209521f..01193d8 100755 --- a/upgrade/newdirectory-0.0.1/addresses.php +++ b/upgrade/newdirectory-0.0.1/addresses.php @@ -38,30 +38,31 @@ for ($pid = $minPid; $pid < $maxPid + 1; ++$pid) { while ($address = $res->next()) { $text = get_address_text($address); - XDB::iterator('UPDATE profile_addresses - SET text = {?} - WHERE pid = {?} AND type = {?} AND id = {?}', - $text, $pid, $address['pro'] ? 'job' : 'home', $address['id']); + XDB::execute('UPDATE profile_addresses + SET text = {?} + WHERE pid = {?} AND type = {?} AND id = {?}', + $text, $pid, $address['pro'] ? 'job' : 'home', $address['id']); } // Then deals with job addresses (located in #x4dat#.entreprises). - $res = XDB::iterator("SELECT e.entrid AS jobid, 0 AS id, e.adr1, e.adr2, e.adr3, + $res = XDB::iterator("SELECT e.entrid AS id, j.id AS jobid, e.adr1, e.adr2, e.adr3, e.postcode, e.city, e.cityid, e.region, e.regiontxt, e.adr_pub AS pub, e.country, gp.pays AS countrytxt, gp.display, e.glat AS precise_lat, e.glng AS precise_lon FROM #x4dat#.entreprises AS e INNER JOIN #x4dat#.geoloc_pays AS gp ON (gp.a2 = e.country) INNER JOIN account_profiles AS ap ON (e.uid = ap.uid AND FIND_IN_SET('owner', ap.perms)) + INNER JOIN profile_job_enum AS j ON (e.entreprise = j.name) WHERE ap.pid = {?} ORDER BY e.entrid", $pid); while ($address = $res->next()) { $text = get_address_text($address); - XDB::iterator('UPDATE profile_addresses - SET text = {?} - WHERE pid = {?} AND type = {?} AND id = {?} AND jobid = {?}', - $text, $pid, 'job', $address['id'], $address['jobid']); + XDB::execute('UPDATE profile_addresses + SET text = {?} + WHERE pid = {?} AND type = {?} AND id = {?} AND jobid = {?}', + $text, $pid, 'job', $address['id'], $address['jobid']); } } -- 2.1.4