Subversion Repositories Applications.referentiel

Rev

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

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