Subversion Repositories eFlore/Applications.coel

Rev

Rev 1696 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1696 Rev 1721
Line 52... Line 52...
52
		$this->afficherResultatScript();
52
		$this->afficherResultatScript();
53
	}
53
	}
Line 54... Line 54...
54
	
54
	
55
	private function recupererStructures() {
55
	private function recupererStructures() {
56
		$this->bdd->requeter("USE ".Config::get("tables.bdd_nom_coel"));
56
		$this->bdd->requeter("USE ".Config::get("tables.bdd_nom_coel"));
57
		$requete =
57
		$requete = sprintf(
58
		"SELECT cs_id_structure, cs_nom, cs_code_postal, cs_ville ".
58
            "SELECT cs_id_structure, cs_nom, cs_code_postal, cs_ville FROM %s"
-
 
59
            . " JOIN coel_meta_liste_valeur ON cs_ce_truk_pays = cmlv_id_valeur"
59
		"FROM ".Config::get("tables.table_structures_coel")." ".
60
            . " WHERE cmlv_abreviation IN ('FR', 'RE', 'YT', 'GP', 'MQ', 'GF', 'NC')"
60
		"WHERE (cs_latitude IS NULL OR cs_latitude='0' OR Length(Trim(cs_latitude)) = 0) ".
61
            . " AND (cs_latitude IS NULL OR cs_latitude='0' OR Length(Trim(cs_latitude)) = 0)"
61
		"AND (cs_longitude IS NULL OR cs_longitude='0' OR Length(Trim(cs_longitude)) = 0) ".
62
            . " AND (cs_longitude IS NULL OR cs_longitude='0' OR Length(Trim(cs_longitude)) = 0)"
-
 
63
            . " ORDER BY cs_ville",
-
 
64
            Config::get("tables.table_structures_coel"));
62
		"AND cs_ce_truk_pays='2654' ORDER BY cs_ville;";
65
 
63
		$this->structures = $this->bdd->recupererTous($requete);
66
		$this->structures = $this->bdd->recupererTous($requete);
Line 64... Line 67...
64
	}
67
	}
65
	
68
	
Line 219... Line 222...
219
				$updates[] = "({$structure['cs_id_structure']},'{$structure['cs_code_postal']}',".
222
				$updates[] = "({$structure['cs_id_structure']},'{$structure['cs_code_postal']}',".
220
					$this->bdd->proteger($structure['cs_ville']).",'{$structure['latitude']}',".
223
					$this->bdd->proteger($structure['cs_ville']).",'{$structure['latitude']}',".
221
					"'{$structure['longitude']}')";
224
					"'{$structure['longitude']}')";
222
			} 
225
			} 
223
		}
226
		}
-
 
227
 
-
 
228
        if(!$updates) return;
-
 
229
 
224
		$sql = "INSERT INTO ".Config::get("tables.table_structures_coel")." (cs_id_structure, cs_code_postal, ".
230
		$sql = "INSERT INTO ".Config::get("tables.table_structures_coel")." (cs_id_structure, cs_code_postal, ".
225
		"cs_ville, cs_latitude, cs_longitude) VALUES ".implode(",", $updates)." ".
231
		"cs_ville, cs_latitude, cs_longitude) VALUES ".implode(",", $updates)." ".
226
		"ON DUPLICATE KEY UPDATE cs_code_postal=VALUES(cs_code_postal), cs_ville=VALUES(cs_ville), ".
232
		"ON DUPLICATE KEY UPDATE cs_code_postal=VALUES(cs_code_postal), cs_ville=VALUES(cs_ville), ".
227
		"cs_latitude=VALUES(cs_latitude), cs_longitude=VALUES(cs_longitude);";
233
		"cs_latitude=VALUES(cs_latitude), cs_longitude=VALUES(cs_longitude);";
228
		$this->bdd->requeter($sql);
234
		$this->bdd->requeter($sql);