Subversion Repositories Applications.referentiel

Rev

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

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