Subversion Repositories Applications.referentiel

Rev

Rev 225 | Rev 252 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 225 Rev 250
1
<?php
1
<?php
2
// Encodage : UTF-8
2
// Encodage : UTF-8
3
// +-------------------------------------------------------------------------------------------------------------------+
3
// +-------------------------------------------------------------------------------------------------------------------+
4
/**
4
/**
5
* Tests de référentiels de nomenclature et taxonomie
5
* Tests de référentiels de nomenclature et taxonomie
6
*
6
*
7
* Description : classe permettant de tester les référentiels selon le manuel technique
7
* Description : classe permettant de tester les référentiels selon le manuel technique
8
* Utilisation : php script.php tests -p bdnff -a tout
8
* Utilisation : php script.php tests -p bdnff -a tout
9
*
9
*
10
//Auteur original :
10
//Auteur original :
11
* @author       Jean-Pascal MILCENT <jpm@tela-botanica.org>
11
* @author       Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
* @copyright	Tela-Botanica 1999-2010
12
* @copyright	Tela-Botanica 1999-2010
13
* @link			http://www.tela-botanica.org/wikini/RTaxMethodo/wakka.php?wiki=MaNuel
13
* @link			http://www.tela-botanica.org/wikini/RTaxMethodo/wakka.php?wiki=MaNuel
14
* @licence		GPL v3 & CeCILL v2
14
* @licence		GPL v3 & CeCILL v2
15
* @version		$Id$
15
* @version		$Id$
16
*/
16
*/
17
// +-------------------------------------------------------------------------------------------------------------------+
17
// +-------------------------------------------------------------------------------------------------------------------+
18
// TODO : supprimer l'utilisation du paramêtres 'p' et chercher les infos depuis la bdd
18
// TODO : supprimer l'utilisation du paramêtres 'p' et chercher les infos depuis la bdd
19
class Tests extends ScriptCommande {
19
class Tests extends ScriptCommande {
20
	
20
	
21
	const SCRIPT_NOM = 'tests';
21
	const SCRIPT_NOM = 'tests';
22
	const MANUEL_VERSION = '4.3';
22
	const MANUEL_VERSION = '4.3';
23
	
23
	
24
	private $projet = null;
24
	private $projet = null;
25
	private $traitement = null;
25
	private $traitement = null;
26
	
26
	
27
	private $manuel = null;
27
	private $manuel = null;
28
	private $manuel_nom = null;
28
	private $manuel_nom = null;
29
	private $manuel_chemin = null;
29
	private $manuel_chemin = null;
30
	private $tests = null;
30
	private $tests = null;
31
	private $colonnes = null;
31
	private $colonnes = null;
32
	private $analyses = null;
32
	private $analyses = null;
33
	private $noms = null;
33
	private $noms = null;
34
	
34
	
35
	private $resultatDao = null;
35
	private $resultatDao = null;
36
	private $traitementDao = null;
36
	private $traitementDao = null;
37
	private $tableStructureDao = null;
37
	private $tableStructureDao = null;
38
	private $referentielDao = null;
38
	private $referentielDao = null;
39
	
39
	
40
	public function executer() {
40
	public function executer() {
41
		$this->manuel_nom = 'mtpr_v'.str_replace('.', '_', self::MANUEL_VERSION).'.pdf';
41
		$this->manuel_nom = 'mtpr_v'.str_replace('.', '_', self::MANUEL_VERSION).'.pdf';
42
		$this->manuel_chemin = Config::get('chemin_appli').DS.'..'.DS.'configurations'.DS;
42
		$this->manuel_chemin = Config::get('chemin_appli').DS.'..'.DS.'configurations'.DS;
43
		
43
		
44
		$manuel_config_nom = 'referentiel_v'.self::MANUEL_VERSION.'.ini';
44
		$manuel_config_nom = 'referentiel_v'.self::MANUEL_VERSION.'.ini';
45
		$this->manuel = parse_ini_file($this->manuel_chemin.$manuel_config_nom);
45
		$this->manuel = parse_ini_file($this->manuel_chemin.$manuel_config_nom);
46
		
46
		
47
		$this->definirConstantes();
47
		$this->definirConstantes();
48
		$this->tests = parse_ini_file($this->getModuleChemin().DS.'configurations'.DS.'tests.ini', true);
48
		$this->tests = parse_ini_file($this->getModuleChemin().DS.'configurations'.DS.'tests.ini', true);
49
		
49
		
50
		$this->resultatDao = new ResultatDao();
50
		$this->resultatDao = new ResultatDao();
51
		$this->traitementDao = new TraitementDao();
51
		$this->traitementDao = new TraitementDao();
52
		Debug::printr('Dans le script test');
52
		Debug::printr('Dans le script test');
53
		// Récupération du dernier traitement demandé
53
		// Récupération du dernier traitement demandé
54
		$this->traitement = $this->traitementDao->getDernierTraitement('tout', self::SCRIPT_NOM);
54
		$this->traitement = $this->traitementDao->getDernierTraitement('tout', self::SCRIPT_NOM);
55
		if (isset($this->traitement)) {
55
		if (isset($this->traitement)) {
56
			$this->projet = $this->traitement['referentiel_code']; // Récupération du nom de projet
56
			$this->projet = $this->traitement['referentiel_code']; // Récupération du nom de projet
57
			Debug::printr($this->traitement);
57
			Debug::printr($this->traitement);
58
			// Écriture de la date de début du traitement
58
			// Écriture de la date de début du traitement
59
			Debug::printr('Debute:'.$this->traitementDao->debuterTraitement($this->traitement['id_traitement']));
59
			Debug::printr('Debute:'.$this->traitementDao->debuterTraitement($this->traitement['id_traitement']));
60
			
60
			
61
			// Nettoyage des traitements obsolètes
61
			// Nettoyage des traitements obsolètes
62
			$traitements_obsoletes = $this->traitementDao->getTraitementsObsoletes($this->projet, self::SCRIPT_NOM);
62
			$traitements_obsoletes = $this->traitementDao->getTraitementsObsoletes($this->projet, self::SCRIPT_NOM);
63
			if (isset($traitements_obsoletes)) {
63
			if (isset($traitements_obsoletes)) {
64
				Debug::printr('Supp. obsoletes:'.$this->traitementDao->supprimer($traitements_obsoletes));
64
				Debug::printr('Supp. obsoletes:'.$this->traitementDao->supprimer($traitements_obsoletes));
65
			}
65
			}
66
			
66
			
67
			$this->tableStructureDao = new TableStructureDao();
67
			$this->tableStructureDao = new TableStructureDao();
68
			$this->referentielDao = new ReferentielDao();
68
			$this->referentielDao = new ReferentielDao();
69
			
69
			
70
			// Lancement du test demandé
70
			// Lancement du test demandé
71
			$cmd = $this->getParam('a');
71
			$cmd = $this->getParam('a');
72
	    	switch ($cmd) {
72
	    	switch ($cmd) {
73
				case 'tout' :
73
				case 'tout' :
74
					Debug::printr('Départ lancement test:');
74
					Debug::printr('Départ lancement test:');
75
					$this->recupererDonnees();
75
					$this->recupererDonnees();
76
					$this->lancerTestsAuto();
76
					$this->lancerTestsAuto();
77
					break;
77
					break;
78
				case 'test11' :
78
				case 'test11' :
79
					$this->recupererDonnees();
79
					$this->recupererDonnees();
80
					Debug::printr('Départ lancement test 11 :');
80
					Debug::printr('Départ lancement test 11 :');
81
					$this->testerExitenceTaxonSuperieurTransmis();
81
					$this->testerExitenceTaxonSuperieurTransmis();
82
					break;
82
					break;
83
				default :
83
				default :
84
					$this->traiterErreur('Erreur : la commande "%s" n\'existe pas!', array($cmd));
84
					$this->traiterErreur('Erreur : la commande "%s" n\'existe pas!', array($cmd));
85
			}
85
			}
86
			// Écriture de la date de fin du traitement
86
			// Écriture de la date de fin du traitement
87
			Debug::printr('Termine:'.$this->traitementDao->terminerTraitement($this->traitement['id_traitement']));
87
			Debug::printr('Termine:'.$this->traitementDao->terminerTraitement($this->traitement['id_traitement']));
88
		} else {
88
		} else {
89
			Debug::printr("Aucun dernier traitement trouvé pour le script '".self::SCRIPT_NOM."' !");
89
			Debug::printr("Aucun dernier traitement trouvé pour le script '".self::SCRIPT_NOM."' !");
90
		}
90
		}
91
    }
91
    }
92
    
92
    
93
    /**
93
    /**
94
     * Cette méthode définie des constantes qui peuvent ensuite être utilisée dans les fichier ini.
94
     * Cette méthode définie des constantes qui peuvent ensuite être utilisée dans les fichier ini.
95
     * Surtout utile pour le fichier tests.ini
95
     * Surtout utile pour le fichier tests.ini
96
     */
96
     */
97
    private function definirConstantes() {
97
    private function definirConstantes() {
98
    	define('RANG_GENRE', $this->manuel['rang_genre']);
98
    	define('RANG_GENRE', $this->manuel['rang_genre']);
99
    	define('RANG_SP', $this->manuel['rang_sp']);
99
    	define('RANG_SP', $this->manuel['rang_sp']);
100
    	date_default_timezone_set('Europe/Berlin');
100
    	date_default_timezone_set('Europe/Berlin');
101
    	define('ANNEE_EN_COURS', date('Y'));
101
    	define('ANNEE_EN_COURS', date('Y'));
102
    	define('ANNEE_MINIMUM', 1753);
102
    	define('ANNEE_MINIMUM', 1753);
103
    }
103
    }
104
    
104
    
105
    public function recupererDonnees() {
105
    public function recupererDonnees() {
106
		// Récupération des données à tester
106
		// Récupération des données à tester
107
		$this->colonnes = $this->tableStructureDao->getColonnes($this->projet);
107
		$this->colonnes = $this->tableStructureDao->getColonnes($this->projet);
108
		$this->analyses = $this->tableStructureDao->getAnalyse($this->projet);
108
		$this->analyses = $this->tableStructureDao->getAnalyse($this->projet);
109
		$this->noms = $this->referentielDao->getTout($this->projet);
109
		$this->noms = $this->referentielDao->getTout($this->projet);
110
		Debug::printr('Nbre noms :'.count($this->noms));
110
		Debug::printr('Nbre noms :'.count($this->noms));
111
    }
111
    }
112
    
112
    
113
    public function lancerTestsAuto() {
113
    public function lancerTestsAuto() {
114
		$resultats = array();
114
		$resultats = array();
115
 
115
 
116
		// Lancement des tests unitaires
116
		// Lancement des tests unitaires
117
		Debug::printr('Lancement des tests unitaires');
117
		Debug::printr('Lancement des tests unitaires');
118
		$tests_numeros = array_keys($this->tests);
118
		$tests_numeros = array_keys($this->tests);
119
		Debug::printr($tests_numeros);
119
		Debug::printr($tests_numeros);
120
    	foreach ($tests_numeros as &$numero) {
120
    	foreach ($tests_numeros as &$numero) {
121
			$info = $this->getInfosTest($numero);
121
			$info = $this->getInfosTest($numero);
122
    		
122
    		
123
    		if ($numero < 5) {
123
    		if ($numero < 5) {
124
    			// Tests spéciaux vérifiant la structure de la table
124
    			// Tests spéciaux vérifiant la structure de la table
125
    			$resultats[] = $this->lancerTestUnitaire($info);
125
    			$resultats[] = $this->lancerTestUnitaire($info);
126
    		} else if ($numero >= 5 && $this->verifierResultats($resultats)) {		
126
    		} else if ($numero >= 5 && $this->verifierResultats($resultats)) {		
127
				// Si la structure est bonne nous lançons les autres tests
127
				// Si la structure est bonne nous lançons les autres tests
128
				$this->lancerTestUnitaire($info);
128
				$this->lancerTestUnitaire($info);
129
    		}
129
    		}
130
		}
130
		}
131
    }
131
    }
132
	
132
	
133
    private function getInfosTest($numero) {
133
    private function getInfosTest($numero) {
134
		$info = $this->tests[$numero];
134
		$info = $this->tests[$numero];
135
		$info['methode'] = 'tester'.implode('', explode(' ', ucwords($info['abr'])));
135
		$info['methode'] = 'tester'.implode('', explode(' ', ucwords($info['abr'])));
136
		$info['numero'] = $numero;
136
		$info['numero'] = $numero;
137
		$info['nom'] = '#'.$numero.' - '.$info['nom'];
137
		$info['nom'] = '#'.$numero.' - '.$info['nom'];
138
		$info['resultat'] = false;
138
		$info['resultat'] = false;
139
		return $info;
139
		return $info;
140
	}
140
	}
141
    
141
    
142
    public function lancerTestUnitaire($info) {
142
    public function lancerTestUnitaire($info) {
143
		Debug::printr($info['numero'].'::'.$info['methode']);
143
		Debug::printr($info['numero'].'::'.$info['methode']);
144
    	$methodeDeTest = $info['methode'];
144
    	$methodeDeTest = $info['methode'];
145
    	$erreurs = $this->$methodeDeTest();
145
    	$erreurs = $this->$methodeDeTest();
146
    	
146
    	
147
    	// Analyse des résultats
147
    	// Analyse des résultats
148
    	if (isset($erreurs['special'])) {
148
    	if (isset($erreurs['special'])) {
149
    		$info = $erreurs;
149
    		$info = $erreurs;
150
    	} else {
150
    	} else {
151
    		if (count($erreurs) > 0) {
151
    		if (count($erreurs) > 0) {
152
				$info['message']['entete'] = explode(',', $info['entete']);
152
				$info['message']['entete'] = explode(',', $info['entete']);
153
				if (isset($info['title'])) {
153
				if (isset($info['title'])) {
154
					$info['message']['title'] = explode(';', $info['title']);
154
					$info['message']['title'] = explode(';', $info['title']);
155
				}
155
				}
156
				$info['message']['lignes'] = $erreurs;
156
				$info['message']['lignes'] = $erreurs;
157
				unset($erreurs);
157
				unset($erreurs);
158
			} else {
158
			} else {
159
				$info['resultat'] = true;
159
				$info['resultat'] = true;
160
			}
160
			}
161
    	}
161
    	}
162
    	
162
    	
163
		$this->traiterResultatTest($info);
163
		$this->traiterResultatTest($info);
164
		
164
		
165
		if ($info['numero'] < 5) {
165
		if ($info['numero'] < 5) {
166
			return ($info['resultat'] ? '1' : '0');
166
			return ($info['resultat'] ? '1' : '0');
167
		}
167
		}
168
    }
168
    }
169
	
169
	
170
	private function verifierResultats(&$resultats) {
170
	private function verifierResultats(&$resultats) {
171
		$ok = true;
171
		$ok = true;
172
		foreach ($resultats as $resultat) {
172
		foreach ($resultats as $resultat) {
173
			if ($resultat == '0') {
173
			if ($resultat == '0') {
174
				$ok = false;
174
				$ok = false;
175
				break;
175
				break;
176
			}
176
			}
177
		}
177
		}
178
		return $ok;
178
		return $ok;
179
	}
179
	}
180
	
180
	
181
	private function traiterResultatTest($info) {
181
	private function traiterResultatTest($info) {
182
		if (isset($info['message'])) {
182
		if (isset($info['message'])) {
183
			if (is_array($info['message'])) {
183
			if (is_array($info['message'])) {
184
				$erreurs_nbre = count($info['message']['lignes']);
184
				$erreurs_nbre = count($info['message']['lignes']);
185
				$erreurs_max = 1000;
185
				$erreurs_max = 1000;
186
				if ($erreurs_nbre > $erreurs_max) {
186
				if ($erreurs_nbre > $erreurs_max) {
187
					$info['message']['lignes'] = array_slice($info['message']['lignes'], 0, $erreurs_max);
187
					$info['message']['lignes'] = array_slice($info['message']['lignes'], 0, $erreurs_max);
188
					$info['erreur'] = "$erreurs_nbre erreurs ont été détectées seules les $erreurs_max premières sont affichées";
188
					$info['erreur'] = "$erreurs_nbre erreurs ont été détectées seules les $erreurs_max premières sont affichées";
189
				}
189
				}
190
				$info['message'] = $this->getVue('tests/squelettes/message_table', $info);
190
				$info['message'] = $this->getVue('tests/squelettes/message_table', $info);
191
			} else {
191
			} else {
192
				$info['message'] = $this->getVue('tests/squelettes/message_p', $info);
192
				$info['message'] = $this->getVue('tests/squelettes/message_p', $info);
193
			}
193
			}
194
		}
194
		}
195
		Debug::printr($this->resultatDao->ajouter($this->traitement['id_traitement'], $info));
195
		Debug::printr($this->resultatDao->ajouter($this->traitement['id_traitement'], $info));
196
		$info = null;
196
		$info = null;
197
	}
197
	}
198
	
198
	
199
	//+--------------------------------------------------------------------------------------------------------------+//
199
	//+--------------------------------------------------------------------------------------------------------------+//
200
	// TESTS
200
	// TESTS
201
	
201
	
202
	/**
202
	/**
203
	 * Test #01
203
	 * Test #01
204
	 */
204
	 */
205
	private function testerNombreDeChamps() {
205
	private function testerNombreDeChamps() {
206
		$info = $this->getInfosTest(1);
206
		$info = $this->getInfosTest(1);
207
		$info['special'] = true;
207
		$info['special'] = true;
208
		
208
		
209
		$nbre_colonnes = count($this->colonnes);
209
		$nbre_colonnes = count($this->colonnes);
210
		$info['message'] = $nbre_colonnes;
210
		$info['message'] = $nbre_colonnes;
211
		if ($nbre_colonnes >= 35) {
211
		if ($nbre_colonnes >= 35) {
212
			$info['resultat'] = true;
212
			$info['resultat'] = true;
213
		}
213
		}
214
		
214
		
215
		return $info;
215
		return $info;
216
	}
216
	}
217
	
217
	
218
	/**
218
	/**
219
	 * Test #02
219
	 * Test #02
220
	 */
220
	 */
221
	private function testerNomDesChamps() {
221
	private function testerNomDesChamps() {
222
		$info = $this->getInfosTest(2);
222
		$info = $this->getInfosTest(2);
223
		$info['special'] = true;
223
		$info['special'] = true;
224
		
224
		
225
		$champs_attendus = explode(',', $this->manuel['champs']);
225
		$champs_attendus = explode(',', $this->manuel['champs']);
226
		$champs_presents = array();
226
		$champs_presents = array();
227
		foreach ($this->colonnes as &$colonne) {
227
		foreach ($this->colonnes as &$colonne) {
228
			$champs_presents[$colonne['Field']] = $colonne;
228
			$champs_presents[$colonne['Field']] = $colonne;
229
		}
229
		}
230
		
230
		
231
		$ok = true;
231
		$ok = true;
232
		$champs_manquant = array(); 
232
		$champs_manquant = array(); 
233
		foreach ($champs_attendus as &$champ_attendu) {
233
		foreach ($champs_attendus as &$champ_attendu) {
234
			if (!isset($champs_presents[$champ_attendu])) {
234
			if (!isset($champs_presents[$champ_attendu])) {
235
				$champs_manquant[] = $champ_attendu; 
235
				$champs_manquant[] = $champ_attendu; 
236
				$ok = false;
236
				$ok = false;
237
			}
237
			}
238
		}
238
		}
239
		
239
		
240
		$info['resultat'] = $ok;
240
		$info['resultat'] = $ok;
241
		if (!$ok) {
241
		if (!$ok) {
242
			$info['message'] = sprintf($info['message'], implode(', ', $champs_manquant));
242
			$info['message'] = sprintf($info['message'], implode(', ', $champs_manquant));
243
		}
243
		}
244
		
244
		
245
		return $info;
245
		return $info;
246
	}
246
	}
247
	
247
	
248
	/**
248
	/**
249
	 * Test #03
249
	 * Test #03
250
	 */
250
	 */
251
	private function testerTypeDesChamps() {
251
	private function testerTypeDesChamps() {
252
		$champs_attendus = explode(',', $this->manuel['champs_type']);
252
		$champs_attendus = explode(',', $this->manuel['champs_type']);
253
		$champs_presents = array();
253
		$champs_presents = array();
254
		foreach ($this->colonnes as &$colonne) {
254
		foreach ($this->colonnes as &$colonne) {
255
			$champs_presents[$colonne['Field']] = $colonne['Type'];
255
			$champs_presents[$colonne['Field']] = $colonne['Type'];
256
		}
256
		}
257
		
257
		
258
		// Recercherche des erreurs
258
		// Recercherche des erreurs
259
		$champs_erreur = array(); 
259
		$champs_erreur = array(); 
260
		foreach ($champs_attendus as &$champ_attendu) {
260
		foreach ($champs_attendus as &$champ_attendu) {
261
			list($champ_attendu_nom, $champ_attendu_type_taille) = explode('=', trim($champ_attendu));
261
			list($champ_attendu_nom, $champ_attendu_type_taille) = explode('=', trim($champ_attendu));
262
			list($champ_attendu_type, $champ_attendu_taille) = explode('|', trim($champ_attendu_type_taille));
262
			list($champ_attendu_type, $champ_attendu_taille) = explode('|', trim($champ_attendu_type_taille));
263
			
263
			
264
			if (isset($champs_presents[$champ_attendu_nom])) {
264
			if (isset($champs_presents[$champ_attendu_nom])) {
265
				$champs_present_type = $champs_presents[$champ_attendu_nom];
265
				$champs_present_type = $champs_presents[$champ_attendu_nom];
266
				
266
				
267
				if (($champ_attendu_type == 'VARCHAR' && strstr($champs_present_type, 'varchar') === false)
267
				if (($champ_attendu_type == 'VARCHAR' && strstr($champs_present_type, 'varchar') === false)
268
					|| ($champ_attendu_type == 'TEXT' && strstr($champs_present_type, 'text') === false)
268
					|| ($champ_attendu_type == 'TEXT' && strstr($champs_present_type, 'text') === false)
269
					|| ($champ_attendu_type == 'INT' && strstr($champs_present_type, 'int') === false) 
269
					|| ($champ_attendu_type == 'INT' && strstr($champs_present_type, 'int') === false) 
270
					|| ($champ_attendu_type == 'BOOL' && preg_match('/(?:bool|boolean|tinyint\(1\))/i', $champs_present_type) === false)) {
270
					|| ($champ_attendu_type == 'BOOL' && preg_match('/(?:bool|boolean|tinyint\(1\))/i', $champs_present_type) === false)) {
271
					$champs_erreur[] = array($champ_attendu, $champ_attendu_type, $champs_present_type);
271
					$champs_erreur[] = array($champ_attendu, $champ_attendu_type, $champs_present_type);
272
				}
272
				}
273
			}
273
			}
274
		}
274
		}
275
		return $champs_erreur;
275
		return $champs_erreur;
276
	}
276
	}
277
	
277
	
278
	/**
278
	/**
279
	 * Test #04
279
	 * Test #04
280
	 */
280
	 */
281
	private function testerNumNomClePrimaire() {
281
	private function testerNumNomClePrimaire() {
282
		$info = $this->getInfosTest(4);
282
		$info = $this->getInfosTest(4);
283
		$info['special'] = true;
283
		$info['special'] = true;
284
		
284
		
285
		foreach ($this->colonnes as &$colonne) {
285
		foreach ($this->colonnes as &$colonne) {
286
			if ($colonne['Field'] == 'num_nom' && $colonne['Key'] == 'PRI') {
286
			if ($colonne['Field'] == 'num_nom' && $colonne['Key'] == 'PRI') {
287
				$info['resultat'] = true;
287
				$info['resultat'] = true;
288
				break;
288
				break;
289
			}
289
			}
290
		}
290
		}
291
		return $info;
291
		return $info;
292
	}
292
	}
293
	
293
	
294
	
294
	
295
	/**
295
	/**
296
	 * Test #05
296
	 * Test #05
297
	 */
297
	 */
298
	private function testerTailleDesChamps() {
298
	private function testerTailleDesChamps() {
299
		$tailles_champs_maxi = array();
299
		$tailles_champs_maxi = array();
300
		foreach ($this->colonnes as &$colonne) {
300
		foreach ($this->colonnes as &$colonne) {
301
			if (preg_match('/^varchar\(([0-9]+)\)$/', $colonne['Type'], $match)) {
301
			if (preg_match('/^varchar\(([0-9]+)\)$/', $colonne['Type'], $match)) {
302
				$tailles_champs_maxi[$colonne['Field']] = $match[1];
302
				$tailles_champs_maxi[$colonne['Field']] = $match[1];
303
			}
303
			}
304
		}
304
		}
305
		
305
		
306
		$tailles_trouvees = array();
306
		$tailles_trouvees = array();
307
		foreach ($this->analyses as &$analyse) {
307
		foreach ($this->analyses as &$analyse) {
308
			if (preg_match('/\.([^.]+)$/', $analyse['Field_name'], $match)) {
308
			if (preg_match('/\.([^.]+)$/', $analyse['Field_name'], $match)) {
309
				$tailles_trouvees[$match[1]] = $analyse['Max_length'];
309
				$tailles_trouvees[$match[1]] = $analyse['Max_length'];
310
			}
310
			}
311
		}
311
		}
312
		
312
		
313
		$champs_erreur = array();
313
		$champs_erreur = array();
314
		$champs_attendus = explode(',', $this->manuel['champs']);
314
		$champs_attendus = explode(',', $this->manuel['champs']);
315
		foreach ($champs_attendus as &$champ_attendu) {
315
		foreach ($champs_attendus as &$champ_attendu) {
316
			if (isset($tailles_champs_maxi[$champ_attendu]) && isset($tailles_trouvees[$champ_attendu])) {
316
			if (isset($tailles_champs_maxi[$champ_attendu]) && isset($tailles_trouvees[$champ_attendu])) {
317
				if ($tailles_champs_maxi[$champ_attendu] == $tailles_trouvees[$champ_attendu]) {
317
				if ($tailles_champs_maxi[$champ_attendu] == $tailles_trouvees[$champ_attendu]) {
318
					$champs_erreur[] = array($champ_attendu, $tailles_champs_maxi[$champ_attendu], $tailles_trouvees[$champ_attendu]);
318
					$champs_erreur[] = array($champ_attendu, $tailles_champs_maxi[$champ_attendu], $tailles_trouvees[$champ_attendu]);
319
				}
319
				}
320
			}
320
			}
321
		}
321
		}
322
		return $champs_erreur;
322
		return $champs_erreur;
323
	}
323
	}
324
		
324
		
325
	/**
325
	/**
326
	 * Test #06
326
	 * Test #06
327
	 */
327
	 */
328
	private function testerNumNomSuperieurAZero() {
328
	private function testerNumNomSuperieurAZero() {
329
		$noms_erreur = array();
329
		$noms_erreur = array();
330
		foreach ($this->noms as &$nom) {
330
		foreach ($this->noms as &$nom) {
331
			if ($nom['num_nom'] <= 0) {
331
			if ($nom['num_nom'] <= 0) {
332
				$noms_erreur[] = array($nom['num_nom']);
332
				$noms_erreur[] = array($nom['num_nom']);
333
			}
333
			}
334
		}
334
		}
335
		return $noms_erreur;
335
		return $noms_erreur;
336
	}
336
	}
337
	
337
	
338
	/**
338
	/**
339
	 * Test #07
339
	 * Test #07
340
	 */
340
	 */
341
	private function testerNumNomRetenuSuperieurAZero() {
341
	private function testerNumNomRetenuSuperieurAZero() {
342
		$noms_erreur = array();
342
		$noms_erreur = array();
343
		foreach ($this->noms as &$nom) {
343
		foreach ($this->noms as &$nom) {
344
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] <= 0) {
344
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] <= 0) {
345
				$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu']);
345
				$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu']);
346
			}
346
			}
347
		}
347
		}
348
		return $noms_erreur;
348
		return $noms_erreur;
349
	}
349
	}
350
	
350
	
351
	/**
351
	/**
352
	 * Test #08
352
	 * Test #08
353
	 */
353
	 */
354
	private function testerExistenceNumNomRetenu() {
354
	private function testerExistenceNumNomRetenu() {
355
		$noms_erreur = array();
355
		$noms_erreur = array();
356
		foreach ($this->noms as &$nom) {
356
		foreach ($this->noms as &$nom) {
357
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] != $nom['num_nom']) {
357
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] != $nom['num_nom']) {
358
				if ($nom['num_nom_retenu'] != 0 && !isset($this->noms[$nom['num_nom_retenu']])) {
358
				if ($nom['num_nom_retenu'] != 0 && !isset($this->noms[$nom['num_nom_retenu']])) {
359
					$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $nom['exclure_taxref']);
359
					$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $nom['exclure_taxref']);
360
				} 
360
				} 
361
			}
361
			}
362
		}
362
		}
363
		return $noms_erreur;
363
		return $noms_erreur;
364
	}
364
	}
365
	
365
	
366
	/**
366
	/**
367
	 * Test #09
367
	 * Test #09
368
	 */
368
	 */
369
	private function testerTransmissionNumNomRetenu() {
369
	private function testerTransmissionNumNomRetenu() {
370
		$noms_erreur = array();
370
		$noms_erreur = array();
371
		foreach ($this->noms as &$nom) {
371
		foreach ($this->noms as &$nom) {
372
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['exclure_taxref'] == 0) {
372
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['exclure_taxref'] == 0) {
373
				if ($nom['num_nom_retenu'] != 0 && isset($this->noms[$nom['num_nom_retenu']])) {
373
				if ($nom['num_nom_retenu'] != 0 && isset($this->noms[$nom['num_nom_retenu']])) {
374
					if ($this->noms[$nom['num_nom_retenu']]['exclure_taxref'] != 0) {
374
					if ($this->noms[$nom['num_nom_retenu']]['exclure_taxref'] != 0) {
375
						$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $this->noms[$nom['num_nom_retenu']]['exclure_taxref']);
375
						$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $this->noms[$nom['num_nom_retenu']]['exclure_taxref']);
376
					}
376
					}
377
				} 
377
				} 
378
			}
378
			}
379
		}
379
		}
380
		return $noms_erreur;
380
		return $noms_erreur;
381
	}
381
	}
382
	
382
	
383
	/**
383
	/**
384
	 * Test #10
384
	 * Test #10
385
	 */
385
	 */
386
	private function testerSynonymeNumNomRetenu() {
386
	private function testerSynonymeNumNomRetenu() {
387
		$noms_erreur = array();
387
		$noms_erreur = array();
388
		foreach ($this->noms as &$nom) {
388
		foreach ($this->noms as &$nom) {
389
			if ($nom['num_nom_retenu'] != $nom['num_nom']) {
389
			if ($nom['num_nom_retenu'] != $nom['num_nom']) {
390
				if ($nom['num_nom_retenu'] != 0 && isset($this->noms[$nom['num_nom_retenu']])) {
390
				if ($nom['num_nom_retenu'] != 0 && isset($this->noms[$nom['num_nom_retenu']])) {
391
					if ($this->noms[$nom['num_nom_retenu']]['num_nom'] != $this->noms[$nom['num_nom_retenu']]['num_nom_retenu']) {
391
					if ($this->noms[$nom['num_nom_retenu']]['num_nom'] != $this->noms[$nom['num_nom_retenu']]['num_nom_retenu']) {
392
						$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $this->noms[$nom['num_nom_retenu']]['num_nom_retenu']);
392
						$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $this->noms[$nom['num_nom_retenu']]['num_nom_retenu']);
393
					}
393
					}
394
				} 
394
				} 
395
			}
395
			}
396
		}
396
		}
397
		return $noms_erreur;
397
		return $noms_erreur;
398
	}
398
	}
399
	
399
	
400
	
400
	
401
	/**
401
	/**
402
	 * Test #11
402
	 * Test #11
403
	 */
403
	 */
404
	private function testerNumTaxSupEgalZeroUnique() {
404
	private function testerNumTaxSupEgalZeroUnique() {
405
		$noms_erreur = array();
405
		$noms_erreur = array();
406
		foreach ($this->noms as &$nom) {
406
		foreach ($this->noms as &$nom) {
407
			if (preg_match('/^0$/', $nom['num_tax_sup'])) {
407
			if (preg_match('/^0$/', $nom['num_tax_sup'])) {
408
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']);
408
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']);
409
			}
409
			}
410
		}
410
		}
411
		// Ce test est spécial car le nombre de noms en erreurs doit être supérieur à 1 et non à 0 pour être KO.
411
		// Ce test est spécial car le nombre de noms en erreurs doit être supérieur à 1 et non à 0 pour être KO.
412
		if (count($noms_erreur) == 1) {
412
		if (count($noms_erreur) == 1) {
413
			$noms_erreur = array();
413
			$noms_erreur = array();
414
		}
414
		}
415
		return $noms_erreur;
415
		return $noms_erreur;
416
	}
416
	}
417
	
417
	
418
	/**
418
	/**
419
	 * Test #12
419
	 * Test #12
420
	 */
420
	 */
421
	private function testerTaxSupPourTaxon() {
421
	private function testerTaxSupPourTaxon() {
422
		$noms_erreur = array();
422
		$noms_erreur = array();
423
		foreach ($this->noms as &$nom) {
423
		foreach ($this->noms as &$nom) {
424
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['num_tax_sup'] != '') {
424
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['num_tax_sup'] != '') {
425
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $nom['exclure_taxref']); 
425
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $nom['exclure_taxref']); 
426
			}
426
			}
427
		}
427
		}
428
		return $noms_erreur;
428
		return $noms_erreur;
429
	}
429
	}
430
	
430
	
431
	/**
431
	/**
432
	 * Test #13
432
	 * Test #13
433
	 */
433
	 */
434
	private function testerExistenceTaxonSuperieur() {
434
	private function testerExistenceTaxonSuperieur() {
435
		$noms_erreur = array();
435
		$noms_erreur = array();
436
		foreach ($this->noms as &$nom) {
436
		foreach ($this->noms as &$nom) {
437
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
437
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
438
				if ($nom['num_tax_sup'] != 0 && !isset($this->noms[$nom['num_tax_sup']])) {
438
				if ($nom['num_tax_sup'] != 0 && !isset($this->noms[$nom['num_tax_sup']])) {
439
					$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $nom['exclure_taxref']);
439
					$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $nom['exclure_taxref']);
440
				} 
440
				} 
441
			}
441
			}
442
		}
442
		}
443
		return $noms_erreur;
443
		return $noms_erreur;
444
	}
444
	}
445
	
445
	
446
	/**
446
	/**
447
	 * Test #14
447
	 * Test #14
448
	 */
448
	 */
449
	private function testerTransmissionTaxonSuperieur() {
449
	private function testerTransmissionTaxonSuperieur() {
450
		$noms_erreur = array();
450
		$noms_erreur = array();
451
		foreach ($this->noms as &$nom) {
451
		foreach ($this->noms as &$nom) {
452
			if ($nom['num_nom_retenu'] == $nom['num_nom'] && $nom['exclure_taxref'] == 0) {
452
			if ($nom['num_nom_retenu'] == $nom['num_nom'] && $nom['exclure_taxref'] == 0) {
453
				if ($nom['num_tax_sup'] != 0 && isset($this->noms[$nom['num_tax_sup']])) {
453
				if ($nom['num_tax_sup'] != 0 && isset($this->noms[$nom['num_tax_sup']])) {
454
					if ($this->noms[$nom['num_tax_sup']]['exclure_taxref'] != 0) {
454
					if ($this->noms[$nom['num_tax_sup']]['exclure_taxref'] != 0) {
455
						$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $this->noms[$nom['num_tax_sup']]['exclure_taxref']);
455
						$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $this->noms[$nom['num_tax_sup']]['exclure_taxref']);
456
					}
456
					}
457
				} 
457
				} 
458
			}
458
			}
459
		}
459
		}
460
		return $noms_erreur;
460
		return $noms_erreur;
461
	}
461
	}
462
	
462
	
463
	
463
	
464
	/**
464
	/**
465
	 * Test #15
465
	 * Test #15
466
	 */
466
	 */
467
	private function testerClassificationRang() {
467
	private function testerClassificationRang() {
468
		$noms_erreur = array();
468
		$noms_erreur = array();
469
		foreach ($this->noms as &$nom) {
469
		foreach ($this->noms as &$nom) {
470
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
470
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
471
				if (isset($this->noms[$nom['num_tax_sup']])) {
471
				if (isset($this->noms[$nom['num_tax_sup']])) {
472
					$nom_sup = $this->noms[$nom['num_tax_sup']];
472
					$nom_sup = $this->noms[$nom['num_tax_sup']];
473
					if ($nom_sup['rang'] >= $nom['rang']) {
473
					if ($nom_sup['rang'] >= $nom['rang']) {
474
						// Prise en compte de l'exception des clades
474
						// Prise en compte de l'exception des clades
475
						if (! ($nom_sup['rang'] == 70 && $nom['rang'] == 70)) {
475
						if (! ($nom_sup['rang'] == 70 && $nom['rang'] == 70)) {
476
							$noms_erreur[] = array($nom['num_nom'], $nom['rang'], $nom_sup['num_nom'], $nom_sup['rang'], $nom['exclure_taxref']);
476
							$noms_erreur[] = array($nom['num_nom'], $nom['rang'], $nom_sup['num_nom'], $nom_sup['rang'], $nom['exclure_taxref']);
477
						}
477
						}
478
					}
478
					}
479
				}
479
				}
480
			}
480
			}
481
		}
481
		}
482
		return $noms_erreur;
482
		return $noms_erreur;
483
	}
483
	}
484
	
484
	
485
	/**
485
	/**
486
	 * Test #16
486
	 * Test #16
487
	 */
487
	 */
488
	private function testerClassification() {
488
	private function testerClassification() {
489
		$noms_erreur = array();
489
		$noms_erreur = array();
490
		$this->noms_ok = array();
490
		$this->noms_ok = array();
491
		foreach ($this->noms as &$nom) {
491
		foreach ($this->noms as &$nom) {
492
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
492
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
493
				if (isset($this->noms_ok[$nom['num_tax_sup']])) {
493
				if (isset($this->noms_ok[$nom['num_tax_sup']])) {
494
					$this->noms_ok[$nom['num_nom']] = true;
494
					$this->noms_ok[$nom['num_nom']] = true;
495
				} else {
495
				} else {
496
					$this->detection_boucle_infini = array();
496
					$this->detection_boucle_infini = array();
497
					$classif_ok = $this->remonterClassif($nom);
497
					$classif_ok = $this->remonterClassif($nom);
498
					unset($this->detection_boucle_infini); 
498
					unset($this->detection_boucle_infini); 
499
					
499
					
500
					if ($classif_ok === true) {
500
					if ($classif_ok === true) {
501
						$this->noms_ok[$nom['num_nom']] = $classif_ok;
501
						$this->noms_ok[$nom['num_nom']] = $classif_ok;
502
					} else {
502
					} else {
503
						$noms_erreur[] = array($nom['num_nom'], $classif_ok, $nom['exclure_taxref']);
503
						$noms_erreur[] = array($nom['num_nom'], $classif_ok, $nom['exclure_taxref']);
504
					}
504
					}
505
				}
505
				}
506
			}
506
			}
507
		}
507
		}
508
		unset($this->noms_ok);
508
		unset($this->noms_ok);
509
		return $noms_erreur;
509
		return $noms_erreur;
510
	}
510
	}
511
	
511
	
512
	private function remonterClassif(&$nom) {
512
	private function remonterClassif(&$nom) {
513
		$this->detection_boucle_infini[$nom['num_nom']] = true;
513
		$this->detection_boucle_infini[$nom['num_nom']] = true;
514
		if (preg_match('/^[0-9]*$/', $nom['num_tax_sup'])) {
514
		if (preg_match('/^[0-9]*$/', $nom['num_tax_sup'])) {
515
			if (isset($this->noms_ok[$nom['num_tax_sup']])) {
515
			if (isset($this->noms_ok[$nom['num_tax_sup']])) {
516
				$this->noms_ok[$nom['num_nom']] = true;
516
				$this->noms_ok[$nom['num_nom']] = true;
517
				return true;
517
				return true;
518
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] == '0') {
518
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] == '0') {
519
				$this->noms_ok[$nom['num_nom']] = true;
519
				$this->noms_ok[$nom['num_nom']] = true;
520
				return true;
520
				return true;
521
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] != '0') {
521
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] != '0') {
522
				return 'Hiérarchie avec le taxon #'.$nom['num_nom'].' ayant un taxon superieur #'.$nom['num_tax_sup'].' inexistant';
522
				return 'Hiérarchie avec le taxon #'.$nom['num_nom'].' ayant un taxon superieur #'.$nom['num_tax_sup'].' inexistant';
523
			} else if (isset($this->detection_boucle_infini[$nom['num_tax_sup']])) {
523
			} else if (isset($this->detection_boucle_infini[$nom['num_tax_sup']])) {
524
				return 'Boucle infinie pour le taxon #'.$nom['num_tax_sup'];
524
				return 'Boucle infinie pour le taxon #'.$nom['num_tax_sup'];
525
			} else {
525
			} else {
526
				$retour = $this->remonterClassif($this->noms[$nom['num_tax_sup']]);
526
				$retour = $this->remonterClassif($this->noms[$nom['num_tax_sup']]);
527
				if ($retour === true) {
527
				if ($retour === true) {
528
					$this->noms_ok[$nom['num_tax_sup']] = true;
528
					$this->noms_ok[$nom['num_tax_sup']] = true;
529
				}
529
				}
530
				return $retour;
530
				return $retour;
531
			}
531
			}
532
		} else {
532
		} else {
533
			return 'Valeur num_tax_sup incorrecte : '.$nom['num_tax_sup'];
533
			return 'Valeur num_tax_sup incorrecte : '.$nom['num_tax_sup'];
534
		}
534
		}
535
	}
535
	}
536
	
536
	
537
	/**
537
	/**
538
	 * Test #17
538
	 * Test #17
539
	 */
539
	 */
540
	private function testerRang() {
540
	private function testerRang() {
541
		$rangs = array_flip(explode(',', $this->manuel['rangs']));
541
		$rangs = array_flip(explode(',', $this->manuel['rangs']));
542
		
542
		
543
		// Réalisation du test
543
		// Réalisation du test
544
		$noms_erreur = array();
544
		$noms_erreur = array();
545
		foreach ($this->noms as &$nom) {
545
		foreach ($this->noms as &$nom) {
546
			if (!isset($rangs[$nom['rang']])) {
546
			if (!isset($rangs[$nom['rang']])) {
547
				$noms_erreur[] = array($nom['num_nom'], $nom['rang'], $nom['exclure_taxref']);
547
				$noms_erreur[] = array($nom['num_nom'], $nom['rang'], $nom['exclure_taxref']);
548
			}
548
			}
549
		}
549
		}
550
		return $noms_erreur;
550
		return $noms_erreur;
551
	}
551
	}
552
	
552
	
553
	/**
553
	/**
554
	 * Test #18
554
	 * Test #18
555
	 */
555
	 */
556
	private function testerNomCompletSupraGenerique() {
556
	private function testerNomCompletSupraGenerique() {
557
		$noms_erreur = array();
557
		$noms_erreur = array();
558
		foreach ($this->noms as &$nom) {
558
		foreach ($this->noms as &$nom) {
559
			if ($nom['rang'] < $this->manuel['rang_genre']) {
559
			if ($nom['rang'] < $this->manuel['rang_genre']) {
560
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
560
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
561
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['nom_supra_generique']);
561
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['nom_supra_generique']);
562
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
562
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
563
				if ($nom['nom_sci'] != $nom_sci_ideal) {
563
				if ($nom['nom_sci'] != $nom_sci_ideal) {
564
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
564
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
565
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
565
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
566
				}
566
				}
567
			}
567
			}
568
		}
568
		}
569
		return $noms_erreur;
569
		return $noms_erreur;
570
	}
570
	}
571
	
571
	
572
	/**
572
	/**
573
	 * Test #19
573
	 * Test #19
574
	 */
574
	 */
575
	private function testerNomCompletGenre() {
575
	private function testerNomCompletGenre() {
576
		$noms_erreur = array();
576
		$noms_erreur = array();
577
		foreach ($this->noms as &$nom) {
577
		foreach ($this->noms as &$nom) {
578
			if ($nom['rang'] == $this->manuel['rang_genre']) {
578
			if ($nom['rang'] == $this->manuel['rang_genre']) {
579
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
579
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
580
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
580
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
581
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
581
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
582
				if ($nom['nom_sci'] != $nom_sci_ideal) {
582
				if ($nom['nom_sci'] != $nom_sci_ideal) {
583
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
583
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
584
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
584
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
585
				}
585
				}
586
			}
586
			}
587
		}
587
		}
588
		return $noms_erreur;
588
		return $noms_erreur;
589
	}
589
	}
590
	
590
	
591
	/**
591
	/**
592
	 * Test #20
592
	 * Test #20
593
	 */
593
	 */
594
	private function testerNomCompletInfraGenre() {
594
	private function testerNomCompletInfraGenre() {
595
		$noms_erreur = array();
595
		$noms_erreur = array();
596
		foreach ($this->noms as &$nom) {
596
		foreach ($this->noms as &$nom) {
597
			if ($nom['rang'] > $this->manuel['rang_genre'] && $nom['rang'] < $this->manuel['rang_sp']) {
597
			if ($nom['rang'] > $this->manuel['rang_genre'] && $nom['rang'] < $this->manuel['rang_sp']) {
598
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
598
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
599
				$nom_sci_ideal = '';
599
				$nom_sci_ideal = '';
600
				if ($nom['type_epithete'] == 'agg.') {
600
				if ($nom['type_epithete'] == 'agg.') {
601
					$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
601
					$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
602
					$nom_sci_ideal .= ' '.$this->formaterStyleNomGenre($nom['epithete_infra_generique']);
602
						$this->formaterStyleNomGenre($nom['epithete_infra_generique']).' '.
603
					$nom_sci_ideal .= ' '.$nom['type_epithete'];
603
						$nom['type_epithete'];
604
				} else {
604
				} else {
605
					$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
605
					$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
606
					$nom_sci_ideal .= ' '.$nom['type_epithete'];
606
						$nom['type_epithete'].' '.
607
					$nom_sci_ideal .= ' '.$this->formaterStyleNomGenre($nom['epithete_infra_generique']);
607
						$this->formaterStyleNomGenre($nom['epithete_infra_generique']);
608
				}
608
				}
609
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
609
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
610
				if ($nom['nom_sci'] != $nom_sci_ideal) {
610
				if ($nom['nom_sci'] != $nom_sci_ideal) {
611
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
611
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
612
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
612
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
613
				}
613
				}
614
			}
614
			}
615
		}
615
		}
616
		return $noms_erreur;
616
		return $noms_erreur;
617
	}
617
	}
618
	
618
	
619
	/**
619
	/**
620
	 * Test #21
620
	 * Test #21
621
	 */
621
	 */
622
	private function testerNomCompletEspece() {
622
	private function testerNomCompletEspece() {
623
		$noms_erreur = array();
623
		$noms_erreur = array();
-
 
624
		$erreur = '';
624
		foreach ($this->noms as &$nom) {
625
		foreach ($this->noms as &$nom) {
625
			if ($nom['rang'] == $this->manuel['rang_sp']) {
626
			if ($nom['rang'] == $this->manuel['rang_sp']) {
626
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
627
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
627
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
628
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' ';
628
				$nom_sci_ideal .= (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $nom['epithete_sp'], $match) != '' ? 
629
				if (strstr($nom['nom_sci'] , ' x ') != false) {
629
					' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.utf8_encode(strtolower(utf8_decode($match[2]))).
630
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteSpHybride($nom_sci_ideal, $nom['epithete_sp']);
630
					' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[3])))) : 
631
				} else {
631
					' '.utf8_encode(strtolower(utf8_decode($nom['epithete_sp']))));
632
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_sp'])));
-
 
633
				}
632
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
634
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
633
				$nom_sci_ideal = trim($nom_sci_ideal);
635
				$nom_sci_ideal = trim($nom_sci_ideal);
634
				if ($nom['nom_sci'] != $nom_sci_ideal) {
636
				if ($nom['nom_sci'] != $nom_sci_ideal) {
635
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
637
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
636
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
638
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
637
				}
639
				}
638
			}
640
			}
639
		}
641
		}
640
		return $noms_erreur;
642
		return $noms_erreur;
641
	}
643
	}
642
	
644
	
643
	/**
645
	/**
644
	 * Test #22
646
	 * Test #22
645
	 */
647
	 */
646
	private function testerNomCompletInfraSpecifique() {
648
	private function testerNomCompletInfraSpecifique() {
647
		$noms_erreur = array();
649
		$noms_erreur = array();
648
		foreach ($this->noms as &$nom) {
650
		foreach ($this->noms as &$nom) {
649
			if ($nom['rang'] > $this->manuel['rang_sp']) {
651
			if ($nom['rang'] > $this->manuel['rang_sp']) {
-
 
652
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
-
 
653
					utf8_encode(strtolower(utf8_decode($nom['epithete_sp']))).' '.
-
 
654
					utf8_encode(strtolower(utf8_decode($nom['type_epithete']))).' ';
650
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
655
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
651
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
656
				if (strstr($nom['nom_sci'] , ' x ') != false) {
652
				$nom_sci_ideal .= ' '.utf8_encode(strtolower(utf8_decode($nom['epithete_sp'])));
-
 
653
				$nom_sci_ideal .= ' '.utf8_encode(strtolower(utf8_decode($nom['type_epithete'])));
-
 
654
				$nom_sci_ideal .= (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $nom['epithete_infra_sp'], $match) != '' ? 
657
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteInfraSpHybride($nom_sci_ideal, $nom['epithete_infra_sp'], $nom['genre']);
655
					' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.utf8_encode(strtolower(utf8_decode($match[2]))).
-
 
656
					' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[3])))) : 
658
				} else {
657
					' '.utf8_encode(strtolower(utf8_decode($nom['epithete_infra_sp']))));
659
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_infra_sp'])));
658
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
-
 
-
 
660
				}
659
				$nom_sci_ideal = trim($nom_sci_ideal);
661
				$nom_sci_ideal = trim($nom_sci_ideal);
-
 
662
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
660
				if ($nom['nom_sci'] != $nom_sci_ideal) {
663
				if ($nom['nom_sci'] != $nom_sci_ideal) {
661
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
664
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
662
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
665
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
663
				}
666
				}
664
			}
667
			}
665
		}
668
		}
666
		return $noms_erreur;
669
		return $noms_erreur;
667
	}
670
	}
668
	
671
	
669
	/**
672
	/**
670
	 * Test #23
673
	 * Test #23
671
	 */
674
	 */
672
	private function testerNomSupraGeneriqueEspaces() {
675
	private function testerNomSupraGeneriqueEspaces() {
673
		$noms_erreur = array();
676
		$noms_erreur = array();
674
		foreach ($this->noms as &$nom) {
677
		foreach ($this->noms as &$nom) {
675
			if ($nom['nom_supra_generique'] != '') {
678
			if ($nom['nom_supra_generique'] != '') {
676
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s+$)/', $nom['nom_supra_generique'])) {
679
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s+$)/', $nom['nom_supra_generique'])) {
677
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
680
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
678
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
681
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
679
				}
682
				}
680
			}
683
			}
681
		}
684
		}
682
		return $noms_erreur;
685
		return $noms_erreur;
683
	}
686
	}
684
	
687
	
685
	/**
688
	/**
686
	 * Test #24
689
	 * Test #24
687
	 */
690
	 */
688
	private function testerNomSupraGeneriqueSyntaxe() {
691
	private function testerNomSupraGeneriqueSyntaxe() {
689
		$noms_erreur = array();
692
		$noms_erreur = array();
690
		foreach ($this->noms as &$nom) {
693
		foreach ($this->noms as &$nom) {
691
			if ($nom['nom_supra_generique'] != '') {
694
			if ($nom['nom_supra_generique'] != '') {
692
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+$/', $nom['nom_supra_generique'])) {
695
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+$/', $nom['nom_supra_generique'])) {
693
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
696
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
694
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
697
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
695
				}
698
				}
696
			}
699
			}
697
		}
700
		}
698
		return $noms_erreur;
701
		return $noms_erreur;
699
	}
702
	}
700
	
703
	
701
	/**
704
	/**
702
	 * Test #25
705
	 * Test #25
703
	 */
706
	 */
704
	private function testerNomSupraGeneriqueRang() {
707
	private function testerNomSupraGeneriqueRang() {
705
		$noms_erreur = array();
708
		$noms_erreur = array();
706
		foreach ($this->noms as &$nom) {
709
		foreach ($this->noms as &$nom) {
707
			if ($nom['nom_supra_generique'] != '') {
710
			if ($nom['nom_supra_generique'] != '') {
708
				if ($nom['rang'] >= $this->manuel['rang_genre']) {
711
				if ($nom['rang'] >= $this->manuel['rang_genre']) {
709
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
712
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
710
				}
713
				}
711
			}
714
			}
712
		}
715
		}
713
		return $noms_erreur;
716
		return $noms_erreur;
714
	}
717
	}
715
	
718
	
716
	/**
719
	/**
717
	 * Test #26
720
	 * Test #26
718
	 */
721
	 */
719
	private function testerGenreEspaces() {
722
	private function testerGenreEspaces() {
720
		$noms_erreur = array();
723
		$noms_erreur = array();
721
		foreach ($this->noms as &$nom) {
724
		foreach ($this->noms as &$nom) {
722
			if ($nom['genre'] != '') {
725
			if ($nom['genre'] != '') {
723
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['genre'])) {
726
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['genre'])) {
724
					$nom_traite = $this->repererEspace($nom['genre']);
727
					$nom_traite = $this->repererEspace($nom['genre']);
725
					$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
728
					$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
726
				}
729
				}
727
			}
730
			}
728
		}
731
		}
729
		return $noms_erreur;
732
		return $noms_erreur;
730
	}
733
	}
731
	
734
	
732
	/**
735
	/**
733
	 * Test #27
736
	 * Test #27
734
	 */
737
	 */
735
	private function testerGenreSyntaxe() {
738
	private function testerGenreSyntaxe() {
736
		$noms_erreur = array();
739
		$noms_erreur = array();
737
		foreach ($this->noms as &$nom) {
740
		foreach ($this->noms as &$nom) {
738
			if ($nom['genre'] != '') {
741
			if ($nom['genre'] != '') {
739
				$mots = explode(' ', $nom['genre']);
742
				$mots = explode(' ', $nom['genre']);
740
				foreach ($mots as $mot) {
743
				foreach ($mots as $mot) {
741
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteGenre($mot))) {
744
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteGenre($mot))) {
742
						$nom_traite = $this->repererEspace($nom['genre']);
745
						$nom_traite = $this->repererEspace($nom['genre']);
743
						$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
746
						$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
744
						break;
747
						break;
745
					}
748
					}
746
				}
749
				}
747
			}
750
			}
748
		}
751
		}
749
		return $noms_erreur;
752
		return $noms_erreur;
750
	}
753
	}
751
	
754
	
752
	/**
755
	/**
753
	 * Test #28
756
	 * Test #28
754
	 */
757
	 */
755
	private function testerGenreRang() {
758
	private function testerGenreRang() {
756
		$noms_erreur = array();
759
		$noms_erreur = array();
757
		foreach ($this->noms as &$nom) {
760
		foreach ($this->noms as &$nom) {
758
			if ($nom['genre'] != '') {
761
			if ($nom['genre'] != '') {
759
				if ($nom['rang'] < $this->manuel['rang_genre']) {
762
				if ($nom['rang'] < $this->manuel['rang_genre']) {
760
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
763
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
761
				}
764
				}
762
			}
765
			}
763
		}
766
		}
764
		return $noms_erreur;
767
		return $noms_erreur;
765
	}
768
	}
766
		
769
		
767
	/**
770
	/**
768
	 * Test #29
771
	 * Test #29
769
	 */
772
	 */
770
	private function testerEpitheteInfraGeneriqueSyntaxe() {
773
	private function testerEpitheteInfraGeneriqueSyntaxe() {
771
		$noms_erreur = array();
774
		$noms_erreur = array();
772
		foreach ($this->noms as &$nom) {
775
		foreach ($this->noms as &$nom) {
773
			if ($nom['epithete_infra_generique'] != '') {
776
			if ($nom['epithete_infra_generique'] != '') {
774
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+/', $nom['epithete_infra_generique'])) {
777
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+/', $nom['epithete_infra_generique'])) {
775
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
778
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
776
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
779
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
777
				}
780
				}
778
			}
781
			}
779
		}
782
		}
780
		return $noms_erreur;
783
		return $noms_erreur;
781
	}
784
	}
782
	
785
	
783
	/**
786
	/**
784
	 * Test #30
787
	 * Test #30
785
	 */
788
	 */
786
	private function testerEpitheteInfraGeneriqueRang() {
789
	private function testerEpitheteInfraGeneriqueRang() {
787
		$noms_erreur = array();
790
		$noms_erreur = array();
788
		foreach ($this->noms as &$nom) {
791
		foreach ($this->noms as &$nom) {
789
			if ($nom['epithete_infra_generique'] != '') {
792
			if ($nom['epithete_infra_generique'] != '') {
790
				if ($nom['rang'] <= $this->manuel['rang_genre'] || $nom['rang'] >= $this->manuel['rang_sp']) {
793
				if ($nom['rang'] <= $this->manuel['rang_genre'] || $nom['rang'] >= $this->manuel['rang_sp']) {
791
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
794
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
792
				}
795
				}
793
			}
796
			}
794
		}
797
		}
795
		return $noms_erreur;
798
		return $noms_erreur;
796
	}
799
	}
797
	
800
	
798
	/**
801
	/**
799
	 * Test #31
802
	 * Test #31
800
	 */
803
	 */
801
	private function testerEpitheteInfraGeneriqueEspaces() {
804
	private function testerEpitheteInfraGeneriqueEspaces() {
802
		$noms_erreur = array();
805
		$noms_erreur = array();
803
		foreach ($this->noms as &$nom) {
806
		foreach ($this->noms as &$nom) {
804
			if ($nom['epithete_infra_generique'] != '') {
807
			if ($nom['epithete_infra_generique'] != '') {
805
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_generique'])) {
808
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_generique'])) {
806
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
809
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
807
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
810
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
808
				}
811
				}
809
			}
812
			}
810
		}
813
		}
811
		return $noms_erreur;
814
		return $noms_erreur;
812
	}
815
	}
813
	
816
	
814
	/**
817
	/**
815
	 * Test #32
818
	 * Test #32
816
	 */
819
	 */
817
	private function testerEpitheteSpEspaces() {
820
	private function testerEpitheteSpEspaces() {
818
		$noms_erreur = array();
821
		$noms_erreur = array();
819
		foreach ($this->noms as &$nom) {
822
		foreach ($this->noms as &$nom) {
820
			if ($nom['epithete_sp'] != '') {
823
			if ($nom['epithete_sp'] != '') {
821
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_sp'])) {
824
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_sp'])) {
822
					$epithete_traite = $this->repererEspace($nom['epithete_sp']);
825
					$epithete_traite = $this->repererEspace($nom['epithete_sp']);
823
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
826
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
824
				}
827
				}
825
			}
828
			}
826
		}
829
		}
827
		return $noms_erreur;
830
		return $noms_erreur;
828
	}
831
	}
829
	
832
	
830
	/**
833
	/**
831
	 * Test #33
834
	 * Test #33
832
	 */
835
	 */
833
	private function testerEpitheteSpSyntaxe() {
836
	private function testerEpitheteSpSyntaxe() {
834
		$noms_erreur = array();
837
		$noms_erreur = array();
835
		foreach ($this->noms as &$nom) {
838
		foreach ($this->noms as &$nom) {
836
			if ($nom['epithete_sp'] != '') {
839
			if ($nom['epithete_sp'] != '') {
837
				$mots = explode(' ', $nom['epithete_sp']);
840
				$mots = explode(' ', $nom['epithete_sp']);
838
				foreach ($mots as $mot) {
841
				foreach ($mots as $mot) {
839
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteSp($mot))) {
842
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteSp($mot))) {
840
						$epithete_traite = $this->repererEspace($nom['epithete_sp']);
843
						$epithete_traite = $this->repererEspace($nom['epithete_sp']);
841
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
844
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
842
						break;
845
						break;
843
					}
846
					}
844
				}
847
				}
845
			}
848
			}
846
		}
849
		}
847
		return $noms_erreur;
850
		return $noms_erreur;
848
	}
851
	}
849
	
852
	
850
	/**
853
	/**
851
	 * Test #34
854
	 * Test #34
852
	 */
855
	 */
853
	private function testerEpitheteSpRang() {
856
	private function testerEpitheteSpRang() {
854
		$noms_erreur = array();
857
		$noms_erreur = array();
855
		foreach ($this->noms as &$nom) {
858
		foreach ($this->noms as &$nom) {
856
			if ($nom['epithete_sp'] != '') {
859
			if ($nom['epithete_sp'] != '') {
857
				if ($nom['rang'] < $this->manuel['rang_sp']) {
860
				if ($nom['rang'] < $this->manuel['rang_sp']) {
858
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
861
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
859
				}
862
				}
860
			}
863
			}
861
		}
864
		}
862
		return $noms_erreur;
865
		return $noms_erreur;
863
	}
866
	}
864
	
867
	
865
	/**
868
	/**
866
	 * Test #35
869
	 * Test #35
867
	 */
870
	 */
868
	private function testerTypeEpitheteEspaces() {
871
	private function testerTypeEpitheteEspaces() {
869
		$noms_erreur = array();
872
		$noms_erreur = array();
870
		foreach ($this->noms as &$nom) {
873
		foreach ($this->noms as &$nom) {
871
			if ($nom['type_epithete'] != '') {
874
			if ($nom['type_epithete'] != '') {
872
				if (preg_match('/\s+/', $nom['type_epithete'])) {
875
				if (preg_match('/\s+/', $nom['type_epithete'])) {
873
					$valeur_traitee = $this->repererEspace($nom['epithete_sp']);
876
					$valeur_traitee = $this->repererEspace($nom['epithete_sp']);
874
					$noms_erreur[] = array($nom['num_nom'], $valeur_traitee, $nom['exclure_taxref']);
877
					$noms_erreur[] = array($nom['num_nom'], $valeur_traitee, $nom['exclure_taxref']);
875
				}
878
				}
876
			}
879
			}
877
		}
880
		}
878
		return $noms_erreur;
881
		return $noms_erreur;
879
	}
882
	}
880
	
883
	
881
	/**
884
	/**
882
	 * Test #36
885
	 * Test #36
883
	 */
886
	 */
884
	private function testerTypeEpitheteSyntaxe() {
887
	private function testerTypeEpitheteSyntaxe() {
885
		$noms_erreur = array();
888
		$noms_erreur = array();
886
		foreach ($this->noms as &$nom) {
889
		foreach ($this->noms as &$nom) {
887
			if ($nom['type_epithete'] != '') {
890
			if ($nom['type_epithete'] != '') {
888
				if (!$this->verifierTypeEpithete($nom['type_epithete'])) {
891
				if (!$this->verifierTypeEpithete($nom['type_epithete'])) {
889
					$noms_erreur[] = array($nom['num_nom'],  $nom['type_epithete'], $nom['exclure_taxref']);
892
					$noms_erreur[] = array($nom['num_nom'],  $nom['type_epithete'], $nom['exclure_taxref']);
890
				}
893
				}
891
			}
894
			}
892
		}
895
		}
893
		return $noms_erreur;
896
		return $noms_erreur;
894
	}
897
	}
895
	
898
	
896
	/**
899
	/**
897
	 * Test #37
900
	 * Test #37
898
	 */
901
	 */
899
	private function testerTypeEpitheteHybridite() {
902
	private function testerTypeEpitheteHybridite() {
900
		$noms_erreur = array();
903
		$noms_erreur = array();
901
		foreach ($this->noms as &$nom) {
904
		foreach ($this->noms as &$nom) {
902
			if ($nom['type_epithete'] != '') {
905
			if ($nom['type_epithete'] != '') {
903
				if (preg_match('/^(?:n-|notho-)/', $nom['type_epithete'])) {
906
				if (preg_match('/^(?:n-|notho-)/', $nom['type_epithete'])) {
904
					$noms_erreur[] = array($nom['num_nom'], $nom['type_epithete'], $nom['exclure_taxref']);
907
					$noms_erreur[] = array($nom['num_nom'], $nom['type_epithete'], $nom['exclure_taxref']);
905
				}
908
				}
906
			}
909
			}
907
		}
910
		}
908
		return $noms_erreur;
911
		return $noms_erreur;
909
	}
912
	}
910
	
913
	
911
	/**
914
	/**
912
	 * Test #38
915
	 * Test #38
913
	 */
916
	 */
914
	private function testerEpitheteInfraSpEspaces() {
917
	private function testerEpitheteInfraSpEspaces() {
915
		$noms_erreur = array();
918
		$noms_erreur = array();
916
		foreach ($this->noms as &$nom) {
919
		foreach ($this->noms as &$nom) {
917
			if ($nom['epithete_infra_sp'] != '') {
920
			if ($nom['epithete_infra_sp'] != '') {
918
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_sp'])) {
921
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_sp'])) {
919
					$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
922
					$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
920
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
923
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
921
				}
924
				}
922
			}
925
			}
923
		}
926
		}
924
		return $noms_erreur;
927
		return $noms_erreur;
925
	}
928
	}
926
	
929
	
927
	/**
930
	/**
928
	 * Test #39
931
	 * Test #39
929
	 */
932
	 */
930
	private function testerEpitheteInfraSpSyntaxe() {
933
	private function testerEpitheteInfraSpSyntaxe() {
931
		$noms_erreur = array();
934
		$noms_erreur = array();
932
		foreach ($this->noms as &$nom) {
935
		foreach ($this->noms as &$nom) {
933
			if ($nom['epithete_infra_sp'] != '') {
936
			if ($nom['epithete_infra_sp'] != '') {
934
				$mots = explode(' ', $nom['epithete_infra_sp']);
937
				$mots = explode(' ', $nom['epithete_infra_sp']);
935
				foreach ($mots as $mot) {
938
				foreach ($mots as $mot) {
936
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierTypeEpithete($mot)|| $this->verifierEpitheteSp($mot))) {
939
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierTypeEpithete($mot)|| $this->verifierEpitheteSp($mot))) {
937
						$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
940
						$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
938
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
941
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
939
						break;
942
						break;
940
					}
943
					}
941
				}
944
				}
942
			}
945
			}
943
		}
946
		}
944
		return $noms_erreur;
947
		return $noms_erreur;
945
	}
948
	}
946
	
949
	
947
	/**
950
	/**
948
	 * Test #40
951
	 * Test #40
949
	 */
952
	 */
950
	private function testerEpitheteInfraSpRang() {
953
	private function testerEpitheteInfraSpRang() {
951
		$noms_erreur = array();
954
		$noms_erreur = array();
952
		foreach ($this->noms as &$nom) {
955
		foreach ($this->noms as &$nom) {
953
			if ($nom['epithete_infra_sp'] != '') {
956
			if ($nom['epithete_infra_sp'] != '') {
954
				if ($nom['rang'] < $this->manuel['rang_sp']) {
957
				if ($nom['rang'] < $this->manuel['rang_sp']) {
955
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
958
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
956
				}
959
				}
957
			}
960
			}
958
		}
961
		}
959
		return $noms_erreur;
962
		return $noms_erreur;
960
	}
963
	}
961
	
964
	
962
	/**
965
	/**
963
	 * Test #41
966
	 * Test #41
964
	 */
967
	 */
965
	private function testerGroupeCultivarSyntaxe() {
968
	private function testerGroupeCultivarSyntaxe() {
966
		$noms_erreur = array();
969
		$noms_erreur = array();
967
		foreach ($this->noms as &$nom) {
970
		foreach ($this->noms as &$nom) {
968
			if ($nom['cultivar_groupe'] != '') {
971
			if ($nom['cultivar_groupe'] != '') {
969
				if (!$this->verifierEpitheteGroupeCultivar($nom['cultivar_groupe'])) {
972
				if (!$this->verifierEpitheteGroupeCultivar($nom['cultivar_groupe'])) {
970
					$epithete_traite = $this->repererEspace($nom['cultivar_groupe']);
973
					$epithete_traite = $this->repererEspace($nom['cultivar_groupe']);
971
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
974
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
972
				}
975
				}
973
			}
976
			}
974
		}
977
		}
975
		return $noms_erreur;
978
		return $noms_erreur;
976
	}
979
	}
977
	
980
	
978
	/**
981
	/**
979
	 * Test #42
982
	 * Test #42
980
	 */
983
	 */
981
	private function testerGroupeCultivarRang() {
984
	private function testerGroupeCultivarRang() {
982
		$noms_erreur = array();
985
		$noms_erreur = array();
983
		foreach ($this->noms as &$nom) {
986
		foreach ($this->noms as &$nom) {
984
			if ($nom['cultivar_groupe'] != '') {
987
			if ($nom['cultivar_groupe'] != '') {
985
				if ($nom['rang'] < $this->manuel['rang_genre']) {
988
				if ($nom['rang'] < $this->manuel['rang_genre']) {
986
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
989
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
987
				}
990
				}
988
			}
991
			}
989
		}
992
		}
990
		return $noms_erreur;
993
		return $noms_erreur;
991
	}
994
	}
992
	
995
	
993
	/**
996
	/**
994
	 * Test #43
997
	 * Test #43
995
	 */
998
	 */
996
	private function testerCultivarSyntaxe() {
999
	private function testerCultivarSyntaxe() {
997
		$noms_erreur = array();
1000
		$noms_erreur = array();
998
		foreach ($this->noms as &$nom) {
1001
		foreach ($this->noms as &$nom) {
999
			if ($nom['cultivar'] != '') {
1002
			if ($nom['cultivar'] != '') {
1000
				if (!$this->verifierEpitheteCultivar($nom['cultivar'])) {
1003
				if (!$this->verifierEpitheteCultivar($nom['cultivar'])) {
1001
					$epithete_traite = $this->repererEspace($nom['cultivar']);
1004
					$epithete_traite = $this->repererEspace($nom['cultivar']);
1002
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1005
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1003
				}
1006
				}
1004
			}
1007
			}
1005
		}
1008
		}
1006
		return $noms_erreur;
1009
		return $noms_erreur;
1007
	}
1010
	}
1008
	
1011
	
1009
	/**
1012
	/**
1010
	 * Test #44
1013
	 * Test #44
1011
	 */
1014
	 */
1012
	private function testerCultivarRang() {
1015
	private function testerCultivarRang() {
1013
		$noms_erreur = array();
1016
		$noms_erreur = array();
1014
		foreach ($this->noms as &$nom) {
1017
		foreach ($this->noms as &$nom) {
1015
			if ($nom['cultivar'] != '') {
1018
			if ($nom['cultivar'] != '') {
1016
				if ($nom['rang'] < $this->manuel['rang_genre']) {
1019
				if ($nom['rang'] < $this->manuel['rang_genre']) {
1017
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
1020
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
1018
				}
1021
				}
1019
			}
1022
			}
1020
		}
1023
		}
1021
		return $noms_erreur;
1024
		return $noms_erreur;
1022
	}
1025
	}
1023
	
1026
	
1024
	/**
1027
	/**
1025
	 * Test #45
1028
	 * Test #45
1026
	 */
1029
	 */
1027
	private function testerNomCommercialSyntaxe() {
1030
	private function testerNomCommercialSyntaxe() {
1028
		$noms_erreur = array();
1031
		$noms_erreur = array();
1029
		foreach ($this->noms as &$nom) {
1032
		foreach ($this->noms as &$nom) {
1030
			if ($nom['nom_commercial'] != '') {
1033
			if ($nom['nom_commercial'] != '') {
1031
				if (!$this->verifierNomCommercial($nom['nom_commercial'])) {
1034
				if (!$this->verifierNomCommercial($nom['nom_commercial'])) {
1032
					$epithete_traite = $this->repererEspace($nom['nom_commercial']);
1035
					$epithete_traite = $this->repererEspace($nom['nom_commercial']);
1033
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1036
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1034
				}
1037
				}
1035
			}
1038
			}
1036
		}
1039
		}
1037
		return $noms_erreur;
1040
		return $noms_erreur;
1038
	}
1041
	}
1039
	
1042
	
1040
	/**
1043
	/**
1041
	 * Test #46
1044
	 * Test #46
1042
	 */
1045
	 */
1043
	private function testerNomCommercialPresenceCultivar() {
1046
	private function testerNomCommercialPresenceCultivar() {
1044
		$noms_erreur = array();
1047
		$noms_erreur = array();
1045
		foreach ($this->noms as &$nom) {
1048
		foreach ($this->noms as &$nom) {
1046
			if ((isset($nom['nom_commercial']) && $nom['nom_commercial'] != '') && ($nom['cultivar'] == '' && $nom['cultivar_groupe'] == '')) {
1049
			if ((isset($nom['nom_commercial']) && $nom['nom_commercial'] != '') && ($nom['cultivar'] == '' && $nom['cultivar_groupe'] == '')) {
1047
				$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1050
				$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1048
			}
1051
			}
1049
		}
1052
		}
1050
		return $noms_erreur;
1053
		return $noms_erreur;
1051
	}
1054
	}
1052
	
1055
	
1053
	/**
1056
	/**
1054
	 * Test #47
1057
	 * Test #47
1055
	 */
1058
	 */
1056
	private function testerAuteurSyntaxe() {
1059
	private function testerAuteurSyntaxe() {
1057
		$noms_erreur = array();
1060
		$noms_erreur = array();
1058
		foreach ($this->noms as &$nom) {
1061
		foreach ($this->noms as &$nom) {
1059
			if ($nom['auteur'] != '') {
1062
			if ($nom['auteur'] != '') {
1060
				if (!$this->verifierAuteur($nom['auteur'])) {
1063
				if (!$this->verifierAuteur($nom['auteur'])) {
1061
					$intitule_traite = $this->repererEspace($nom['auteur']);
1064
					$intitule_traite = $this->repererEspace($nom['auteur']);
1062
					$noms_erreur[] = array($nom['num_nom'], $intitule_traite, $nom['exclure_taxref']);
1065
					$noms_erreur[] = array($nom['num_nom'], $intitule_traite, $nom['exclure_taxref']);
1063
				}
1066
				}
1064
			}
1067
			}
1065
		}
1068
		}
1066
		return $noms_erreur;
1069
		return $noms_erreur;
1067
	}
1070
	}
1068
	
1071
	
1069
	/**
1072
	/**
1070
	 * Test #48
1073
	 * Test #48
1071
	 */
1074
	 */
1072
	private function testerAnneeSyntaxe() {
1075
	private function testerAnneeSyntaxe() {
1073
		$noms_erreur = array();
1076
		$noms_erreur = array();
1074
		foreach ($this->noms as &$nom) {
1077
		foreach ($this->noms as &$nom) {
1075
			if ($nom['annee'] != '') {
1078
			if ($nom['annee'] != '') {
1076
				if (!$this->verifierAnnee($nom['annee'])) {
1079
				if (!$this->verifierAnnee($nom['annee'])) {
1077
					$noms_erreur[] = array($nom['num_nom'], $nom['annee'], $nom['exclure_taxref']);
1080
					$noms_erreur[] = array($nom['num_nom'], $nom['annee'], $nom['exclure_taxref']);
1078
				}
1081
				}
1079
			}
1082
			}
1080
		}
1083
		}
1081
		return $noms_erreur;
1084
		return $noms_erreur;
1082
	}
1085
	}
1083
	
1086
	
1084
	/**
1087
	/**
1085
	 * Test #49
1088
	 * Test #49
1086
	 */
1089
	 */
1087
	private function testerBiblioOrigineSyntaxe() {
1090
	private function testerBiblioOrigineSyntaxe() {
1088
		$noms_erreur = array();
1091
		$noms_erreur = array();
1089
		foreach ($this->noms as &$nom) {
1092
		foreach ($this->noms as &$nom) {
1090
			if ($nom['biblio_origine'] != '') {
1093
			if ($nom['biblio_origine'] != '') {
1091
				if (!$this->verifierBiblioOrigine($nom['biblio_origine'])) {
1094
				if (!$this->verifierBiblioOrigine($nom['biblio_origine'])) {
1092
					$biblio_traite = $this->repererEspace($nom['biblio_origine']);
1095
					$biblio_traite = $this->repererEspace($nom['biblio_origine']);
1093
					$noms_erreur[] = array($nom['num_nom'], $biblio_traite, $nom['exclure_taxref']);
1096
					$noms_erreur[] = array($nom['num_nom'], $biblio_traite, $nom['exclure_taxref']);
1094
				}
1097
				}
1095
			}
1098
			}
1096
		}
1099
		}
1097
		return $noms_erreur;
1100
		return $noms_erreur;
1098
	}
1101
	}
1099
	
1102
	
1100
	/**
1103
	/**
1101
	 * Test #50
1104
	 * Test #50
1102
	 */
1105
	 */
1103
	private function testerHomonymieSyntaxe() {
1106
	private function testerHomonymieSyntaxe() {
1104
		$noms_erreur = array();
1107
		$noms_erreur = array();
1105
		foreach ($this->noms as &$nom) {
1108
		foreach ($this->noms as &$nom) {
1106
			if ($nom['homonyme'] != '') {
1109
			if ($nom['homonyme'] != '') {
1107
				if (!$this->verifierBooleen($nom['homonyme'])) {
1110
				if (!$this->verifierBooleen($nom['homonyme'])) {
1108
					$noms_erreur[] = array($nom['num_nom'], $nom['homonyme'], $nom['exclure_taxref']);
1111
					$noms_erreur[] = array($nom['num_nom'], $nom['homonyme'], $nom['exclure_taxref']);
1109
				}
1112
				}
1110
			}
1113
			}
1111
		}
1114
		}
1112
		return $noms_erreur;
1115
		return $noms_erreur;
1113
	}
1116
	}
1114
	
1117
	
1115
	/**
1118
	/**
1116
	 * Test #51
1119
	 * Test #51
1117
	 */
1120
	 */
1118
	private function testerHomonymieExistence() {
1121
	private function testerHomonymieExistence() {
1119
		$noms_homonymie = $this->classerNomsParNomComplet();
1122
		$noms_homonymie = $this->classerNomsParNomComplet();
1120
		
1123
		
1121
		$noms_erreur = array();
1124
		$noms_erreur = array();
1122
		foreach ($this->noms as &$nom) {
1125
		foreach ($this->noms as &$nom) {
1123
			if ($nom['homonyme'] != '0' && $nom['homonyme'] != '') {
1126
			if ($nom['homonyme'] != '0' && $nom['homonyme'] != '') {
1124
				if ($noms_homonymie[$nom['nom_sci']] <= 1) {
1127
				if ($noms_homonymie[$nom['nom_sci']] <= 1) {
1125
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1128
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1126
				}
1129
				}
1127
			}
1130
			}
1128
		}
1131
		}
1129
		$noms_homonymie = null;
1132
		$noms_homonymie = null;
1130
		return $noms_erreur;
1133
		return $noms_erreur;
1131
	}
1134
	}
1132
	
1135
	
1133
	/**
1136
	/**
1134
	 * Test #52
1137
	 * Test #52
1135
	 */
1138
	 */
1136
	private function testerBasionymeSyntaxe() {
1139
	private function testerBasionymeSyntaxe() {
1137
		$noms_erreur = array();
1140
		$noms_erreur = array();
1138
		foreach ($this->noms as &$nom) {
1141
		foreach ($this->noms as &$nom) {
1139
			if ($nom['basionyme'] != '') {
1142
			if ($nom['basionyme'] != '') {
1140
				if (!$this->verifierNombre($nom['basionyme'])) {
1143
				if (!$this->verifierNombre($nom['basionyme'])) {
1141
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1144
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1142
				}
1145
				}
1143
			}
1146
			}
1144
		}
1147
		}
1145
		return $noms_erreur;
1148
		return $noms_erreur;
1146
	}
1149
	}
1147
 
1150
 
1148
	/**
1151
	/**
1149
	 * Test #53
1152
	 * Test #53
1150
	 */
1153
	 */
1151
	private function testerBasionymeExistence() {
1154
	private function testerBasionymeExistence() {
1152
		$noms_erreur = array();
1155
		$noms_erreur = array();
1153
		foreach ($this->noms as &$nom) {
1156
		foreach ($this->noms as &$nom) {
1154
			if ($nom['basionyme'] != '') {
1157
			if ($nom['basionyme'] != '') {
1155
				if (!isset($this->noms[$nom['basionyme']])) {
1158
				if (!isset($this->noms[$nom['basionyme']])) {
1156
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1159
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1157
				}
1160
				}
1158
			}
1161
			}
1159
		}
1162
		}
1160
		return $noms_erreur;
1163
		return $noms_erreur;
1161
	}
1164
	}
1162
	
1165
	
1163
	/**
1166
	/**
1164
	 * Test #54
1167
	 * Test #54
1165
	 */
1168
	 */
1166
	private function testerSynonymeProparteSyntaxe() {
1169
	private function testerSynonymeProparteSyntaxe() {
1167
		$noms_erreur = array();
1170
		$noms_erreur = array();
1168
		foreach ($this->noms as &$nom) {
1171
		foreach ($this->noms as &$nom) {
1169
			if ($nom['synonyme_proparte'] != '') {
1172
			if ($nom['synonyme_proparte'] != '') {
1170
				if (!$this->verifierNombreSuite($nom['synonyme_proparte'])) {
1173
				if (!$this->verifierNombreSuite($nom['synonyme_proparte'])) {
1171
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_proparte'], $nom['exclure_taxref']);
1174
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_proparte'], $nom['exclure_taxref']);
1172
				}
1175
				}
1173
			}
1176
			}
1174
		}
1177
		}
1175
		return $noms_erreur;
1178
		return $noms_erreur;
1176
	}
1179
	}
1177
	
1180
	
1178
	/**
1181
	/**
1179
	 * Test #55
1182
	 * Test #55
1180
	 */
1183
	 */
1181
	private function testerSynonymeProparteExistence() {
1184
	private function testerSynonymeProparteExistence() {
1182
		$noms_erreur = array();
1185
		$noms_erreur = array();
1183
		foreach ($this->noms as &$nom) {
1186
		foreach ($this->noms as &$nom) {
1184
			if ($nom['synonyme_proparte'] != '') {
1187
			if ($nom['synonyme_proparte'] != '') {
1185
				$num_nom_a_verifier = explode(',', $nom['synonyme_proparte']);
1188
				$num_nom_a_verifier = explode(',', $nom['synonyme_proparte']);
1186
				$num_nom_en_erreur = array();
1189
				$num_nom_en_erreur = array();
1187
				foreach ($num_nom_a_verifier as $num_nom) {
1190
				foreach ($num_nom_a_verifier as $num_nom) {
1188
					if (!isset($this->noms[$num_nom])) {
1191
					if (!isset($this->noms[$num_nom])) {
1189
						$num_nom_en_erreur[] = $num_nom;
1192
						$num_nom_en_erreur[] = $num_nom;
1190
					}
1193
					}
1191
				}
1194
				}
1192
				if (count($nbre_en_erreur) > 0) {
1195
				if (count($nbre_en_erreur) > 0) {
1193
					$noms_erreur[] = array($nom['num_nom'], implode(',', $num_nom_en_erreur), $nom['exclure_taxref']);
1196
					$noms_erreur[] = array($nom['num_nom'], implode(',', $num_nom_en_erreur), $nom['exclure_taxref']);
1194
				}
1197
				}
1195
			}
1198
			}
1196
		}
1199
		}
1197
		return $noms_erreur;
1200
		return $noms_erreur;
1198
	}
1201
	}
1199
	
1202
	
1200
	/**
1203
	/**
1201
	 * Test #56
1204
	 * Test #56
1202
	 */
1205
	 */
1203
	private function testerSynonymeDouteuxSyntaxe() {
1206
	private function testerSynonymeDouteuxSyntaxe() {
1204
		$noms_erreur = array();
1207
		$noms_erreur = array();
1205
		foreach ($this->noms as &$nom) {
1208
		foreach ($this->noms as &$nom) {
1206
			if ($nom['synonyme_douteux'] != '') {
1209
			if ($nom['synonyme_douteux'] != '') {
1207
				if (!$this->verifierBooleen($nom['synonyme_douteux'])) {
1210
				if (!$this->verifierBooleen($nom['synonyme_douteux'])) {
1208
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1211
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1209
				}
1212
				}
1210
			}
1213
			}
1211
		}
1214
		}
1212
		return $noms_erreur;		
1215
		return $noms_erreur;		
1213
	}
1216
	}
1214
	
1217
	
1215
	/**
1218
	/**
1216
	 * Test #57
1219
	 * Test #57
1217
	 */
1220
	 */
1218
	private function testerSynonymeDouteuxNumNomRetenu() {
1221
	private function testerSynonymeDouteuxNumNomRetenu() {
1219
		$noms_erreur = array();
1222
		$noms_erreur = array();
1220
		foreach ($this->noms as &$nom) {
1223
		foreach ($this->noms as &$nom) {
1221
			if ($nom['synonyme_douteux'] == 1 && !$this->verifierNombre($nom['num_nom_retenu'])) {
1224
			if ($nom['synonyme_douteux'] == 1 && !$this->verifierNombre($nom['num_nom_retenu'])) {
1222
				$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1225
				$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1223
			}
1226
			}
1224
		}
1227
		}
1225
		return $noms_erreur;
1228
		return $noms_erreur;
1226
	}
1229
	}
1227
	
1230
	
1228
	/**
1231
	/**
1229
	 * Test #58
1232
	 * Test #58
1230
	 */
1233
	 */
1231
	private function testerSynonymeMalAppliqueSyntaxe() {
1234
	private function testerSynonymeMalAppliqueSyntaxe() {
1232
		$noms_erreur = array();
1235
		$noms_erreur = array();
1233
		foreach ($this->noms as &$nom) {
1236
		foreach ($this->noms as &$nom) {
1234
			if ($nom['synonyme_mal_applique'] != '') {
1237
			if ($nom['synonyme_mal_applique'] != '') {
1235
				if (!$this->verifierBooleen($nom['synonyme_mal_applique'])) {
1238
				if (!$this->verifierBooleen($nom['synonyme_mal_applique'])) {
1236
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_mal_applique'], $nom['exclure_taxref']);
1239
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_mal_applique'], $nom['exclure_taxref']);
1237
				}
1240
				}
1238
			}
1241
			}
1239
		}
1242
		}
1240
		return $noms_erreur;
1243
		return $noms_erreur;
1241
	}
1244
	}
1242
	
1245
	
1243
	/**
1246
	/**
1244
	 * Test #59
1247
	 * Test #59
1245
	 */
1248
	 */
1246
	private function testerSynonymeOrthographiqueSyntaxe() {
1249
	private function testerSynonymeOrthographiqueSyntaxe() {
1247
		$noms_erreur = array();
1250
		$noms_erreur = array();
1248
		foreach ($this->noms as $nom) {
1251
		foreach ($this->noms as $nom) {
1249
			if ($nom['synonyme_orthographique'] != '') {
1252
			if ($nom['synonyme_orthographique'] != '') {
1250
				if (!$this->verifierNombre($nom['synonyme_orthographique'])) {
1253
				if (!$this->verifierNombre($nom['synonyme_orthographique'])) {
1251
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1254
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1252
				}
1255
				}
1253
			}
1256
			}
1254
		}
1257
		}
1255
		return $noms_erreur;
1258
		return $noms_erreur;
1256
	}
1259
	}
1257
	
1260
	
1258
	/**
1261
	/**
1259
	 * Test #60
1262
	 * Test #60
1260
	 */
1263
	 */
1261
	private function testerSynonymeOrthographiqueExistence() {
1264
	private function testerSynonymeOrthographiqueExistence() {
1262
		$noms_erreur = array();
1265
		$noms_erreur = array();
1263
		foreach ($this->noms as &$nom) {
1266
		foreach ($this->noms as &$nom) {
1264
			if ($nom['synonyme_orthographique'] != '') {
1267
			if ($nom['synonyme_orthographique'] != '') {
1265
				if (!isset($this->noms[$nom['synonyme_orthographique']])) {
1268
				if (!isset($this->noms[$nom['synonyme_orthographique']])) {
1266
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1269
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1267
				}
1270
				}
1268
			}
1271
			}
1269
		}
1272
		}
1270
		return $noms_erreur;
1273
		return $noms_erreur;
1271
	}
1274
	}
1272
	
1275
	
1273
	/**
1276
	/**
1274
	 * Test #61
1277
	 * Test #61
1275
	 */
1278
	 */
1276
	private function testerHybrideParent01Syntaxe() {
1279
	private function testerHybrideParent01Syntaxe() {
1277
		$noms_erreur = array();
1280
		$noms_erreur = array();
1278
		foreach ($this->noms as &$nom) {
1281
		foreach ($this->noms as &$nom) {
1279
			if ($nom['hybride_parent_01'] != '') {
1282
			if ($nom['hybride_parent_01'] != '') {
1280
				if (!$this->verifierNombre($nom['hybride_parent_01'])) {
1283
				if (!$this->verifierNombre($nom['hybride_parent_01'])) {
1281
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1284
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1282
				}
1285
				}
1283
			}
1286
			}
1284
		}
1287
		}
1285
		return $noms_erreur;
1288
		return $noms_erreur;
1286
	}
1289
	}
1287
	
1290
	
1288
	/**
1291
	/**
1289
	 * Test #62
1292
	 * Test #62
1290
	 */
1293
	 */
1291
	private function testerHybrideParent01Existence() {
1294
	private function testerHybrideParent01Existence() {
1292
		$noms_erreur = array();
1295
		$noms_erreur = array();
1293
		foreach ($this->noms as &$nom) {
1296
		foreach ($this->noms as &$nom) {
1294
			if ($nom['hybride_parent_01'] != '' && $nom['hybride_parent_01'] != '0') {
1297
			if ($nom['hybride_parent_01'] != '' && $nom['hybride_parent_01'] != '0') {
1295
				if (!isset($this->noms[$nom['hybride_parent_01']])) {
1298
				if (!isset($this->noms[$nom['hybride_parent_01']])) {
1296
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1299
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1297
				}
1300
				}
1298
			}
1301
			}
1299
		}
1302
		}
1300
		return $noms_erreur;
1303
		return $noms_erreur;
1301
	}
1304
	}
1302
	
1305
	
1303
	/**
1306
	/**
1304
	 * Test #63
1307
	 * Test #63
1305
	 */
1308
	 */
1306
	private function testerHybrideParent02Syntaxe() {
1309
	private function testerHybrideParent02Syntaxe() {
1307
		$noms_erreur = array();
1310
		$noms_erreur = array();
1308
		foreach ($this->noms as &$nom) {
1311
		foreach ($this->noms as &$nom) {
1309
			if ($nom['hybride_parent_02'] != '') {
1312
			if ($nom['hybride_parent_02'] != '') {
1310
				if (!$this->verifierNombre($nom['hybride_parent_02'])) {
1313
				if (!$this->verifierNombre($nom['hybride_parent_02'])) {
1311
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1314
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1312
				}
1315
				}
1313
			}
1316
			}
1314
		}
1317
		}
1315
		return $noms_erreur;
1318
		return $noms_erreur;
1316
	}
1319
	}
1317
	
1320
	
1318
	/**
1321
	/**
1319
	 * Test #64
1322
	 * Test #64
1320
	 */
1323
	 */
1321
	private function testerHybrideParent02Existence() {
1324
	private function testerHybrideParent02Existence() {
1322
		$noms_erreur = array();
1325
		$noms_erreur = array();
1323
		foreach ($this->noms as &$nom) {
1326
		foreach ($this->noms as &$nom) {
1324
			if ($nom['hybride_parent_02'] != '') {
1327
			if ($nom['hybride_parent_02'] != '') {
1325
				if (!isset($this->noms[$nom['hybride_parent_02']]) && $nom['hybride_parent_02'] != '0') {
1328
				if (!isset($this->noms[$nom['hybride_parent_02']]) && $nom['hybride_parent_02'] != '0') {
1326
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1329
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1327
				}
1330
				}
1328
			}
1331
			}
1329
		}
1332
		}
1330
		return $noms_erreur;
1333
		return $noms_erreur;
1331
	}
1334
	}
1332
	
1335
	
1333
	/**
1336
	/**
1334
	 * Test #65
1337
	 * Test #65
1335
	 */
1338
	 */
1336
	private function testerPresenceSyntaxe() {
1339
	private function testerPresenceSyntaxe() {
1337
		$noms_erreur = array();
1340
		$noms_erreur = array();
1338
		foreach ($this->noms as &$nom) {
1341
		foreach ($this->noms as &$nom) {
1339
			if ($nom['presence'] != '') {
1342
			if ($nom['presence'] != '') {
1340
				if (!$this->verifierPresence($nom['presence'])) {
1343
				if (!$this->verifierPresence($nom['presence'])) {
1341
					$noms_erreur[] = array($nom['num_nom'], $nom['presence'], $nom['exclure_taxref']);
1344
					$noms_erreur[] = array($nom['num_nom'], $nom['presence'], $nom['exclure_taxref']);
1342
				}
1345
				}
1343
			}
1346
			}
1344
		}
1347
		}
1345
		return $noms_erreur;
1348
		return $noms_erreur;
1346
	}
1349
	}
1347
	
1350
	
1348
	/**
1351
	/**
1349
	 * Test #66
1352
	 * Test #66
1350
	 */
1353
	 */
1351
	private function testerStatutOrigineSyntaxe() {
1354
	private function testerStatutOrigineSyntaxe() {
1352
		$noms_erreur = array();
1355
		$noms_erreur = array();
1353
		foreach ($this->noms as &$nom) {
1356
		foreach ($this->noms as &$nom) {
1354
			if ($nom['statut_origine'] != '') {
1357
			if ($nom['statut_origine'] != '') {
1355
				if (!$this->verifierStatutOrigine($nom['statut_origine'])) {
1358
				if (!$this->verifierStatutOrigine($nom['statut_origine'])) {
1356
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_origine'], $nom['exclure_taxref']);
1359
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_origine'], $nom['exclure_taxref']);
1357
				}
1360
				}
1358
			}
1361
			}
1359
		}
1362
		}
1360
		return $noms_erreur;
1363
		return $noms_erreur;
1361
	}
1364
	}
1362
	
1365
	
1363
	/**
1366
	/**
1364
	 * Test #67
1367
	 * Test #67
1365
	 */
1368
	 */
1366
	private function testerStatutIntroductionSyntaxe() {
1369
	private function testerStatutIntroductionSyntaxe() {
1367
		$noms_erreur = array();
1370
		$noms_erreur = array();
1368
		foreach ($this->noms as &$nom) {
1371
		foreach ($this->noms as &$nom) {
1369
			if ($nom['statut_introduction'] != '') {
1372
			if ($nom['statut_introduction'] != '') {
1370
				if (!$this->verifierStatutIntroduction($nom['statut_introduction'])) {
1373
				if (!$this->verifierStatutIntroduction($nom['statut_introduction'])) {
1371
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_introduction'], $nom['exclure_taxref']);
1374
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_introduction'], $nom['exclure_taxref']);
1372
				}
1375
				}
1373
			}
1376
			}
1374
		}
1377
		}
1375
		return $noms_erreur;
1378
		return $noms_erreur;
1376
	}
1379
	}
1377
	
1380
	
1378
	/**
1381
	/**
1379
	 * Test #68
1382
	 * Test #68
1380
	 */
1383
	 */
1381
	private function testerStatutCultureSyntaxe() {
1384
	private function testerStatutCultureSyntaxe() {
1382
		$noms_erreur = array();
1385
		$noms_erreur = array();
1383
		foreach ($this->noms as &$nom) {
1386
		foreach ($this->noms as &$nom) {
1384
			if ($nom['statut_culture'] != '') {
1387
			if ($nom['statut_culture'] != '') {
1385
				if (!$this->verifierStatutCulture($nom['statut_culture'])) {
1388
				if (!$this->verifierStatutCulture($nom['statut_culture'])) {
1386
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_culture'], $nom['exclure_taxref']);
1389
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_culture'], $nom['exclure_taxref']);
1387
				}
1390
				}
1388
			}
1391
			}
1389
		}
1392
		}
1390
		return $noms_erreur;
1393
		return $noms_erreur;
1391
	}
1394
	}
1392
	
1395
	
1393
	/**
1396
	/**
1394
	 * Test #69
1397
	 * Test #69
1395
	 */
1398
	 */
1396
	private function testerExclureTaxRefSyntaxe() {
1399
	private function testerExclureTaxRefSyntaxe() {
1397
		$noms_erreur = array();
1400
		$noms_erreur = array();
1398
		foreach ($this->noms as &$nom) {
1401
		foreach ($this->noms as &$nom) {
1399
			if ($nom['exclure_taxref'] != '' && $nom['exclure_taxref'] != null) {
1402
			if ($nom['exclure_taxref'] != '' && $nom['exclure_taxref'] != null) {
1400
				if (!preg_match('/^(?:0|1|9)$/', $nom['exclure_taxref'])) {
1403
				if (!preg_match('/^(?:0|1|9)$/', $nom['exclure_taxref'])) {
1401
					$noms_erreur[] = array($nom['num_nom'], $nom['exclure_taxref']);
1404
					$noms_erreur[] = array($nom['num_nom'], $nom['exclure_taxref']);
1402
				}
1405
				}
1403
			}
1406
			}
1404
		}
1407
		}
1405
		return $noms_erreur;
1408
		return $noms_erreur;
1406
	}
1409
	}
1407
 
1410
 
1408
	
1411
	
1409
 
1412
 
1410
	//+--------------------------------------------------------------------------------------------------------------+//
1413
	//+--------------------------------------------------------------------------------------------------------------+//
1411
	// MÉTHODES COMMUNES aux TESTS
1414
	// MÉTHODES COMMUNES aux TESTS
1412
	
1415
	
1413
	private function verifierPresence(&$valeur) {
1416
	private function verifierPresence(&$valeur) {
1414
		$codes = $this->manuel['codes_presence'];
1417
		$codes = $this->manuel['codes_presence'];
1415
		$ok = $this->verifierStatuts($valeur, $codes);
1418
		$ok = $this->verifierStatuts($valeur, $codes);
1416
		return $ok;
1419
		return $ok;
1417
	}
1420
	}
1418
	
1421
	
1419
	private function verifierStatutOrigine(&$valeur) {
1422
	private function verifierStatutOrigine(&$valeur) {
1420
		$codes = $this->manuel['codes_statuts_origine'];
1423
		$codes = $this->manuel['codes_statuts_origine'];
1421
		$ok = $this->verifierStatuts($valeur, $codes);
1424
		$ok = $this->verifierStatuts($valeur, $codes);
1422
		return $ok;
1425
		return $ok;
1423
	}
1426
	}
1424
	
1427
	
1425
	private function verifierStatutIntroduction(&$valeur) {
1428
	private function verifierStatutIntroduction(&$valeur) {
1426
		$codes = $this->manuel['codes_statuts_introduction'];
1429
		$codes = $this->manuel['codes_statuts_introduction'];
1427
		$ok = $this->verifierStatuts($valeur, $codes);
1430
		$ok = $this->verifierStatuts($valeur, $codes);
1428
		return $ok;
1431
		return $ok;
1429
	}
1432
	}
1430
	
1433
	
1431
	private function verifierStatutCulture(&$valeur) {
1434
	private function verifierStatutCulture(&$valeur) {
1432
		$codes = $this->manuel['codes_statuts_culture'];
1435
		$codes = $this->manuel['codes_statuts_culture'];
1433
		$ok = $this->verifierStatuts($valeur, $codes);
1436
		$ok = $this->verifierStatuts($valeur, $codes);
1434
		return $ok;
1437
		return $ok;
1435
	}
1438
	}
1436
	
1439
	
1437
	private function verifierStatuts(&$valeur, &$codes) {
1440
	private function verifierStatuts(&$valeur, &$codes) {
1438
		$ok = true;
1441
		$ok = true;
1439
		if (!preg_match("/^(?:|-|[$codes](?:-[A-Z])?)$/", $valeur)) {
1442
		if (!preg_match("/^(?:|-|[$codes](?:-[A-Z])?)$/", $valeur)) {
1440
			$ok = false;
1443
			$ok = false;
1441
		}
1444
		}
1442
		return $ok;
1445
		return $ok;
1443
	}
1446
	}
1444
	
1447
	
1445
	private function verifierBooleen(&$valeur) {
1448
	private function verifierBooleen(&$valeur) {
1446
		$ok = true;
1449
		$ok = true;
1447
		if (!preg_match('/^1$/', $valeur)) {
1450
		if (!preg_match('/^1$/', $valeur)) {
1448
			$ok = false;
1451
			$ok = false;
1449
		}
1452
		}
1450
		return $ok;
1453
		return $ok;
1451
	}
1454
	}
1452
	
1455
	
1453
	private function verifierNombre(&$valeur) {
1456
	private function verifierNombre(&$valeur) {
1454
		$ok = true;
1457
		$ok = true;
1455
		if (!preg_match('/^[0-9]+$/', $valeur)) {
1458
		if (!preg_match('/^[0-9]+$/', $valeur)) {
1456
			$ok = false;
1459
			$ok = false;
1457
		}
1460
		}
1458
		return $ok;
1461
		return $ok;
1459
	}
1462
	}
1460
	
1463
	
1461
	private function verifierNombreSuite(&$valeur) {
1464
	private function verifierNombreSuite(&$valeur) {
1462
		$ok = true;
1465
		$ok = true;
1463
		if (!preg_match('/^(?:[0-9]+,)*[0-9]+$/', $valeur)) {
1466
		if (!preg_match('/^(?:[0-9]+,)*[0-9]+$/', $valeur)) {
1464
			$ok = false;
1467
			$ok = false;
1465
		}
1468
		}
1466
		return $ok;
1469
		return $ok;
1467
	}
1470
	}
1468
	
1471
	
1469
	private function verifierTypeEpithete(&$type) {
1472
	private function verifierTypeEpithete(&$type) {
1470
		$ok = false;
1473
		$ok = false;
1471
		$rejetes = $this->manuel['type_epithete_rejetes'];
1474
		$rejetes = $this->manuel['type_epithete_rejetes'];
1472
		if (preg_replace("/^(?:$rejetes)$/", '', $type) == '') {
1475
		if (preg_replace("/^(?:$rejetes)$/", '', $type) == '') {
1473
			$ok = false;
1476
			$ok = false;
1474
		} else if (preg_match('/^[a-z][-a-z]*[.]?$/', $type)) {
1477
		} else if (preg_match('/^[a-z][-a-z]*[.]?$/', $type)) {
1475
			$ok = true;
1478
			$ok = true;
1476
		}
1479
		}
1477
		return $ok;
1480
		return $ok;
1478
	}
1481
	}
1479
	
1482
	
1480
	private function verifierBiblioOrigine(&$intitule) {
1483
	private function verifierBiblioOrigine(&$intitule) {
1481
		$ok = true;
1484
		$ok = true;
1482
		if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1485
		if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1483
			$ok = false;// Contient des espaces en trop
1486
			$ok = false;// Contient des espaces en trop
1484
		} else if (!preg_match('/^(?:in [^;]+[;]|)[^,]+?(?:[,][^:]+|)(?:[:].+|)$/', $intitule)) {
1487
		} else if (!preg_match('/^(?:in [^;]+[;]|)[^,]+?(?:[,][^:]+|)(?:[:].+|)$/', $intitule)) {
1485
			$ok = false;
1488
			$ok = false;
1486
		} else if (preg_match('/(?:(?:^|[,:])\s*(?:[:,]|$))/', $intitule)) {
1489
		} else if (preg_match('/(?:(?:^|[,:])\s*(?:[:,]|$))/', $intitule)) {
1487
			$ok = false;// Contient une mauvaise suite de caractères
1490
			$ok = false;// Contient une mauvaise suite de caractères
1488
		}
1491
		}
1489
		return $ok;
1492
		return $ok;
1490
	}
1493
	}
1491
	
1494
	
1492
	private function verifierAnnee(&$annee) {
1495
	private function verifierAnnee(&$annee) {
1493
		$ok = true;
1496
		$ok = true;
1494
		if (!preg_match('/^[0-9]{4}$/', $annee)) {
1497
		if (!preg_match('/^[0-9]{4}$/', $annee)) {
1495
			$ok = false;
1498
			$ok = false;
1496
		} else if ($annee < ANNEE_MINIMUM) {
1499
		} else if ($annee < ANNEE_MINIMUM) {
1497
			$ok = false;
1500
			$ok = false;
1498
		} else if ($annee > ANNEE_EN_COURS) {
1501
		} else if ($annee > ANNEE_EN_COURS) {
1499
			$ok = false;
1502
			$ok = false;
1500
		}
1503
		}
1501
		return $ok;
1504
		return $ok;
1502
	}
1505
	}
1503
	
1506
	
1504
	private function verifierAuteur(&$intitule) {
1507
	private function verifierAuteur(&$intitule) {
1505
		$ok = true;
1508
		$ok = true;
1506
		$acceptes = $this->manuel['auteur_acceptes'];
1509
		$acceptes = $this->manuel['auteur_acceptes'];
1507
		if (!preg_match("/^(?:$acceptes)$/", $intitule)) {
1510
		if (!preg_match("/^(?:$acceptes)$/", $intitule)) {
1508
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1511
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1509
				$ok = false;// Contient des espaces en trop
1512
				$ok = false;// Contient des espaces en trop
1510
			} else {
1513
			} else {
1511
				$mots_rejetes = $this->manuel['auteur_mots_rejetes'];
1514
				$mots_rejetes = $this->manuel['auteur_mots_rejetes'];
1512
				$mots = explode(' ', $intitule);
1515
				$mots = explode(' ', $intitule);
1513
				foreach ($mots as $position => $mot) {
1516
				foreach ($mots as $position => $mot) {
1514
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1517
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1515
						$ok = false;// Mot rejeté
1518
						$ok = false;// Mot rejeté
1516
					} else if (preg_match("/^(?:(?:\p{L}|[.'\(\),-])+|[&])$/u", $mot)) {
1519
					} else if (preg_match("/^(?:(?:\p{L}|[.'\(\),-])+|[&])$/u", $mot)) {
1517
						continue;// Mot de l'intitulé auteur
1520
						continue;// Mot de l'intitulé auteur
1518
					} else {
1521
					} else {
1519
						$ok = false;
1522
						$ok = false;
1520
					}
1523
					}
1521
				}
1524
				}
1522
			}
1525
			}
1523
		}
1526
		}
1524
		return $ok;
1527
		return $ok;
1525
	}
1528
	}
1526
	
1529
	
1527
	private function verifierNomCommercial(&$epithete) {
1530
	private function verifierNomCommercial(&$epithete) {
1528
		$ok = false;
1531
		$ok = false;
1529
		if (preg_match("/^[[:upper:][:punct:][:digit:][:space:]]+$/", $epithete)) {
1532
		if (preg_match("/^[[:upper:][:punct:][:digit:][:space:]]+$/", $epithete)) {
1530
			$ok = true;
1533
			$ok = true;
1531
		}
1534
		}
1532
		return $ok;
1535
		return $ok;
1533
	}
1536
	}
1534
	
1537
	
1535
	private function verifierEpitheteCultivar(&$epithete) {
1538
	private function verifierEpitheteCultivar(&$epithete) {
1536
		$ok = true;
1539
		$ok = true;
1537
		$acceptes = $this->manuel['cultivar_acceptes'];
1540
		$acceptes = $this->manuel['cultivar_acceptes'];
1538
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1541
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1539
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1542
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1540
				$ok = false;// Contient des espaces en trop
1543
				$ok = false;// Contient des espaces en trop
1541
			} else {
1544
			} else {
1542
				$mots_rejetes = $this->manuel['cultivar_mots_rejetes'];
1545
				$mots_rejetes = $this->manuel['cultivar_mots_rejetes'];
1543
				$mots_mineurs = $this->manuel['mots_mineurs'];
1546
				$mots_mineurs = $this->manuel['mots_mineurs'];
1544
				$mots = explode(' ', $epithete);
1547
				$mots = explode(' ', $epithete);
1545
				foreach ($mots as $position => $mot) {
1548
				foreach ($mots as $position => $mot) {
1546
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1549
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1547
						$ok = false;// Mot rejeté
1550
						$ok = false;// Mot rejeté
1548
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1551
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1549
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1552
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1550
					} else {
1553
					} else {
1551
						$mots_tiret = explode('-', $mot);
1554
						$mots_tiret = explode('-', $mot);
1552
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1555
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1553
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1556
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1554
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position
1557
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position
1555
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1558
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1556
								continue;//Mot (ou 'mot-tiret') avec lettre initiale majuscule
1559
								continue;//Mot (ou 'mot-tiret') avec lettre initiale majuscule
1557
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1560
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1558
								continue;//Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1561
								continue;//Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1559
							} else {
1562
							} else {
1560
								$ok = false;
1563
								$ok = false;
1561
							}
1564
							}
1562
						}
1565
						}
1563
					}
1566
					}
1564
				}
1567
				}
1565
			}
1568
			}
1566
		}
1569
		}
1567
		return $ok;
1570
		return $ok;
1568
	}
1571
	}
1569
	
1572
	
1570
	private function verifierEpitheteGroupeCultivar(&$epithete) {
1573
	private function verifierEpitheteGroupeCultivar(&$epithete) {
1571
		$ok = true;
1574
		$ok = true;
1572
		$acceptes = $this->manuel['cultivar_gp_acceptes'];
1575
		$acceptes = $this->manuel['cultivar_gp_acceptes'];
1573
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1576
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1574
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1577
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1575
				$ok = false;// Contient des espaces en trop
1578
				$ok = false;// Contient des espaces en trop
1576
			} else {
1579
			} else {
1577
				$mots_acceptes = $this->manuel['cultivar_gp_mots_acceptes'];
1580
				$mots_acceptes = $this->manuel['cultivar_gp_mots_acceptes'];
1578
				$mots_rejetes = $this->manuel['cultivar_gp_mots_rejetes'];
1581
				$mots_rejetes = $this->manuel['cultivar_gp_mots_rejetes'];
1579
				$mots_mineurs = $this->manuel['mots_mineurs'];
1582
				$mots_mineurs = $this->manuel['mots_mineurs'];
1580
				$mots = explode(' ', $epithete);
1583
				$mots = explode(' ', $epithete);
1581
				foreach ($mots as $position => $mot) {
1584
				foreach ($mots as $position => $mot) {
1582
					if (preg_match("/^(?:$mots_acceptes)$/i", $mot)) {
1585
					if (preg_match("/^(?:$mots_acceptes)$/i", $mot)) {
1583
						continue;// Mot accepté
1586
						continue;// Mot accepté
1584
					} else if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1587
					} else if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1585
						$ok = false;// Mot rejeté
1588
						$ok = false;// Mot rejeté
1586
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1589
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1587
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1590
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1588
					} else {
1591
					} else {
1589
						$mots_tiret = explode('-', $mot);
1592
						$mots_tiret = explode('-', $mot);
1590
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1593
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1591
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1594
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1592
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position dans le mot
1595
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position dans le mot
1593
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1596
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1594
								continue;// Mot (ou 'mot-tiret') avec lettre initiale majuscule
1597
								continue;// Mot (ou 'mot-tiret') avec lettre initiale majuscule
1595
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1598
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1596
								continue;// Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1599
								continue;// Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1597
							} else {
1600
							} else {
1598
								$ok = false;
1601
								$ok = false;
1599
							}
1602
							}
1600
						}
1603
						}
1601
					}
1604
					}
1602
				}
1605
				}
1603
			}
1606
			}
1604
		}
1607
		}
1605
		return $ok;
1608
		return $ok;
1606
	}
1609
	}
1607
	
1610
	
1608
	private function verifierEpitheteSp(&$epithete) {
1611
	private function verifierEpitheteSp(&$epithete) {
1609
		$ok = false;
1612
		$ok = false;
1610
		if (preg_match('/^[a-zäëḧïöẗüẅẍÿ][-a-zäëḧïöẗüẅẍÿ]+$/', $epithete)) {
1613
		if (preg_match('/^[a-zäëḧïöẗüẅẍÿ][-a-zäëḧïöẗüẅẍÿ]+$/', $epithete)) {
1611
			$ok = true;
1614
			$ok = true;
1612
		} else if (preg_match('/^sp\.(?:[A-Z]|[1-9][0-9]*)$/', $epithete)) {
1615
		} else if (preg_match('/^sp\.(?:[A-Z]|[1-9][0-9]*)$/', $epithete)) {
1613
			$ok = true;
1616
			$ok = true;
1614
		}
1617
		}
1615
		return $ok;
1618
		return $ok;
1616
	}
1619
	}
1617
	
1620
	
1618
	private function verifierEpitheteGenre(&$epithete) {
1621
	private function verifierEpitheteGenre(&$epithete) {
1619
		$ok = false;
1622
		$ok = false;
1620
		if (preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ](?:[-a-zäëḧïöẗüẅẍÿ]+|[a-zäëḧïöẗüẅẍÿ]+-[A-ZÄËḦÏÖÜẄẌŸ][a-zäëḧïöẗüẅẍÿ]+)$/', $epithete)) {
1623
		if (preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ](?:[-a-zäëḧïöẗüẅẍÿ]+|[a-zäëḧïöẗüẅẍÿ]+-[A-ZÄËḦÏÖÜẄẌŸ][a-zäëḧïöẗüẅẍÿ]+)$/', $epithete)) {
1621
			$ok = true;
1624
			$ok = true;
1622
		}
1625
		}
1623
		return $ok;
1626
		return $ok;
1624
	}
1627
	}
1625
	
1628
	
1626
	private function formaterStyleNomGenre(&$genre) {
1629
	private function formaterStyleNomGenre(&$genre) {
1627
		$genre_fmt = '';
1630
		$genre_fmt = '';
1628
		if (preg_match('/^\s*([x+])\s+(.+)$/i', $genre, $match)) {
1631
		if (preg_match('/^\s*([x+])\s+(.+)$/i', $genre, $match)) {
1629
			$genre_fmt = utf8_encode(strtolower(utf8_decode($match[1]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[2]))));
1632
			$genre_fmt = utf8_encode(strtolower(utf8_decode($match[1]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[2]))));
1630
		} elseif (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $genre, $match)) {
1633
		} elseif (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $genre, $match)) {
1631
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1634
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1632
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1635
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1633
		} else {
1636
		} else {
1634
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($genre))));
1637
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($genre))));
1635
		}
1638
		}
1636
		return $genre_fmt;
1639
		return $genre_fmt;
1637
	}
1640
	}
-
 
1641
	
-
 
1642
	private function formaterStyleEpitheteSpHybride(&$genre, &$epithete) {
-
 
1643
		$nom_fmt = '';
-
 
1644
		$erreur = '';
-
 
1645
		if (trim($genre) == '') {
-
 
1646
			if ($epithete != '') {
-
 
1647
				$nom_fmt = $this->formaterFormuleHybridite($epithete);
-
 
1648
			} else {
-
 
1649
				$erreur = "Formule d'hybridité sans épithéte spécifique";
-
 
1650
			}
-
 
1651
		} else {
-
 
1652
			$nom_fmt = $this->formaterNomHybride($genre, $epithete);
-
 
1653
		}
-
 
1654
		return array($nom_fmt, $erreur);
-
 
1655
	}
-
 
1656
	
-
 
1657
	private function formaterStyleEpitheteInfraSpHybride(&$nom_sci, &$infra, &$genre = null) {		
-
 
1658
		$nom_fmt = '';
-
 
1659
		$erreur = '';
-
 
1660
		if (trim($genre) == '') {
-
 
1661
			if (trim($nom_sci) == '') {
-
 
1662
				if (trim($infra) != '') {
-
 
1663
					$nom_fmt = $this->formaterFormuleHybridite($infra);
-
 
1664
				} else {
-
 
1665
					$erreur = "Formule d'hybridité sans épithéte infraspécifique";
-
 
1666
				}
-
 
1667
			} else {
-
 
1668
				$erreur = "Formule d'hybridité avec épithéte spécifique";
-
 
1669
			}
-
 
1670
		} else {
-
 
1671
			$nom_fmt = $this->formaterNomHybride($nom_sci, $infra);
-
 
1672
		}
-
 
1673
		return array($nom_fmt, $erreur);
-
 
1674
	}
-
 
1675
	
-
 
1676
	private function formaterNomHybride(&$nom_sci, &$epithete) {
-
 
1677
		if (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $epithete, $match) != '') {
-
 
1678
			$nom_fmt = $nom_sci.utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
-
 
1679
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.
-
 
1680
				utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
-
 
1681
		} elseif (preg_match('/^([x+])\s+(.+)$/i', $epithete, $match) != '') {
-
 
1682
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($match[1]))).' '.
-
 
1683
				utf8_encode(strtolower(utf8_decode($match[2])));
-
 
1684
		} else {
-
 
1685
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($epithete)));
-
 
1686
		}
-
 
1687
		return $nom_fmt;
-
 
1688
	}
-
 
1689
	
-
 
1690
	private function formaterFormuleHybridite(&$epithete) {
-
 
1691
		$liste_parents = explode(' x ', $epithete);
-
 
1692
		if (count($liste_parents) == 2) {
-
 
1693
			$nom_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[0])))).' x '.
-
 
1694
			utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[1]))));
-
 
1695
		} else {
-
 
1696
			for ($i=0; $i<count($liste_parents); $i++) {
-
 
1697
				if (strstr(trim($liste_parents[$i]), ' ') == false) {
-
 
1698
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode(trim($liste_parents[$i]))))).' x '.
-
 
1699
					utf8_encode(strtolower(utf8_decode(trim($liste_parents[$i+1]))));
-
 
1700
					$i++;
-
 
1701
				} else {
-
 
1702
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[$i]))));
-
 
1703
				}
-
 
1704
			}
-
 
1705
			$nom_fmt = implode(' x ', $nom);
-
 
1706
		}
-
 
1707
		return $nom_fmt;
-
 
1708
	}
1638
	
1709
	
1639
	private function repererEspace($nom_sci) {
1710
	private function repererEspace($nom_sci) {
1640
		$nom_sci = str_replace(' ', '<span class="espace">&nbsp;</span>', $nom_sci);
1711
		$nom_sci = str_replace(' ', '<span class="espace">&nbsp;</span>', $nom_sci);
1641
		return $nom_sci;
1712
		return $nom_sci;
1642
	}
1713
	}
1643
	
1714
	
1644
	private function construireSuffixeNomPltCultivee(&$nom) {
1715
	private function construireSuffixeNomPltCultivee(&$nom) {
1645
		$suffixe = array();
1716
		$suffixe = array();
1646
		$suffixe[] = $this->construireNomCultivarGroupe($nom);
1717
		$suffixe[] = $this->construireNomCultivarGroupe($nom);
1647
		$suffixe[] = $this->construireNomCommercial($nom);
1718
		$suffixe[] = $this->construireNomCommercial($nom);
1648
		$suffixe[] = $this->construireNomCultivar($nom);
1719
		$suffixe[] = $this->construireNomCultivar($nom);
1649
		$suffixe = array_filter($suffixe);
1720
		$suffixe = array_filter($suffixe);
1650
		return implode(' ', $suffixe);
1721
		return implode(' ', $suffixe);
1651
	}
1722
	}
1652
	
1723
	
1653
	private function construireNomCultivarGroupe(&$nom) {
1724
	private function construireNomCultivarGroupe(&$nom) {
1654
		$nom_groupe_cultivar = '';
1725
		$nom_groupe_cultivar = '';
1655
		if ($nom['cultivar_groupe'] != '') {
1726
		if ($nom['cultivar_groupe'] != '') {
1656
			if (preg_match('/ gx$/', $nom['cultivar_groupe'])) {
1727
			if (preg_match('/ gx$/', $nom['cultivar_groupe'])) {
1657
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].')';
1728
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].')';
1658
			} else {
1729
			} else {
1659
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].' Gp)';
1730
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].' Gp)';
1660
			}
1731
			}
1661
		}
1732
		}
1662
		return $nom_groupe_cultivar;
1733
		return $nom_groupe_cultivar;
1663
	}
1734
	}
1664
	
1735
	
1665
	private function construireNomCommercial(&$nom) {
1736
	private function construireNomCommercial(&$nom) {
1666
		$nom_commercial = '';
1737
		$nom_commercial = '';
1667
		if ($nom['nom_commercial'] != '') {
1738
		if ($nom['nom_commercial'] != '') {
1668
			$nom_commercial =  strtoupper($nom['nom_commercial']);
1739
			$nom_commercial =  strtoupper($nom['nom_commercial']);
1669
		}
1740
		}
1670
		return $nom_commercial;
1741
		return $nom_commercial;
1671
	}
1742
	}
1672
	
1743
	
1673
	private function construireNomCultivar(&$nom) {
1744
	private function construireNomCultivar(&$nom) {
1674
		$nom_cultivar = '';
1745
		$nom_cultivar = '';
1675
		if ($nom['cultivar'] != '') {
1746
		if ($nom['cultivar'] != '') {
1676
			$nom_cultivar =  "'".$nom['cultivar']."'";
1747
			$nom_cultivar =  "'".$nom['cultivar']."'";
1677
		}
1748
		}
1678
		return $nom_cultivar;
1749
		return $nom_cultivar;
1679
	}
1750
	}
1680
	
1751
	
1681
	private function classerNomsParNomComplet() {
1752
	private function classerNomsParNomComplet() {
1682
		$noms_classes = array();
1753
		$noms_classes = array();
1683
		foreach ($this->noms as &$nom) {
1754
		foreach ($this->noms as &$nom) {
1684
			if (!isset($noms_classes[$nom['nom_sci']])) {
1755
			if (!isset($noms_classes[$nom['nom_sci']])) {
1685
				$noms_classes[$nom['nom_sci']] = 1;
1756
				$noms_classes[$nom['nom_sci']] = 1;
1686
			} else {
1757
			} else {
1687
				$noms_classes[$nom['nom_sci']]++;
1758
				$noms_classes[$nom['nom_sci']]++;
1688
			}
1759
			}
1689
		}
1760
		}
1690
		return $noms_classes;
1761
		return $noms_classes;
1691
	}
1762
	}
1692
}
1763
}
1693
?>
1764
?>