Subversion Repositories Applications.referentiel

Rev

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

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