Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 336 | Rev 340 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 336 Rev 339
Line 144... Line 144...
144
		$this->preparerTablePrChpFamille();
144
		$this->preparerTablePrChpFamille();
145
		$resultats = $this->recupererTuplesPrChpFamille();
145
		$resultats = $this->recupererTuplesPrChpFamille();
146
		$famille = array();
146
		$famille = array();
147
		$noms = array();
147
		$noms = array();
148
		$introuvables = array();
148
		$introuvables = array();
-
 
149
		$introuvablesSyno = array();
149
		foreach ($resultats as $nom) {
150
		foreach ($resultats as $id => $nom) {
150
			$nn = $nom['num_nom'];
151
			$nn = $nom['num_nom'];
-
 
152
			$nnr = $nom['num_nom_retenu'];
151
			$nts = $nom['num_tax_sup'];
153
			$nts = $nom['num_tax_sup'];
152
			$rg = $nom['rang'];
154
			$rg = $nom['rang'];
-
 
155
			if ($nnr != '') {
153
			if ($rg == '180') {
156
				if ($rg == '180') {
154
				$famille[$nn] = $nom['nom_sci'];
157
					$famille[$nn] = $nom['nom_sci'];
155
			} else {
158
				} else {
-
 
159
					if ($nn == $nnr) {// nom retenu
156
				if (isset($noms[$nts])) {
160
						if (isset($noms[$nts])) {
157
					$noms[$nn] = $noms[$nts];
161
							$noms[$nn] = $noms[$nts];
158
				} else if (isset($famille[$nts])) {
162
						} else if (isset($famille[$nts])) {
159
					$noms[$nn] = $famille[$nts];
163
							$noms[$nn] = $famille[$nts];
160
				} else {
164
						} else {
161
					$introuvables[] = $nn;
165
							$introuvables[] = $nn;
162
				}
166
						}
-
 
167
					} else {// nom synonyme
-
 
168
						if (isset($noms[$nnr])) {
-
 
169
							$noms[$nn] = $noms[$nnr];
-
 
170
						} else {
-
 
171
							$introuvablesSyno[] = $nom;
-
 
172
						}
-
 
173
					}
-
 
174
				}
163
			}
175
			}
-
 
176
			unset($resultats[$id]);
164
			$this->afficherAvancement("Attribution de leur famille aux noms en cours");
177
			$this->afficherAvancement("Attribution de leur famille aux noms en cours");
165
			if ($this->stopperLaBoucle($this->getParametre('t'))) break;
178
			if ($this->stopperLaBoucle($this->getParametre('t'))) break;
166
		}
179
		}
167
		echo "\n";
180
		echo "\n";
-
 
181
 
-
 
182
		foreach ($introuvablesSyno as $id => $nom) {
-
 
183
			$nn = $nom['num_nom'];
-
 
184
			$nnr = $nom['num_nom_retenu'];
-
 
185
			if (isset($noms[$nnr])) {
-
 
186
				$noms[$nn] = $noms[$nnr];
-
 
187
			} else {
-
 
188
				$introuvables[] = $nn;
-
 
189
			}
-
 
190
			unset($introuvablesSyno[$id]);
-
 
191
			$this->afficherAvancement("Attribution de leur famille aux synonymes en cours");
-
 
192
		}
-
 
193
		echo "\n";
-
 
194
 
168
		if ($introuvables != 0) {
195
		if (count($introuvables) != 0) {
-
 
196
			$introuvablesNbre = count($introuvables);
-
 
197
			echo "Famille introuvable pour $introuvablesNbre noms ! Voir le log.\n";
-
 
198
 
-
 
199
			$logContenu = implode(", \n", $introuvables);
-
 
200
			$logFichier = realpath(dirname(__FILE__)).'/log/famille_introuvable.log';
-
 
201
			echo $logFichier."\n";
-
 
202
			file_put_contents($logFichier, $logContenu);
-
 
203
		}
-
 
204
		if (count($introuvablesSyno) != 0) {
169
			$introuvables = implode(', ', $introuvables);
205
			//$introuvablesSyno = implode(', ', $introuvablesSyno);
-
 
206
			$introuvablesSyno = count($introuvablesSyno);
170
			echo "Parent introuvable pour les noms : $introuvables\n";
207
			echo "Synonyme avec nom retenu introuvable : $introuvablesSyno\n";
171
		}
208
		}
172
		$this->lancerRequeteModificationPrChpFamille($noms);
209
		$this->lancerRequeteModificationPrChpFamille($noms);
173
	}
210
	}
Line 174... Line 211...
174
	
211
 
Line 182... Line 219...
182
			$this->getBdd()->requeter($requete);
219
			$this->getBdd()->requeter($requete);
183
		}
220
		}
184
	}
221
	}
Line 185... Line 222...
185
	
222
 
186
	private function recupererTuplesPrChpFamille() {
223
	private function recupererTuplesPrChpFamille() {
187
		$requete = 'SELECT num_nom, num_tax_sup, rang, nom_sci '.
224
		$requete = 'SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci '.
188
				"FROM {$this->table} ".
225
				"FROM {$this->table} ".
189
				"WHERE rang >= 180 ".
226
				"WHERE rang >= 180 ".
190
				"	AND num_tax_sup != '' ".
227
				"ORDER BY rang ASC, num_tax_sup ASC , num_nom_retenu DESC ";
191
				"ORDER BY rang ASC,num_tax_sup ASC ";
228
		//echo $requete."\n";
192
		$resultat = $this->getBdd()->recupererTous($requete);
229
		$resultat = $this->getBdd()->recupererTous($requete);
193
		return $resultat;
230
		return $resultat;
Line 194... Line 231...
194
	}
231
	}