Subversion Repositories Applications.referentiel

Rev

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

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