Subversion Repositories Applications.referentiel

Rev

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

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