Subversion Repositories Applications.referentiel

Rev

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

Rev 259 Rev 262
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.3';
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
						$this->formaterStyleNomGenre($nom['epithete_infra_generique']).' '.
602
						$this->formaterStyleNomGenre($nom['epithete_infra_generique']).' '.
603
						$nom['type_epithete'];
603
						$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['type_epithete'].' '.
606
						$nom['type_epithete'].' '.
607
						$this->formaterStyleNomGenre($nom['epithete_infra_generique']);
607
						$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
		$erreur = '';
624
		$erreur = '';
625
		foreach ($this->noms as &$nom) {
625
		foreach ($this->noms as &$nom) {
626
			if ($nom['rang'] == $this->manuel['rang_sp']) {
626
			if ($nom['rang'] == $this->manuel['rang_sp']) {
627
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
627
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
628
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' ';
628
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' ';
629
				if (strstr($nom['nom_sci'] , ' x ') != false) {
629
				if (strstr($nom['nom_sci'] , ' x ') != false) {
630
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteSpHybride($nom_sci_ideal, $nom['epithete_sp']);
630
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteSpHybride($nom_sci_ideal, $nom['epithete_sp']);
631
				} else {
631
				} else {
632
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_sp'])));
632
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_sp'])));
633
				}
633
				}
634
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
634
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
635
				$nom_sci_ideal = trim($nom_sci_ideal);
635
				$nom_sci_ideal = trim($nom_sci_ideal);
636
				if ($nom['nom_sci'] != $nom_sci_ideal) {
636
				if ($nom['nom_sci'] != $nom_sci_ideal) {
637
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
637
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
638
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
638
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
639
				}
639
				}
640
			}
640
			}
641
		}
641
		}
642
		return $noms_erreur;
642
		return $noms_erreur;
643
	}
643
	}
644
	
644
	
645
	/**
645
	/**
646
	 * Test #22
646
	 * Test #22
647
	 */
647
	 */
648
	private function testerNomCompletInfraSpecifique() {
648
	private function testerNomCompletInfraSpecifique() {
649
		$noms_erreur = array();
649
		$noms_erreur = array();
650
		$erreur = null;
650
		$erreur = null;
651
		foreach ($this->noms as &$nom) {
651
		foreach ($this->noms as &$nom) {
652
			if ($nom['rang'] > $this->manuel['rang_sp']) {
652
			if ($nom['rang'] > $this->manuel['rang_sp']) {
653
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
653
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
654
					utf8_encode(strtolower(utf8_decode($nom['epithete_sp']))).' '.
654
					utf8_encode(strtolower(utf8_decode($nom['epithete_sp']))).' '.
655
					utf8_encode(strtolower(utf8_decode($nom['type_epithete']))).' ';
655
					utf8_encode(strtolower(utf8_decode($nom['type_epithete']))).' ';
656
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
656
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
657
				if (strstr($nom['nom_sci'] , ' x ') != false) {
657
				if (strstr($nom['nom_sci'] , ' x ') != false) {
658
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteInfraSpHybride($nom_sci_ideal, $nom['epithete_infra_sp'], $nom['genre']);
658
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteInfraSpHybride($nom_sci_ideal, $nom['epithete_infra_sp'], $nom['genre']);
659
				} else {
659
				} else {
660
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_infra_sp'])));
660
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_infra_sp'])));
661
				}
661
				}
662
				$nom_sci_ideal = trim($nom_sci_ideal);
662
				$nom_sci_ideal = trim($nom_sci_ideal);
663
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
663
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
664
				if ($nom['nom_sci'] != $nom_sci_ideal) {
664
				if ($nom['nom_sci'] != $nom_sci_ideal) {
665
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
665
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
666
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
666
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
667
				}
667
				}
668
			}
668
			}
669
		}
669
		}
670
		return $noms_erreur;
670
		return $noms_erreur;
671
	}
671
	}
672
	
672
	
673
	/**
673
	/**
674
	 * Test #23
674
	 * Test #23
675
	 */
675
	 */
676
	private function testerNomSupraGeneriqueEspaces() {
676
	private function testerNomSupraGeneriqueEspaces() {
677
		$noms_erreur = array();
677
		$noms_erreur = array();
678
		foreach ($this->noms as &$nom) {
678
		foreach ($this->noms as &$nom) {
679
			if ($nom['nom_supra_generique'] != '') {
679
			if ($nom['nom_supra_generique'] != '') {
680
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s+$)/', $nom['nom_supra_generique'])) {
680
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s+$)/', $nom['nom_supra_generique'])) {
681
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
681
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
682
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
682
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
683
				}
683
				}
684
			}
684
			}
685
		}
685
		}
686
		return $noms_erreur;
686
		return $noms_erreur;
687
	}
687
	}
688
	
688
	
689
	/**
689
	/**
690
	 * Test #24
690
	 * Test #24
691
	 */
691
	 */
692
	private function testerNomSupraGeneriqueSyntaxe() {
692
	private function testerNomSupraGeneriqueSyntaxe() {
693
		$noms_erreur = array();
693
		$noms_erreur = array();
694
		foreach ($this->noms as &$nom) {
694
		foreach ($this->noms as &$nom) {
695
			if ($nom['nom_supra_generique'] != '') {
695
			if ($nom['nom_supra_generique'] != '') {
696
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+$/', $nom['nom_supra_generique'])) {
696
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+$/', $nom['nom_supra_generique'])) {
697
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
697
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
698
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
698
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
699
				}
699
				}
700
			}
700
			}
701
		}
701
		}
702
		return $noms_erreur;
702
		return $noms_erreur;
703
	}
703
	}
704
	
704
	
705
	/**
705
	/**
706
	 * Test #25
706
	 * Test #25
707
	 */
707
	 */
708
	private function testerNomSupraGeneriqueRang() {
708
	private function testerNomSupraGeneriqueRang() {
709
		$noms_erreur = array();
709
		$noms_erreur = array();
710
		foreach ($this->noms as &$nom) {
710
		foreach ($this->noms as &$nom) {
711
			if ($nom['nom_supra_generique'] != '') {
711
			if ($nom['nom_supra_generique'] != '') {
712
				if ($nom['rang'] >= $this->manuel['rang_genre']) {
712
				if ($nom['rang'] >= $this->manuel['rang_genre']) {
713
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
713
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
714
				}
714
				}
715
			}
715
			}
716
		}
716
		}
717
		return $noms_erreur;
717
		return $noms_erreur;
718
	}
718
	}
719
	
719
	
720
	/**
720
	/**
721
	 * Test #26
721
	 * Test #26
722
	 */
722
	 */
723
	private function testerGenreEspaces() {
723
	private function testerGenreEspaces() {
724
		$noms_erreur = array();
724
		$noms_erreur = array();
725
		foreach ($this->noms as &$nom) {
725
		foreach ($this->noms as &$nom) {
726
			if ($nom['genre'] != '') {
726
			if ($nom['genre'] != '') {
727
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['genre'])) {
727
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['genre'])) {
728
					$nom_traite = $this->repererEspace($nom['genre']);
728
					$nom_traite = $this->repererEspace($nom['genre']);
729
					$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
729
					$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
730
				}
730
				}
731
			}
731
			}
732
		}
732
		}
733
		return $noms_erreur;
733
		return $noms_erreur;
734
	}
734
	}
735
	
735
	
736
	/**
736
	/**
737
	 * Test #27
737
	 * Test #27
738
	 */
738
	 */
739
	private function testerGenreSyntaxe() {
739
	private function testerGenreSyntaxe() {
740
		$noms_erreur = array();
740
		$noms_erreur = array();
741
		foreach ($this->noms as &$nom) {
741
		foreach ($this->noms as &$nom) {
742
			if ($nom['genre'] != '') {
742
			if ($nom['genre'] != '') {
743
				$mots = explode(' ', $nom['genre']);
743
				$mots = explode(' ', $nom['genre']);
744
				foreach ($mots as $mot) {
744
				foreach ($mots as $mot) {
745
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteGenre($mot))) {
745
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteGenre($mot))) {
746
						$nom_traite = $this->repererEspace($nom['genre']);
746
						$nom_traite = $this->repererEspace($nom['genre']);
747
						$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
747
						$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
748
						break;
748
						break;
749
					}
749
					}
750
				}
750
				}
751
			}
751
			}
752
		}
752
		}
753
		return $noms_erreur;
753
		return $noms_erreur;
754
	}
754
	}
755
	
755
	
756
	/**
756
	/**
757
	 * Test #28
757
	 * Test #28
758
	 */
758
	 */
759
	private function testerGenreRang() {
759
	private function testerGenreRang() {
760
		$noms_erreur = array();
760
		$noms_erreur = array();
761
		foreach ($this->noms as &$nom) {
761
		foreach ($this->noms as &$nom) {
762
			if ($nom['genre'] != '') {
762
			if ($nom['genre'] != '') {
763
				if ($nom['rang'] < $this->manuel['rang_genre']) {
763
				if ($nom['rang'] < $this->manuel['rang_genre']) {
764
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
764
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
765
				}
765
				}
766
			}
766
			}
767
		}
767
		}
768
		return $noms_erreur;
768
		return $noms_erreur;
769
	}
769
	}
770
		
770
		
771
	/**
771
	/**
772
	 * Test #29
772
	 * Test #29
773
	 */
773
	 */
774
	private function testerEpitheteInfraGeneriqueSyntaxe() {
774
	private function testerEpitheteInfraGeneriqueSyntaxe() {
775
		$noms_erreur = array();
775
		$noms_erreur = array();
776
		foreach ($this->noms as &$nom) {
776
		foreach ($this->noms as &$nom) {
777
			if ($nom['epithete_infra_generique'] != '') {
777
			if ($nom['epithete_infra_generique'] != '') {
778
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+/', $nom['epithete_infra_generique'])) {
778
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+/', $nom['epithete_infra_generique'])) {
779
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
779
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
780
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
780
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
781
				}
781
				}
782
			}
782
			}
783
		}
783
		}
784
		return $noms_erreur;
784
		return $noms_erreur;
785
	}
785
	}
786
	
786
	
787
	/**
787
	/**
788
	 * Test #30
788
	 * Test #30
789
	 */
789
	 */
790
	private function testerEpitheteInfraGeneriqueRang() {
790
	private function testerEpitheteInfraGeneriqueRang() {
791
		$noms_erreur = array();
791
		$noms_erreur = array();
792
		foreach ($this->noms as &$nom) {
792
		foreach ($this->noms as &$nom) {
793
			if ($nom['epithete_infra_generique'] != '') {
793
			if ($nom['epithete_infra_generique'] != '') {
794
				if ($nom['rang'] <= $this->manuel['rang_genre'] || $nom['rang'] >= $this->manuel['rang_sp']) {
794
				if ($nom['rang'] <= $this->manuel['rang_genre'] || $nom['rang'] >= $this->manuel['rang_sp']) {
795
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
795
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
796
				}
796
				}
797
			}
797
			}
798
		}
798
		}
799
		return $noms_erreur;
799
		return $noms_erreur;
800
	}
800
	}
801
	
801
	
802
	/**
802
	/**
803
	 * Test #31
803
	 * Test #31
804
	 */
804
	 */
805
	private function testerEpitheteInfraGeneriqueEspaces() {
805
	private function testerEpitheteInfraGeneriqueEspaces() {
806
		$noms_erreur = array();
806
		$noms_erreur = array();
807
		foreach ($this->noms as &$nom) {
807
		foreach ($this->noms as &$nom) {
808
			if ($nom['epithete_infra_generique'] != '') {
808
			if ($nom['epithete_infra_generique'] != '') {
809
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_generique'])) {
809
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_generique'])) {
810
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
810
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
811
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
811
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
812
				}
812
				}
813
			}
813
			}
814
		}
814
		}
815
		return $noms_erreur;
815
		return $noms_erreur;
816
	}
816
	}
817
	
817
	
818
	/**
818
	/**
819
	 * Test #32
819
	 * Test #32
820
	 */
820
	 */
821
	private function testerEpitheteSpEspaces() {
821
	private function testerEpitheteSpEspaces() {
822
		$noms_erreur = array();
822
		$noms_erreur = array();
823
		foreach ($this->noms as &$nom) {
823
		foreach ($this->noms as &$nom) {
824
			if ($nom['epithete_sp'] != '') {
824
			if ($nom['epithete_sp'] != '') {
825
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_sp'])) {
825
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_sp'])) {
826
					$epithete_traite = $this->repererEspace($nom['epithete_sp']);
826
					$epithete_traite = $this->repererEspace($nom['epithete_sp']);
827
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
827
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
828
				}
828
				}
829
			}
829
			}
830
		}
830
		}
831
		return $noms_erreur;
831
		return $noms_erreur;
832
	}
832
	}
833
	
833
	
834
	/**
834
	/**
835
	 * Test #33
835
	 * Test #33
836
	 */
836
	 */
837
	private function testerEpitheteSpSyntaxe() {
837
	private function testerEpitheteSpSyntaxe() {
838
		$noms_erreur = array();
838
		$noms_erreur = array();
839
		foreach ($this->noms as &$nom) {
839
		foreach ($this->noms as &$nom) {
840
			if ($nom['epithete_sp'] != '') {
840
			if ($nom['epithete_sp'] != '') {
841
				$formule_hybridite = (strpos($nom['epithete_sp'], ' x ') !== false);
841
				$formule_hybridite = (strpos($nom['epithete_sp'], ' x ') !== false);
842
				$mots = explode(' ', $nom['epithete_sp']);
842
				$mots = explode(' ', $nom['epithete_sp']);
843
				foreach ($mots as $mot) {
843
				foreach ($mots as $mot) {
844
					// TODO: créer un test qui vérifie la formule d'hybridité en la reconstruisant à partir des parents
844
					// TODO: créer un test qui vérifie la formule d'hybridité en la reconstruisant à partir des parents
845
					// afin que seuls des formules valides parviennent à la fonction
845
					// afin que seuls des formules valides parviennent à la fonction
846
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteSp($mot) ||
846
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteSp($mot) ||
847
						($formule_hybridite && $this->verifierEpitheteGenre($mot) && !$this->verifierEstAbbreviationInfraSp($mot)))) {
847
						($formule_hybridite && $this->verifierEpitheteGenre($mot) && !$this->verifierEstAbbreviationInfraSp($mot)))) {
848
						$epithete_traite = $this->repererEspace($nom['epithete_sp']);
848
						$epithete_traite = $this->repererEspace($nom['epithete_sp']);
849
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
849
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
850
						break;
850
						break;
851
					}
851
					}
852
				}
852
				}
853
			}
853
			}
854
		}
854
		}
855
		return $noms_erreur;
855
		return $noms_erreur;
856
	}
856
	}
857
	
857
	
858
	/**
858
	/**
859
	 * Test #34
859
	 * Test #34
860
	 */
860
	 */
861
	private function testerEpitheteSpRang() {
861
	private function testerEpitheteSpRang() {
862
		$noms_erreur = array();
862
		$noms_erreur = array();
863
		foreach ($this->noms as &$nom) {
863
		foreach ($this->noms as &$nom) {
864
			if ($nom['epithete_sp'] != '') {
864
			if ($nom['epithete_sp'] != '') {
865
				if ($nom['rang'] < $this->manuel['rang_sp']) {
865
				if ($nom['rang'] < $this->manuel['rang_sp']) {
866
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
866
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
867
				}
867
				}
868
			}
868
			}
869
		}
869
		}
870
		return $noms_erreur;
870
		return $noms_erreur;
871
	}
871
	}
872
	
872
	
873
	/**
873
	/**
874
	 * Test #35
874
	 * Test #35
875
	 */
875
	 */
876
	private function testerTypeEpitheteEspaces() {
876
	private function testerTypeEpitheteEspaces() {
877
		$noms_erreur = array();
877
		$noms_erreur = array();
878
		foreach ($this->noms as &$nom) {
878
		foreach ($this->noms as &$nom) {
879
			if ($nom['type_epithete'] != '') {
879
			if ($nom['type_epithete'] != '') {
880
				if (preg_match('/\s+/', $nom['type_epithete'])) {
880
				if (preg_match('/\s+/', $nom['type_epithete'])) {
881
					$valeur_traitee = $this->repererEspace($nom['epithete_sp']);
881
					$valeur_traitee = $this->repererEspace($nom['epithete_sp']);
882
					$noms_erreur[] = array($nom['num_nom'], $valeur_traitee, $nom['exclure_taxref']);
882
					$noms_erreur[] = array($nom['num_nom'], $valeur_traitee, $nom['exclure_taxref']);
883
				}
883
				}
884
			}
884
			}
885
		}
885
		}
886
		return $noms_erreur;
886
		return $noms_erreur;
887
	}
887
	}
888
	
888
	
889
	/**
889
	/**
890
	 * Test #36
890
	 * Test #36
891
	 */
891
	 */
892
	private function testerTypeEpitheteSyntaxe() {
892
	private function testerTypeEpitheteSyntaxe() {
893
		$noms_erreur = array();
893
		$noms_erreur = array();
894
		foreach ($this->noms as &$nom) {
894
		foreach ($this->noms as &$nom) {
895
			if ($nom['type_epithete'] != '') {
895
			if ($nom['type_epithete'] != '') {
896
				if (!$this->verifierTypeEpithete($nom['type_epithete'])) {
896
				if (!$this->verifierTypeEpithete($nom['type_epithete'])) {
897
					$noms_erreur[] = array($nom['num_nom'],  $nom['type_epithete'], $nom['exclure_taxref']);
897
					$noms_erreur[] = array($nom['num_nom'],  $nom['type_epithete'], $nom['exclure_taxref']);
898
				}
898
				}
899
			}
899
			}
900
		}
900
		}
901
		return $noms_erreur;
901
		return $noms_erreur;
902
	}
902
	}
903
	
903
	
904
	/**
904
	/**
905
	 * Test #37
905
	 * Test #37
906
	 */
906
	 */
907
	private function testerTypeEpitheteHybridite() {
907
	private function testerTypeEpitheteHybridite() {
908
		$noms_erreur = array();
908
		$noms_erreur = array();
909
		foreach ($this->noms as &$nom) {
909
		foreach ($this->noms as &$nom) {
910
			if ($nom['type_epithete'] != '') {
910
			if ($nom['type_epithete'] != '') {
911
				if (preg_match('/^(?:n-|notho-)/', $nom['type_epithete'])) {
911
				if (preg_match('/^(?:n-|notho-)/', $nom['type_epithete'])) {
912
					$noms_erreur[] = array($nom['num_nom'], $nom['type_epithete'], $nom['exclure_taxref']);
912
					$noms_erreur[] = array($nom['num_nom'], $nom['type_epithete'], $nom['exclure_taxref']);
913
				}
913
				}
914
			}
914
			}
915
		}
915
		}
916
		return $noms_erreur;
916
		return $noms_erreur;
917
	}
917
	}
918
	
918
	
919
	/**
919
	/**
920
	 * Test #38
920
	 * Test #38
921
	 */
921
	 */
922
	private function testerEpitheteInfraSpEspaces() {
922
	private function testerEpitheteInfraSpEspaces() {
923
		$noms_erreur = array();
923
		$noms_erreur = array();
924
		foreach ($this->noms as &$nom) {
924
		foreach ($this->noms as &$nom) {
925
			if ($nom['epithete_infra_sp'] != '') {
925
			if ($nom['epithete_infra_sp'] != '') {
926
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_sp'])) {
926
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_sp'])) {
927
					$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
927
					$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
928
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
928
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
929
				}
929
				}
930
			}
930
			}
931
		}
931
		}
932
		return $noms_erreur;
932
		return $noms_erreur;
933
	}
933
	}
934
	
934
	
935
	/**
935
	/**
936
	 * Test #39
936
	 * Test #39
937
	 */
937
	 */
938
	private function testerEpitheteInfraSpSyntaxe() {
938
	private function testerEpitheteInfraSpSyntaxe() {
939
		$noms_erreur = array();
939
		$noms_erreur = array();
940
		foreach ($this->noms as &$nom) {
940
		foreach ($this->noms as &$nom) {
941
			if ($nom['epithete_infra_sp'] != '') {
941
			if ($nom['epithete_infra_sp'] != '') {
942
				$mots = explode(' ', $nom['epithete_infra_sp']);
942
				$mots = explode(' ', $nom['epithete_infra_sp']);
943
				$hybride_contient_abbreviation_infra_sp = false;
943
				$hybride_contient_abbreviation_infra_sp = false;
944
				$formule_hybridite = (strpos($nom['epithete_infra_sp'], ' x ') !== false);				
944
				$formule_hybridite = (strpos($nom['epithete_infra_sp'], ' x ') !== false);				
945
				foreach ($mots as $mot) {
945
				foreach ($mots as $mot) {
946
					if($formule_hybridite && $this->verifierEstAbbreviationInfraSp($mot)) {
946
					if($formule_hybridite && $this->verifierEstAbbreviationInfraSp($mot)) {
947
						$hybride_contient_abbreviation_infra_sp = true;
947
						$hybride_contient_abbreviation_infra_sp = true;
948
					}
948
					}
949
					$formule_hybridite_valide = $this->verifierEpitheteGenre($mot) || $this->verifierEpitheteSp($mot) || $hybride_contient_abbreviation_infra_sp;
949
					$formule_hybridite_valide = $this->verifierEpitheteGenre($mot) || $this->verifierEpitheteSp($mot) || $hybride_contient_abbreviation_infra_sp;
950
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierTypeEpithete($mot) || $this->verifierEpitheteSp($mot) ||
950
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierTypeEpithete($mot) || $this->verifierEpitheteSp($mot) ||
951
						$formule_hybridite_valide)) {
951
						$formule_hybridite_valide)) {
952
						$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
952
						$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
953
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
953
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
954
						break;
954
						break;
955
					}
955
					}
956
				}
956
				}
957
				
957
				
958
				if($formule_hybridite && !$hybride_contient_abbreviation_infra_sp) {
958
				if($formule_hybridite && !$hybride_contient_abbreviation_infra_sp) {
959
					$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
959
					$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
960
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
960
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
961
				}
961
				}
962
			}
962
			}
963
		}
963
		}
964
		return $noms_erreur;
964
		return $noms_erreur;
965
	}
965
	}
966
	
966
	
967
	/**
967
	/**
968
	 * Test #40
968
	 * Test #40
969
	 */
969
	 */
970
	private function testerEpitheteInfraSpRang() {
970
	private function testerEpitheteInfraSpRang() {
971
		$noms_erreur = array();
971
		$noms_erreur = array();
972
		foreach ($this->noms as &$nom) {
972
		foreach ($this->noms as &$nom) {
973
			if ($nom['epithete_infra_sp'] != '') {
973
			if ($nom['epithete_infra_sp'] != '') {
974
				if ($nom['rang'] < $this->manuel['rang_sp']) {
974
				if ($nom['rang'] < $this->manuel['rang_sp']) {
975
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
975
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
976
				}
976
				}
977
			}
977
			}
978
		}
978
		}
979
		return $noms_erreur;
979
		return $noms_erreur;
980
	}
980
	}
981
	
981
	
982
	/**
982
	/**
983
	 * Test #41
983
	 * Test #41
984
	 */
984
	 */
985
	private function testerGroupeCultivarSyntaxe() {
985
	private function testerGroupeCultivarSyntaxe() {
986
		$noms_erreur = array();
986
		$noms_erreur = array();
987
		foreach ($this->noms as &$nom) {
987
		foreach ($this->noms as &$nom) {
988
			if ($nom['cultivar_groupe'] != '') {
988
			if ($nom['cultivar_groupe'] != '') {
989
				if (!$this->verifierEpitheteGroupeCultivar($nom['cultivar_groupe'])) {
989
				if (!$this->verifierEpitheteGroupeCultivar($nom['cultivar_groupe'])) {
990
					$epithete_traite = $this->repererEspace($nom['cultivar_groupe']);
990
					$epithete_traite = $this->repererEspace($nom['cultivar_groupe']);
991
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
991
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
992
				}
992
				}
993
			}
993
			}
994
		}
994
		}
995
		return $noms_erreur;
995
		return $noms_erreur;
996
	}
996
	}
997
	
997
	
998
	/**
998
	/**
999
	 * Test #42
999
	 * Test #42
1000
	 */
1000
	 */
1001
	private function testerGroupeCultivarRang() {
1001
	private function testerGroupeCultivarRang() {
1002
		$noms_erreur = array();
1002
		$noms_erreur = array();
1003
		foreach ($this->noms as &$nom) {
1003
		foreach ($this->noms as &$nom) {
1004
			if ($nom['cultivar_groupe'] != '') {
1004
			if ($nom['cultivar_groupe'] != '') {
1005
				if ($nom['rang'] < $this->manuel['rang_genre']) {
1005
				if ($nom['rang'] < $this->manuel['rang_genre']) {
1006
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
1006
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
1007
				}
1007
				}
1008
			}
1008
			}
1009
		}
1009
		}
1010
		return $noms_erreur;
1010
		return $noms_erreur;
1011
	}
1011
	}
1012
	
1012
	
1013
	/**
1013
	/**
1014
	 * Test #43
1014
	 * Test #43
1015
	 */
1015
	 */
1016
	private function testerCultivarSyntaxe() {
1016
	private function testerCultivarSyntaxe() {
1017
		$noms_erreur = array();
1017
		$noms_erreur = array();
1018
		foreach ($this->noms as &$nom) {
1018
		foreach ($this->noms as &$nom) {
1019
			if ($nom['cultivar'] != '') {
1019
			if ($nom['cultivar'] != '') {
1020
				if (!$this->verifierEpitheteCultivar($nom['cultivar'])) {
1020
				if (!$this->verifierEpitheteCultivar($nom['cultivar'])) {
1021
					$epithete_traite = $this->repererEspace($nom['cultivar']);
1021
					$epithete_traite = $this->repererEspace($nom['cultivar']);
1022
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1022
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1023
				}
1023
				}
1024
			}
1024
			}
1025
		}
1025
		}
1026
		return $noms_erreur;
1026
		return $noms_erreur;
1027
	}
1027
	}
1028
	
1028
	
1029
	/**
1029
	/**
1030
	 * Test #44
1030
	 * Test #44
1031
	 */
1031
	 */
1032
	private function testerCultivarRang() {
1032
	private function testerCultivarRang() {
1033
		$noms_erreur = array();
1033
		$noms_erreur = array();
1034
		foreach ($this->noms as &$nom) {
1034
		foreach ($this->noms as &$nom) {
1035
			if ($nom['cultivar'] != '') {
1035
			if ($nom['cultivar'] != '') {
1036
				if ($nom['rang'] < $this->manuel['rang_genre']) {
1036
				if ($nom['rang'] < $this->manuel['rang_genre']) {
1037
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
1037
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
1038
				}
1038
				}
1039
			}
1039
			}
1040
		}
1040
		}
1041
		return $noms_erreur;
1041
		return $noms_erreur;
1042
	}
1042
	}
1043
	
1043
	
1044
	/**
1044
	/**
1045
	 * Test #45
1045
	 * Test #45
1046
	 */
1046
	 */
1047
	private function testerNomCommercialSyntaxe() {
1047
	private function testerNomCommercialSyntaxe() {
1048
		$noms_erreur = array();
1048
		$noms_erreur = array();
1049
		foreach ($this->noms as &$nom) {
1049
		foreach ($this->noms as &$nom) {
1050
			if ($nom['nom_commercial'] != '') {
1050
			if ($nom['nom_commercial'] != '') {
1051
				if (!$this->verifierNomCommercial($nom['nom_commercial'])) {
1051
				if (!$this->verifierNomCommercial($nom['nom_commercial'])) {
1052
					$epithete_traite = $this->repererEspace($nom['nom_commercial']);
1052
					$epithete_traite = $this->repererEspace($nom['nom_commercial']);
1053
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1053
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1054
				}
1054
				}
1055
			}
1055
			}
1056
		}
1056
		}
1057
		return $noms_erreur;
1057
		return $noms_erreur;
1058
	}
1058
	}
1059
	
1059
	
1060
	/**
1060
	/**
1061
	 * Test #46
1061
	 * Test #46
1062
	 */
1062
	 */
1063
	private function testerNomCommercialPresenceCultivar() {
1063
	private function testerNomCommercialPresenceCultivar() {
1064
		$noms_erreur = array();
1064
		$noms_erreur = array();
1065
		foreach ($this->noms as &$nom) {
1065
		foreach ($this->noms as &$nom) {
1066
			if ((isset($nom['nom_commercial']) && $nom['nom_commercial'] != '') && ($nom['cultivar'] == '' && $nom['cultivar_groupe'] == '')) {
1066
			if ((isset($nom['nom_commercial']) && $nom['nom_commercial'] != '') && ($nom['cultivar'] == '' && $nom['cultivar_groupe'] == '')) {
1067
				$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1067
				$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1068
			}
1068
			}
1069
		}
1069
		}
1070
		return $noms_erreur;
1070
		return $noms_erreur;
1071
	}
1071
	}
1072
	
1072
	
1073
	/**
1073
	/**
1074
	 * Test #47
1074
	 * Test #47
1075
	 */
1075
	 */
1076
	private function testerAuteurSyntaxe() {
1076
	private function testerAuteurSyntaxe() {
1077
		$noms_erreur = array();
1077
		$noms_erreur = array();
1078
		foreach ($this->noms as &$nom) {
1078
		foreach ($this->noms as &$nom) {
1079
			if ($nom['auteur'] != '') {
1079
			if ($nom['auteur'] != '') {
1080
				if (!$this->verifierAuteur($nom['auteur'])) {
1080
				if (!$this->verifierAuteur($nom['auteur'])) {
1081
					$intitule_traite = $this->repererEspace($nom['auteur']);
1081
					$intitule_traite = $this->repererEspace($nom['auteur']);
1082
					$noms_erreur[] = array($nom['num_nom'], $intitule_traite, $nom['exclure_taxref']);
1082
					$noms_erreur[] = array($nom['num_nom'], $intitule_traite, $nom['exclure_taxref']);
1083
				}
1083
				}
1084
			}
1084
			}
1085
		}
1085
		}
1086
		return $noms_erreur;
1086
		return $noms_erreur;
1087
	}
1087
	}
1088
	
1088
	
1089
	/**
1089
	/**
1090
	 * Test #48
1090
	 * Test #48
1091
	 */
1091
	 */
1092
	private function testerAnneeSyntaxe() {
1092
	private function testerAnneeSyntaxe() {
1093
		$noms_erreur = array();
1093
		$noms_erreur = array();
1094
		foreach ($this->noms as &$nom) {
1094
		foreach ($this->noms as &$nom) {
1095
			if ($nom['annee'] != '') {
1095
			if ($nom['annee'] != '') {
1096
				if (!$this->verifierAnnee($nom['annee'])) {
1096
				if (!$this->verifierAnnee($nom['annee'])) {
1097
					$noms_erreur[] = array($nom['num_nom'], $nom['annee'], $nom['exclure_taxref']);
1097
					$noms_erreur[] = array($nom['num_nom'], $nom['annee'], $nom['exclure_taxref']);
1098
				}
1098
				}
1099
			}
1099
			}
1100
		}
1100
		}
1101
		return $noms_erreur;
1101
		return $noms_erreur;
1102
	}
1102
	}
1103
	
1103
	
1104
	/**
1104
	/**
1105
	 * Test #49
1105
	 * Test #49
1106
	 */
1106
	 */
1107
	private function testerBiblioOrigineSyntaxe() {
1107
	private function testerBiblioOrigineSyntaxe() {
1108
		$noms_erreur = array();
1108
		$noms_erreur = array();
1109
		foreach ($this->noms as &$nom) {
1109
		foreach ($this->noms as &$nom) {
1110
			if ($nom['biblio_origine'] != '') {
1110
			if ($nom['biblio_origine'] != '') {
1111
				if (!$this->verifierBiblioOrigine($nom['biblio_origine'])) {
1111
				if (!$this->verifierBiblioOrigine($nom['biblio_origine'])) {
1112
					$biblio_traite = $this->repererEspace($nom['biblio_origine']);
1112
					$biblio_traite = $this->repererEspace($nom['biblio_origine']);
1113
					$noms_erreur[] = array($nom['num_nom'], $biblio_traite, $nom['exclure_taxref']);
1113
					$noms_erreur[] = array($nom['num_nom'], $biblio_traite, $nom['exclure_taxref']);
1114
				}
1114
				}
1115
			}
1115
			}
1116
		}
1116
		}
1117
		return $noms_erreur;
1117
		return $noms_erreur;
1118
	}
1118
	}
1119
	
1119
	
1120
	/**
1120
	/**
1121
	 * Test #50
1121
	 * Test #50
1122
	 */
1122
	 */
1123
	private function testerHomonymieSyntaxe() {
1123
	private function testerHomonymieSyntaxe() {
1124
		$noms_erreur = array();
1124
		$noms_erreur = array();
1125
		foreach ($this->noms as &$nom) {
1125
		foreach ($this->noms as &$nom) {
1126
			if ($nom['homonyme'] != '') {
1126
			if ($nom['homonyme'] != '') {
1127
				if (!$this->verifierBooleen($nom['homonyme'])) {
1127
				if (!$this->verifierBooleen($nom['homonyme'])) {
1128
					$noms_erreur[] = array($nom['num_nom'], $nom['homonyme'], $nom['exclure_taxref']);
1128
					$noms_erreur[] = array($nom['num_nom'], $nom['homonyme'], $nom['exclure_taxref']);
1129
				}
1129
				}
1130
			}
1130
			}
1131
		}
1131
		}
1132
		return $noms_erreur;
1132
		return $noms_erreur;
1133
	}
1133
	}
1134
	
1134
	
1135
	/**
1135
	/**
1136
	 * Test #51
1136
	 * Test #51
1137
	 */
1137
	 */
1138
	private function testerHomonymieExistence() {
1138
	private function testerHomonymieExistence() {
1139
		$noms_homonymie = $this->classerNomsParNomComplet();
1139
		$noms_homonymie = $this->classerNomsParNomComplet();
1140
		
1140
		
1141
		$noms_erreur = array();
1141
		$noms_erreur = array();
1142
		foreach ($this->noms as &$nom) {
1142
		foreach ($this->noms as &$nom) {
1143
			if ($nom['homonyme'] != '0' && $nom['homonyme'] != '') {
1143
			if ($nom['homonyme'] != '0' && $nom['homonyme'] != '') {
1144
				if ($noms_homonymie[$nom['nom_sci']] <= 1) {
1144
				if ($noms_homonymie[$nom['nom_sci']] <= 1) {
1145
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1145
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1146
				}
1146
				}
1147
			}
1147
			}
1148
		}
1148
		}
1149
		$noms_homonymie = null;
1149
		$noms_homonymie = null;
1150
		return $noms_erreur;
1150
		return $noms_erreur;
1151
	}
1151
	}
1152
	
1152
	
1153
	/**
1153
	/**
1154
	 * Test #52
1154
	 * Test #52
1155
	 */
1155
	 */
1156
	private function testerBasionymeSyntaxe() {
1156
	private function testerBasionymeSyntaxe() {
1157
		$noms_erreur = array();
1157
		$noms_erreur = array();
1158
		foreach ($this->noms as &$nom) {
1158
		foreach ($this->noms as &$nom) {
1159
			if ($nom['basionyme'] != '') {
1159
			if ($nom['basionyme'] != '') {
1160
				if (!$this->verifierNombre($nom['basionyme'])) {
1160
				if (!$this->verifierNombre($nom['basionyme'])) {
1161
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1161
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1162
				}
1162
				}
1163
			}
1163
			}
1164
		}
1164
		}
1165
		return $noms_erreur;
1165
		return $noms_erreur;
1166
	}
1166
	}
1167
 
1167
 
1168
	/**
1168
	/**
1169
	 * Test #53
1169
	 * Test #53
1170
	 */
1170
	 */
1171
	private function testerBasionymeExistence() {
1171
	private function testerBasionymeExistence() {
1172
		$noms_erreur = array();
1172
		$noms_erreur = array();
1173
		foreach ($this->noms as &$nom) {
1173
		foreach ($this->noms as &$nom) {
1174
			if ($nom['basionyme'] != '') {
1174
			if ($nom['basionyme'] != '') {
1175
				if (!isset($this->noms[$nom['basionyme']])) {
1175
				if (!isset($this->noms[$nom['basionyme']])) {
1176
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1176
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1177
				}
1177
				}
1178
			}
1178
			}
1179
		}
1179
		}
1180
		return $noms_erreur;
1180
		return $noms_erreur;
1181
	}
1181
	}
1182
	
1182
	
1183
	/**
1183
	/**
1184
	 * Test #54
1184
	 * Test #54
1185
	 */
1185
	 */
1186
	private function testerSynonymeProparteSyntaxe() {
1186
	private function testerSynonymeProparteSyntaxe() {
1187
		$noms_erreur = array();
1187
		$noms_erreur = array();
1188
		foreach ($this->noms as &$nom) {
1188
		foreach ($this->noms as &$nom) {
1189
			if ($nom['synonyme_proparte'] != '') {
1189
			if ($nom['synonyme_proparte'] != '') {
1190
				if (!$this->verifierNombreSuite($nom['synonyme_proparte'])) {
1190
				if (!$this->verifierNombreSuite($nom['synonyme_proparte'])) {
1191
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_proparte'], $nom['exclure_taxref']);
1191
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_proparte'], $nom['exclure_taxref']);
1192
				}
1192
				}
1193
			}
1193
			}
1194
		}
1194
		}
1195
		return $noms_erreur;
1195
		return $noms_erreur;
1196
	}
1196
	}
1197
	
1197
	
1198
	/**
1198
	/**
1199
	 * Test #55
1199
	 * Test #55
1200
	 */
1200
	 */
1201
	private function testerSynonymeProparteExistence() {
1201
	private function testerSynonymeProparteExistence() {
1202
		$noms_erreur = array();
1202
		$noms_erreur = array();
1203
		foreach ($this->noms as &$nom) {
1203
		foreach ($this->noms as &$nom) {
1204
			if ($nom['synonyme_proparte'] != '') {
1204
			if ($nom['synonyme_proparte'] != '') {
1205
				$num_nom_a_verifier = explode(',', $nom['synonyme_proparte']);
1205
				$num_nom_a_verifier = explode(',', $nom['synonyme_proparte']);
1206
				$num_nom_en_erreur = array();
1206
				$num_nom_en_erreur = array();
1207
				foreach ($num_nom_a_verifier as $num_nom) {
1207
				foreach ($num_nom_a_verifier as $num_nom) {
1208
					if (!isset($this->noms[$num_nom])) {
1208
					if (!isset($this->noms[$num_nom])) {
1209
						$num_nom_en_erreur[] = $num_nom;
1209
						$num_nom_en_erreur[] = $num_nom;
1210
					}
1210
					}
1211
				}
1211
				}
1212
				if (count($nbre_en_erreur) > 0) {
1212
				if (count($nbre_en_erreur) > 0) {
1213
					$noms_erreur[] = array($nom['num_nom'], implode(',', $num_nom_en_erreur), $nom['exclure_taxref']);
1213
					$noms_erreur[] = array($nom['num_nom'], implode(',', $num_nom_en_erreur), $nom['exclure_taxref']);
1214
				}
1214
				}
1215
			}
1215
			}
1216
		}
1216
		}
1217
		return $noms_erreur;
1217
		return $noms_erreur;
1218
	}
1218
	}
1219
	
1219
	
1220
	/**
1220
	/**
1221
	 * Test #56
1221
	 * Test #56
1222
	 */
1222
	 */
1223
	private function testerSynonymeDouteuxSyntaxe() {
1223
	private function testerSynonymeDouteuxSyntaxe() {
1224
		$noms_erreur = array();
1224
		$noms_erreur = array();
1225
		foreach ($this->noms as &$nom) {
1225
		foreach ($this->noms as &$nom) {
1226
			if ($nom['synonyme_douteux'] != '') {
1226
			if ($nom['synonyme_douteux'] != '') {
1227
				if (!$this->verifierBooleen($nom['synonyme_douteux'])) {
1227
				if (!$this->verifierBooleen($nom['synonyme_douteux'])) {
1228
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1228
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1229
				}
1229
				}
1230
			}
1230
			}
1231
		}
1231
		}
1232
		return $noms_erreur;		
1232
		return $noms_erreur;		
1233
	}
1233
	}
1234
	
1234
	
1235
	/**
1235
	/**
1236
	 * Test #57
1236
	 * Test #57
1237
	 */
1237
	 */
1238
	private function testerSynonymeDouteuxNumNomRetenu() {
1238
	private function testerSynonymeDouteuxNumNomRetenu() {
1239
		$noms_erreur = array();
1239
		$noms_erreur = array();
1240
		foreach ($this->noms as &$nom) {
1240
		foreach ($this->noms as &$nom) {
1241
			if ($nom['synonyme_douteux'] == 1 && !$this->verifierNombre($nom['num_nom_retenu'])) {
1241
			if ($nom['synonyme_douteux'] == 1 && !$this->verifierNombre($nom['num_nom_retenu'])) {
1242
				$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1242
				$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1243
			}
1243
			}
1244
		}
1244
		}
1245
		return $noms_erreur;
1245
		return $noms_erreur;
1246
	}
1246
	}
1247
	
1247
	
1248
	/**
1248
	/**
1249
	 * Test #58
1249
	 * Test #58
1250
	 */
1250
	 */
1251
	private function testerSynonymeMalAppliqueSyntaxe() {
1251
	private function testerSynonymeMalAppliqueSyntaxe() {
1252
		$noms_erreur = array();
1252
		$noms_erreur = array();
1253
		foreach ($this->noms as &$nom) {
1253
		foreach ($this->noms as &$nom) {
1254
			if ($nom['synonyme_mal_applique'] != '') {
1254
			if ($nom['synonyme_mal_applique'] != '') {
1255
				if (!$this->verifierBooleen($nom['synonyme_mal_applique'])) {
1255
				if (!$this->verifierBooleen($nom['synonyme_mal_applique'])) {
1256
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_mal_applique'], $nom['exclure_taxref']);
1256
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_mal_applique'], $nom['exclure_taxref']);
1257
				}
1257
				}
1258
			}
1258
			}
1259
		}
1259
		}
1260
		return $noms_erreur;
1260
		return $noms_erreur;
1261
	}
1261
	}
1262
	
1262
	
1263
	/**
1263
	/**
1264
	 * Test #59
1264
	 * Test #59
1265
	 */
1265
	 */
1266
	private function testerSynonymeOrthographiqueSyntaxe() {
1266
	private function testerSynonymeOrthographiqueSyntaxe() {
1267
		$noms_erreur = array();
1267
		$noms_erreur = array();
1268
		foreach ($this->noms as $nom) {
1268
		foreach ($this->noms as $nom) {
1269
			if ($nom['synonyme_orthographique'] != '') {
1269
			if ($nom['synonyme_orthographique'] != '') {
1270
				if (!$this->verifierNombre($nom['synonyme_orthographique'])) {
1270
				if (!$this->verifierNombre($nom['synonyme_orthographique'])) {
1271
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1271
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1272
				}
1272
				}
1273
			}
1273
			}
1274
		}
1274
		}
1275
		return $noms_erreur;
1275
		return $noms_erreur;
1276
	}
1276
	}
1277
	
1277
	
1278
	/**
1278
	/**
1279
	 * Test #60
1279
	 * Test #60
1280
	 */
1280
	 */
1281
	private function testerSynonymeOrthographiqueExistence() {
1281
	private function testerSynonymeOrthographiqueExistence() {
1282
		$noms_erreur = array();
1282
		$noms_erreur = array();
1283
		foreach ($this->noms as &$nom) {
1283
		foreach ($this->noms as &$nom) {
1284
			if ($nom['synonyme_orthographique'] != '') {
1284
			if ($nom['synonyme_orthographique'] != '') {
1285
				if (!isset($this->noms[$nom['synonyme_orthographique']])) {
1285
				if (!isset($this->noms[$nom['synonyme_orthographique']])) {
1286
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1286
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1287
				}
1287
				}
1288
			}
1288
			}
1289
		}
1289
		}
1290
		return $noms_erreur;
1290
		return $noms_erreur;
1291
	}
1291
	}
1292
	
1292
	
1293
	/**
1293
	/**
1294
	 * Test #61
1294
	 * Test #61
1295
	 */
1295
	 */
1296
	private function testerHybrideParent01Syntaxe() {
1296
	private function testerHybrideParent01Syntaxe() {
1297
		$noms_erreur = array();
1297
		$noms_erreur = array();
1298
		foreach ($this->noms as &$nom) {
1298
		foreach ($this->noms as &$nom) {
1299
			if ($nom['hybride_parent_01'] != '') {
1299
			if ($nom['hybride_parent_01'] != '') {
1300
				if (!$this->verifierNombre($nom['hybride_parent_01'])) {
1300
				if (!$this->verifierNombre($nom['hybride_parent_01'])) {
1301
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1301
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1302
				}
1302
				}
1303
			}
1303
			}
1304
		}
1304
		}
1305
		return $noms_erreur;
1305
		return $noms_erreur;
1306
	}
1306
	}
1307
	
1307
	
1308
	/**
1308
	/**
1309
	 * Test #62
1309
	 * Test #62
1310
	 */
1310
	 */
1311
	private function testerHybrideParent01Existence() {
1311
	private function testerHybrideParent01Existence() {
1312
		$noms_erreur = array();
1312
		$noms_erreur = array();
1313
		foreach ($this->noms as &$nom) {
1313
		foreach ($this->noms as &$nom) {
1314
			if ($nom['hybride_parent_01'] != '' && $nom['hybride_parent_01'] != '0') {
1314
			if ($nom['hybride_parent_01'] != '' && $nom['hybride_parent_01'] != '0') {
1315
				if (!isset($this->noms[$nom['hybride_parent_01']])) {
1315
				if (!isset($this->noms[$nom['hybride_parent_01']])) {
1316
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1316
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1317
				}
1317
				}
1318
			}
1318
			}
1319
		}
1319
		}
1320
		return $noms_erreur;
1320
		return $noms_erreur;
1321
	}
1321
	}
1322
	
1322
	
1323
	/**
1323
	/**
1324
	 * Test #63
1324
	 * Test #63
1325
	 */
1325
	 */
1326
	private function testerHybrideParent02Syntaxe() {
1326
	private function testerHybrideParent02Syntaxe() {
1327
		$noms_erreur = array();
1327
		$noms_erreur = array();
1328
		foreach ($this->noms as &$nom) {
1328
		foreach ($this->noms as &$nom) {
1329
			if ($nom['hybride_parent_02'] != '') {
1329
			if ($nom['hybride_parent_02'] != '') {
1330
				if (!$this->verifierNombre($nom['hybride_parent_02'])) {
1330
				if (!$this->verifierNombre($nom['hybride_parent_02'])) {
1331
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1331
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1332
				}
1332
				}
1333
			}
1333
			}
1334
		}
1334
		}
1335
		return $noms_erreur;
1335
		return $noms_erreur;
1336
	}
1336
	}
1337
	
1337
	
1338
	/**
1338
	/**
1339
	 * Test #64
1339
	 * Test #64
1340
	 */
1340
	 */
1341
	private function testerHybrideParent02Existence() {
1341
	private function testerHybrideParent02Existence() {
1342
		$noms_erreur = array();
1342
		$noms_erreur = array();
1343
		foreach ($this->noms as &$nom) {
1343
		foreach ($this->noms as &$nom) {
1344
			if ($nom['hybride_parent_02'] != '') {
1344
			if ($nom['hybride_parent_02'] != '') {
1345
				if (!isset($this->noms[$nom['hybride_parent_02']]) && $nom['hybride_parent_02'] != '0') {
1345
				if (!isset($this->noms[$nom['hybride_parent_02']]) && $nom['hybride_parent_02'] != '0') {
1346
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1346
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1347
				}
1347
				}
1348
			}
1348
			}
1349
		}
1349
		}
1350
		return $noms_erreur;
1350
		return $noms_erreur;
1351
	}
1351
	}
1352
	
1352
	
1353
	/**
1353
	/**
1354
	 * Test #65
1354
	 * Test #65
1355
	 */
1355
	 */
1356
	private function testerPresenceSyntaxe() {
1356
	private function testerPresenceSyntaxe() {
1357
		$noms_erreur = array();
1357
		$noms_erreur = array();
1358
		foreach ($this->noms as &$nom) {
1358
		foreach ($this->noms as &$nom) {
1359
			if ($nom['presence'] != '') {
1359
			if ($nom['presence'] != '') {
1360
				if (!$this->verifierPresence($nom['presence'])) {
1360
				if (!$this->verifierPresence($nom['presence'])) {
1361
					$noms_erreur[] = array($nom['num_nom'], $nom['presence'], $nom['exclure_taxref']);
1361
					$noms_erreur[] = array($nom['num_nom'], $nom['presence'], $nom['exclure_taxref']);
1362
				}
1362
				}
1363
			}
1363
			}
1364
		}
1364
		}
1365
		return $noms_erreur;
1365
		return $noms_erreur;
1366
	}
1366
	}
1367
	
1367
	
1368
	/**
1368
	/**
1369
	 * Test #66
1369
	 * Test #66
1370
	 */
1370
	 */
1371
	private function testerStatutOrigineSyntaxe() {
1371
	private function testerStatutOrigineSyntaxe() {
1372
		$noms_erreur = array();
1372
		$noms_erreur = array();
1373
		foreach ($this->noms as &$nom) {
1373
		foreach ($this->noms as &$nom) {
1374
			if ($nom['statut_origine'] != '') {
1374
			if ($nom['statut_origine'] != '') {
1375
				if (!$this->verifierStatutOrigine($nom['statut_origine'])) {
1375
				if (!$this->verifierStatutOrigine($nom['statut_origine'])) {
1376
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_origine'], $nom['exclure_taxref']);
1376
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_origine'], $nom['exclure_taxref']);
1377
				}
1377
				}
1378
			}
1378
			}
1379
		}
1379
		}
1380
		return $noms_erreur;
1380
		return $noms_erreur;
1381
	}
1381
	}
1382
	
1382
	
1383
	/**
1383
	/**
1384
	 * Test #67
1384
	 * Test #67
1385
	 */
1385
	 */
1386
	private function testerStatutIntroductionSyntaxe() {
1386
	private function testerStatutIntroductionSyntaxe() {
1387
		$noms_erreur = array();
1387
		$noms_erreur = array();
1388
		foreach ($this->noms as &$nom) {
1388
		foreach ($this->noms as &$nom) {
1389
			if ($nom['statut_introduction'] != '') {
1389
			if ($nom['statut_introduction'] != '') {
1390
				if (!$this->verifierStatutIntroduction($nom['statut_introduction'])) {
1390
				if (!$this->verifierStatutIntroduction($nom['statut_introduction'])) {
1391
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_introduction'], $nom['exclure_taxref']);
1391
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_introduction'], $nom['exclure_taxref']);
1392
				}
1392
				}
1393
			}
1393
			}
1394
		}
1394
		}
1395
		return $noms_erreur;
1395
		return $noms_erreur;
1396
	}
1396
	}
1397
	
1397
	
1398
	/**
1398
	/**
1399
	 * Test #68
1399
	 * Test #68
1400
	 */
1400
	 */
1401
	private function testerStatutCultureSyntaxe() {
1401
	private function testerStatutCultureSyntaxe() {
1402
		$noms_erreur = array();
1402
		$noms_erreur = array();
1403
		foreach ($this->noms as &$nom) {
1403
		foreach ($this->noms as &$nom) {
1404
			if ($nom['statut_culture'] != '') {
1404
			if ($nom['statut_culture'] != '') {
1405
				if (!$this->verifierStatutCulture($nom['statut_culture'])) {
1405
				if (!$this->verifierStatutCulture($nom['statut_culture'])) {
1406
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_culture'], $nom['exclure_taxref']);
1406
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_culture'], $nom['exclure_taxref']);
1407
				}
1407
				}
1408
			}
1408
			}
1409
		}
1409
		}
1410
		return $noms_erreur;
1410
		return $noms_erreur;
1411
	}
1411
	}
1412
	
1412
	
1413
	/**
1413
	/**
1414
	 * Test #69
1414
	 * Test #69
1415
	 */
1415
	 */
1416
	private function testerExclureTaxRefSyntaxe() {
1416
	private function testerExclureTaxRefSyntaxe() {
1417
		$noms_erreur = array();
1417
		$noms_erreur = array();
1418
		foreach ($this->noms as &$nom) {
1418
		foreach ($this->noms as &$nom) {
1419
			if ($nom['exclure_taxref'] != '' && $nom['exclure_taxref'] != null) {
1419
			if ($nom['exclure_taxref'] != '' && $nom['exclure_taxref'] != null) {
1420
				if (!preg_match('/^(?:0|1|9)$/', $nom['exclure_taxref'])) {
1420
				if (!preg_match('/^(?:0|1|9)$/', $nom['exclure_taxref'])) {
1421
					$noms_erreur[] = array($nom['num_nom'], $nom['exclure_taxref']);
1421
					$noms_erreur[] = array($nom['num_nom'], $nom['exclure_taxref']);
1422
				}
1422
				}
1423
			}
1423
			}
1424
		}
1424
		}
1425
		return $noms_erreur;
1425
		return $noms_erreur;
1426
	}
1426
	}
1427
 
-
 
-
 
1427
	
-
 
1428
	/**
-
 
1429
	* Test #70
-
 
1430
	*/
-
 
1431
	private function testerNomVernaculaireUnique() {
-
 
1432
		$noms_erreur = array();
-
 
1433
		foreach ($this->noms as &$nom) {
-
 
1434
			if ($nom['nom_francais'] != '' && $nom['nom_francais'] != null) {
-
 
1435
				if (strpbrk($nom['nom_francais'],',;')) {
-
 
1436
					$noms_erreur[] = array($nom['num_nom'], $this->repererCaracteresInvalidesNomVerna($nom['nom_francais']));
-
 
1437
				}
-
 
1438
			}
-
 
1439
		}
-
 
1440
		return $noms_erreur;
1428
	
1441
	}
1429
 
1442
 
1430
	//+--------------------------------------------------------------------------------------------------------------+//
1443
	//+--------------------------------------------------------------------------------------------------------------+//
1431
	// MÉTHODES COMMUNES aux TESTS
1444
	// MÉTHODES COMMUNES aux TESTS
1432
	
1445
	
1433
	private function verifierPresence(&$valeur) {
1446
	private function verifierPresence(&$valeur) {
1434
		$codes = $this->manuel['codes_presence'];
1447
		$codes = $this->manuel['codes_presence'];
1435
		$ok = $this->verifierStatuts($valeur, $codes);
1448
		$ok = $this->verifierStatuts($valeur, $codes);
1436
		return $ok;
1449
		return $ok;
1437
	}
1450
	}
1438
	
1451
	
1439
	private function verifierStatutOrigine(&$valeur) {
1452
	private function verifierStatutOrigine(&$valeur) {
1440
		$codes = $this->manuel['codes_statuts_origine'];
1453
		$codes = $this->manuel['codes_statuts_origine'];
1441
		$ok = $this->verifierStatuts($valeur, $codes);
1454
		$ok = $this->verifierStatuts($valeur, $codes);
1442
		return $ok;
1455
		return $ok;
1443
	}
1456
	}
1444
	
1457
	
1445
	private function verifierStatutIntroduction(&$valeur) {
1458
	private function verifierStatutIntroduction(&$valeur) {
1446
		$codes = $this->manuel['codes_statuts_introduction'];
1459
		$codes = $this->manuel['codes_statuts_introduction'];
1447
		$ok = $this->verifierStatuts($valeur, $codes);
1460
		$ok = $this->verifierStatuts($valeur, $codes);
1448
		return $ok;
1461
		return $ok;
1449
	}
1462
	}
1450
	
1463
	
1451
	private function verifierStatutCulture(&$valeur) {
1464
	private function verifierStatutCulture(&$valeur) {
1452
		$codes = $this->manuel['codes_statuts_culture'];
1465
		$codes = $this->manuel['codes_statuts_culture'];
1453
		$ok = $this->verifierStatuts($valeur, $codes);
1466
		$ok = $this->verifierStatuts($valeur, $codes);
1454
		return $ok;
1467
		return $ok;
1455
	}
1468
	}
1456
	
1469
	
1457
	private function verifierStatuts(&$valeur, &$codes) {
1470
	private function verifierStatuts(&$valeur, &$codes) {
1458
		$ok = true;
1471
		$ok = true;
1459
		if (!preg_match("/^(?:|-|[$codes](?:-[A-Z])?)$/", $valeur)) {
1472
		if (!preg_match("/^(?:|-|[$codes](?:-[A-Z])?)$/", $valeur)) {
1460
			$ok = false;
1473
			$ok = false;
1461
		}
1474
		}
1462
		return $ok;
1475
		return $ok;
1463
	}
1476
	}
1464
	
1477
	
1465
	private function verifierBooleen(&$valeur) {
1478
	private function verifierBooleen(&$valeur) {
1466
		$ok = true;
1479
		$ok = true;
1467
		if (!preg_match('/^1$/', $valeur)) {
1480
		if (!preg_match('/^1$/', $valeur)) {
1468
			$ok = false;
1481
			$ok = false;
1469
		}
1482
		}
1470
		return $ok;
1483
		return $ok;
1471
	}
1484
	}
1472
	
1485
	
1473
	private function verifierNombre(&$valeur) {
1486
	private function verifierNombre(&$valeur) {
1474
		$ok = true;
1487
		$ok = true;
1475
		if (!preg_match('/^[0-9]+$/', $valeur)) {
1488
		if (!preg_match('/^[0-9]+$/', $valeur)) {
1476
			$ok = false;
1489
			$ok = false;
1477
		}
1490
		}
1478
		return $ok;
1491
		return $ok;
1479
	}
1492
	}
1480
	
1493
	
1481
	private function verifierNombreSuite(&$valeur) {
1494
	private function verifierNombreSuite(&$valeur) {
1482
		$ok = true;
1495
		$ok = true;
1483
		if (!preg_match('/^(?:[0-9]+, ?)*[0-9]+$/', $valeur)) {
1496
		if (!preg_match('/^(?:[0-9]+, ?)*[0-9]+$/', $valeur)) {
1484
			$ok = false;
1497
			$ok = false;
1485
		}
1498
		}
1486
		return $ok;
1499
		return $ok;
1487
	}
1500
	}
1488
	
1501
	
1489
	private function verifierTypeEpithete(&$type) {
1502
	private function verifierTypeEpithete(&$type) {
1490
		$ok = false;
1503
		$ok = false;
1491
		$rejetes = $this->manuel['type_epithete_rejetes'];
1504
		$rejetes = $this->manuel['type_epithete_rejetes'];
1492
		if (preg_replace("/^(?:$rejetes)$/", '', $type) == '') {
1505
		if (preg_replace("/^(?:$rejetes)$/", '', $type) == '') {
1493
			$ok = false;
1506
			$ok = false;
1494
		} else if (preg_match('/^[a-z][-a-z]*[.]?$/', $type)) {
1507
		} else if (preg_match('/^[a-z][-a-z]*[.]?$/', $type)) {
1495
			$ok = true;
1508
			$ok = true;
1496
		}
1509
		}
1497
		return $ok;
1510
		return $ok;
1498
	}
1511
	}
1499
	
1512
	
1500
	private function verifierBiblioOrigine(&$intitule) {
1513
	private function verifierBiblioOrigine(&$intitule) {
1501
		$ok = true;
1514
		$ok = true;
1502
		if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1515
		if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1503
			$ok = false;// Contient des espaces en trop
1516
			$ok = false;// Contient des espaces en trop
1504
		} else if (!preg_match('/^(?:in [^;]+[;]|)[^,]+?(?:[,][^:]+|)(?:[:].+|)$/', $intitule)) {
1517
		} else if (!preg_match('/^(?:in [^;]+[;]|)[^,]+?(?:[,][^:]+|)(?:[:].+|)$/', $intitule)) {
1505
			$ok = false;
1518
			$ok = false;
1506
		} else if (preg_match('/(?:(?:^|[,:])\s*(?:[:,]|$))/', $intitule)) {
1519
		} else if (preg_match('/(?:(?:^|[,:])\s*(?:[:,]|$))/', $intitule)) {
1507
			$ok = false;// Contient une mauvaise suite de caractères
1520
			$ok = false;// Contient une mauvaise suite de caractères
1508
		}
1521
		}
1509
		return $ok;
1522
		return $ok;
1510
	}
1523
	}
1511
	
1524
	
1512
	private function verifierAnnee(&$annee) {
1525
	private function verifierAnnee(&$annee) {
1513
		$ok = true;
1526
		$ok = true;
1514
		if (!preg_match('/^[0-9]{4}$/', $annee)) {
1527
		if (!preg_match('/^[0-9]{4}$/', $annee)) {
1515
			$ok = false;
1528
			$ok = false;
1516
		} else if ($annee < ANNEE_MINIMUM) {
1529
		} else if ($annee < ANNEE_MINIMUM) {
1517
			$ok = false;
1530
			$ok = false;
1518
		} else if ($annee > ANNEE_EN_COURS) {
1531
		} else if ($annee > ANNEE_EN_COURS) {
1519
			$ok = false;
1532
			$ok = false;
1520
		}
1533
		}
1521
		return $ok;
1534
		return $ok;
1522
	}
1535
	}
1523
	
1536
	
1524
	private function verifierAuteur(&$intitule) {
1537
	private function verifierAuteur(&$intitule) {
1525
		$ok = true;
1538
		$ok = true;
1526
		$acceptes = $this->manuel['auteur_acceptes'];
1539
		$acceptes = $this->manuel['auteur_acceptes'];
1527
		if (!preg_match("/^(?:$acceptes)$/", $intitule)) {
1540
		if (!preg_match("/^(?:$acceptes)$/", $intitule)) {
1528
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1541
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1529
				$ok = false;// Contient des espaces en trop
1542
				$ok = false;// Contient des espaces en trop
1530
			} else {
1543
			} else {
1531
				$mots_rejetes = $this->manuel['auteur_mots_rejetes'];
1544
				$mots_rejetes = $this->manuel['auteur_mots_rejetes'];
1532
				$mots = explode(' ', $intitule);
1545
				$mots = explode(' ', $intitule);
1533
				foreach ($mots as $position => $mot) {
1546
				foreach ($mots as $position => $mot) {
1534
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1547
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1535
						$ok = false;// Mot rejeté
1548
						$ok = false;// Mot rejeté
1536
					} else if (preg_match("/^(?:(?:\p{L}|[.'\(\),-])+|[&])$/u", $mot)) {
1549
					} else if (preg_match("/^(?:(?:\p{L}|[.'\(\),-])+|[&])$/u", $mot)) {
1537
						continue;// Mot de l'intitulé auteur
1550
						continue;// Mot de l'intitulé auteur
1538
					} else {
1551
					} else {
1539
						$ok = false;
1552
						$ok = false;
1540
					}
1553
					}
1541
				}
1554
				}
1542
			}
1555
			}
1543
		}
1556
		}
1544
		return $ok;
1557
		return $ok;
1545
	}
1558
	}
1546
	
1559
	
1547
	private function verifierNomCommercial(&$epithete) {
1560
	private function verifierNomCommercial(&$epithete) {
1548
		$ok = false;
1561
		$ok = false;
1549
		if (preg_match("/^[[:upper:][:punct:][:digit:][:space:]]+$/", $epithete)) {
1562
		if (preg_match("/^[[:upper:][:punct:][:digit:][:space:]]+$/", $epithete)) {
1550
			$ok = true;
1563
			$ok = true;
1551
		}
1564
		}
1552
		return $ok;
1565
		return $ok;
1553
	}
1566
	}
1554
	
1567
	
1555
	private function verifierEpitheteCultivar(&$epithete) {
1568
	private function verifierEpitheteCultivar(&$epithete) {
1556
		$ok = true;
1569
		$ok = true;
1557
		$acceptes = $this->manuel['cultivar_acceptes'];
1570
		$acceptes = $this->manuel['cultivar_acceptes'];
1558
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1571
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1559
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1572
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1560
				$ok = false;// Contient des espaces en trop
1573
				$ok = false;// Contient des espaces en trop
1561
			} else {
1574
			} else {
1562
				$mots_rejetes = $this->manuel['cultivar_mots_rejetes'];
1575
				$mots_rejetes = $this->manuel['cultivar_mots_rejetes'];
1563
				$mots_mineurs = $this->manuel['mots_mineurs'];
1576
				$mots_mineurs = $this->manuel['mots_mineurs'];
1564
				$mots = explode(' ', $epithete);
1577
				$mots = explode(' ', $epithete);
1565
				foreach ($mots as $position => $mot) {
1578
				foreach ($mots as $position => $mot) {
1566
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1579
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1567
						$ok = false;// Mot rejeté
1580
						$ok = false;// Mot rejeté
1568
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1581
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1569
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1582
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1570
					} else {
1583
					} else {
1571
						$mots_tiret = explode('-', $mot);
1584
						$mots_tiret = explode('-', $mot);
1572
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1585
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1573
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1586
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1574
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position
1587
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position
1575
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1588
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1576
								continue;//Mot (ou 'mot-tiret') avec lettre initiale majuscule
1589
								continue;//Mot (ou 'mot-tiret') avec lettre initiale majuscule
1577
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1590
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1578
								continue;//Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1591
								continue;//Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1579
							} else {
1592
							} else {
1580
								$ok = false;
1593
								$ok = false;
1581
							}
1594
							}
1582
						}
1595
						}
1583
					}
1596
					}
1584
				}
1597
				}
1585
			}
1598
			}
1586
		}
1599
		}
1587
		return $ok;
1600
		return $ok;
1588
	}
1601
	}
1589
	
1602
	
1590
	private function verifierEpitheteGroupeCultivar(&$epithete) {
1603
	private function verifierEpitheteGroupeCultivar(&$epithete) {
1591
		$ok = true;
1604
		$ok = true;
1592
		$acceptes = $this->manuel['cultivar_gp_acceptes'];
1605
		$acceptes = $this->manuel['cultivar_gp_acceptes'];
1593
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1606
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1594
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1607
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1595
				$ok = false;// Contient des espaces en trop
1608
				$ok = false;// Contient des espaces en trop
1596
			} else {
1609
			} else {
1597
				$mots_acceptes = $this->manuel['cultivar_gp_mots_acceptes'];
1610
				$mots_acceptes = $this->manuel['cultivar_gp_mots_acceptes'];
1598
				$mots_rejetes = $this->manuel['cultivar_gp_mots_rejetes'];
1611
				$mots_rejetes = $this->manuel['cultivar_gp_mots_rejetes'];
1599
				$mots_mineurs = $this->manuel['mots_mineurs'];
1612
				$mots_mineurs = $this->manuel['mots_mineurs'];
1600
				$mots = explode(' ', $epithete);
1613
				$mots = explode(' ', $epithete);
1601
				foreach ($mots as $position => $mot) {
1614
				foreach ($mots as $position => $mot) {
1602
					if (preg_match("/^(?:$mots_acceptes)$/i", $mot)) {
1615
					if (preg_match("/^(?:$mots_acceptes)$/i", $mot)) {
1603
						continue;// Mot accepté
1616
						continue;// Mot accepté
1604
					} else if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1617
					} else if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1605
						$ok = false;// Mot rejeté
1618
						$ok = false;// Mot rejeté
1606
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1619
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1607
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1620
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1608
					} else {
1621
					} else {
1609
						$mots_tiret = explode('-', $mot);
1622
						$mots_tiret = explode('-', $mot);
1610
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1623
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1611
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1624
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1612
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position dans le mot
1625
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position dans le mot
1613
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1626
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1614
								continue;// Mot (ou 'mot-tiret') avec lettre initiale majuscule
1627
								continue;// Mot (ou 'mot-tiret') avec lettre initiale majuscule
1615
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1628
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1616
								continue;// Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1629
								continue;// Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1617
							} else {
1630
							} else {
1618
								$ok = false;
1631
								$ok = false;
1619
							}
1632
							}
1620
						}
1633
						}
1621
					}
1634
					}
1622
				}
1635
				}
1623
			}
1636
			}
1624
		}
1637
		}
1625
		return $ok;
1638
		return $ok;
1626
	}
1639
	}
1627
	
1640
	
1628
	private function verifierEpitheteSp(&$epithete) {
1641
	private function verifierEpitheteSp(&$epithete) {
1629
		$ok = false;
1642
		$ok = false;
1630
		if (preg_match('/^[a-zäëḧïöẗüẅẍÿ][-a-zäëḧïöẗüẅẍÿ]+$/', $epithete)) {
1643
		if (preg_match('/^[a-zäëḧïöẗüẅẍÿ][-a-zäëḧïöẗüẅẍÿ]+$/', $epithete)) {
1631
			$ok = true;
1644
			$ok = true;
1632
		} else if (preg_match('/^sp\.(?:[A-Z]|[1-9][0-9]*)$/', $epithete)) {
1645
		} else if (preg_match('/^sp\.(?:[A-Z]|[1-9][0-9]*)$/', $epithete)) {
1633
			$ok = true;
1646
			$ok = true;
1634
		}
1647
		}
1635
		return $ok;
1648
		return $ok;
1636
	}
1649
	}
1637
	
1650
	
1638
	private function verifierEpitheteGenre(&$epithete) {
1651
	private function verifierEpitheteGenre(&$epithete) {
1639
		$ok = false;
1652
		$ok = false;
1640
		if (preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ](?:[-a-zäëḧïöẗüẅẍÿ]+|[a-zäëḧïöẗüẅẍÿ]+-[A-ZÄËḦÏÖÜẄẌŸ][a-zäëḧïöẗüẅẍÿ]+)$/', $epithete)) {
1653
		if (preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ](?:[-a-zäëḧïöẗüẅẍÿ]+|[a-zäëḧïöẗüẅẍÿ]+-[A-ZÄËḦÏÖÜẄẌŸ][a-zäëḧïöẗüẅẍÿ]+)$/', $epithete)) {
1641
			$ok = true;
1654
			$ok = true;
1642
		}
1655
		}
1643
		return $ok;
1656
		return $ok;
1644
	}
1657
	}
1645
	
1658
	
1646
	private function verifierEstAbbreviationInfraSp($mot) {
1659
	private function verifierEstAbbreviationInfraSp($mot) {
1647
		$ok = false;
1660
		$ok = false;
1648
		if(preg_match($this->manuel['abbr_rangs_infra_specifique'], $mot)) {
1661
		if(preg_match($this->manuel['abbr_rangs_infra_specifique'], $mot)) {
1649
			$ok = true;
1662
			$ok = true;
1650
		}
1663
		}
1651
		return $ok;
1664
		return $ok;
1652
	}
1665
	}
1653
	
1666
	
1654
	private function formaterStyleNomGenre(&$genre) {
1667
	private function formaterStyleNomGenre(&$genre) {
1655
		$genre_fmt = '';
1668
		$genre_fmt = '';
1656
		if (preg_match('/^\s*([x+])\s+(.+)$/i', $genre, $match)) {
1669
		if (preg_match('/^\s*([x+])\s+(.+)$/i', $genre, $match)) {
1657
			$genre_fmt = utf8_encode(strtolower(utf8_decode($match[1]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[2]))));
1670
			$genre_fmt = utf8_encode(strtolower(utf8_decode($match[1]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[2]))));
1658
		} elseif (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $genre, $match)) {
1671
		} elseif (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $genre, $match)) {
1659
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1672
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1660
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1673
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1661
		} else {
1674
		} else {
1662
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($genre))));
1675
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($genre))));
1663
		}
1676
		}
1664
		return $genre_fmt;
1677
		return $genre_fmt;
1665
	}
1678
	}
1666
	
1679
	
1667
	private function formaterStyleEpitheteSpHybride(&$genre, &$epithete) {
1680
	private function formaterStyleEpitheteSpHybride(&$genre, &$epithete) {
1668
		$nom_fmt = '';
1681
		$nom_fmt = '';
1669
		$erreur = '';
1682
		$erreur = '';
1670
		if (trim($genre) == '') {
1683
		if (trim($genre) == '') {
1671
			if ($epithete != '') {
1684
			if ($epithete != '') {
1672
				$nom_fmt = $this->formaterFormuleHybridite($epithete);
1685
				$nom_fmt = $this->formaterFormuleHybridite($epithete);
1673
			} else {
1686
			} else {
1674
				$erreur = "Formule d'hybridité sans épithéte spécifique";
1687
				$erreur = "Formule d'hybridité sans épithéte spécifique";
1675
			}
1688
			}
1676
		} else {
1689
		} else {
1677
			$nom_fmt = $this->formaterNomHybride($genre, $epithete);
1690
			$nom_fmt = $this->formaterNomHybride($genre, $epithete);
1678
		}
1691
		}
1679
		return array($nom_fmt, $erreur);
1692
		return array($nom_fmt, $erreur);
1680
	}
1693
	}
1681
	
1694
	
1682
	private function formaterStyleEpitheteInfraSpHybride(&$nom_sci, &$infra, &$genre = null) {		
1695
	private function formaterStyleEpitheteInfraSpHybride(&$nom_sci, &$infra, &$genre = null) {		
1683
		$nom_fmt = '';
1696
		$nom_fmt = '';
1684
		$erreur = '';
1697
		$erreur = '';
1685
		if (trim($genre) == '') {
1698
		if (trim($genre) == '') {
1686
			if (trim($nom_sci) == '') {
1699
			if (trim($nom_sci) == '') {
1687
				if (trim($infra) != '') {
1700
				if (trim($infra) != '') {
1688
					$nom_fmt = $this->formaterFormuleHybridite($infra);
1701
					$nom_fmt = $this->formaterFormuleHybridite($infra);
1689
				} else {
1702
				} else {
1690
					$erreur = "Formule d'hybridité sans épithéte infraspécifique";
1703
					$erreur = "Formule d'hybridité sans épithéte infraspécifique";
1691
				}
1704
				}
1692
			} else {
1705
			} else {
1693
				$erreur = "Formule d'hybridité avec épithéte spécifique";
1706
				$erreur = "Formule d'hybridité avec épithéte spécifique";
1694
			}
1707
			}
1695
		} else {
1708
		} else {
1696
			$nom_fmt = $this->formaterNomHybride($nom_sci, $infra);
1709
			$nom_fmt = $this->formaterNomHybride($nom_sci, $infra);
1697
		}
1710
		}
1698
		return array($nom_fmt, $erreur);
1711
		return array($nom_fmt, $erreur);
1699
	}
1712
	}
1700
	
1713
	
1701
	private function formaterNomHybride(&$nom_sci, &$epithete) {
1714
	private function formaterNomHybride(&$nom_sci, &$epithete) {
1702
		if (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $epithete, $match) != '') {
1715
		if (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $epithete, $match) != '') {
1703
			$nom_fmt = $nom_sci.utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1716
			$nom_fmt = $nom_sci.utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1704
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.
1717
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.
1705
				utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1718
				utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1706
		} elseif (preg_match('/^([x+])\s+(.+)$/i', $epithete, $match) != '') {
1719
		} elseif (preg_match('/^([x+])\s+(.+)$/i', $epithete, $match) != '') {
1707
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($match[1]))).' '.
1720
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($match[1]))).' '.
1708
				utf8_encode(strtolower(utf8_decode($match[2])));
1721
				utf8_encode(strtolower(utf8_decode($match[2])));
1709
		} else {
1722
		} else {
1710
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($epithete)));
1723
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($epithete)));
1711
		}
1724
		}
1712
		return $nom_fmt;
1725
		return $nom_fmt;
1713
	}
1726
	}
1714
	
1727
	
1715
	private function formaterFormuleHybridite(&$epithete) {
1728
	private function formaterFormuleHybridite(&$epithete) {
1716
		$liste_parents = explode(' x ', $epithete);
1729
		$liste_parents = explode(' x ', $epithete);
1717
		if (count($liste_parents) == 2) {
1730
		if (count($liste_parents) == 2) {
1718
			$nom_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[0])))).' x '.
1731
			$nom_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[0])))).' x '.
1719
			utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[1]))));
1732
			utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[1]))));
1720
		} else {
1733
		} else {
1721
			for ($i=0; $i<count($liste_parents); $i++) {
1734
			for ($i=0; $i<count($liste_parents); $i++) {
1722
				if (strstr(trim($liste_parents[$i]), ' ') == false) {
1735
				if (strstr(trim($liste_parents[$i]), ' ') == false) {
1723
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode(trim($liste_parents[$i]))))).' x '.
1736
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode(trim($liste_parents[$i]))))).' x '.
1724
					utf8_encode(strtolower(utf8_decode(trim($liste_parents[$i+1]))));
1737
					utf8_encode(strtolower(utf8_decode(trim($liste_parents[$i+1]))));
1725
					$i++;
1738
					$i++;
1726
				} else {
1739
				} else {
1727
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[$i]))));
1740
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[$i]))));
1728
				}
1741
				}
1729
			}
1742
			}
1730
			$nom_fmt = implode(' x ', $nom);
1743
			$nom_fmt = implode(' x ', $nom);
1731
		}
1744
		}
1732
		return $nom_fmt;
1745
		return $nom_fmt;
1733
	}
1746
	}
1734
	
1747
	
1735
	private function repererEspace($nom_sci) {
1748
	private function repererEspace($nom_sci) {
1736
		$nom_sci = str_replace(' ', '<span class="espace">&nbsp;</span>', $nom_sci);
1749
		$nom_sci = str_replace(' ', '<span class="espace">&nbsp;</span>', $nom_sci);
1737
		return $nom_sci;
1750
		return $nom_sci;
1738
	}
1751
	}
-
 
1752
	
-
 
1753
	private function repererCaracteresInvalidesNomVerna($nom_verna) {
-
 
1754
		$nom_verna = str_replace(',', '<span class="espace">,</span>', $nom_verna);
-
 
1755
		$nom_verna = str_replace(';', '<span class="espace">;</span>', $nom_verna);
-
 
1756
		return $nom_verna;
-
 
1757
	}
1739
	
1758
	
1740
	private function construireSuffixeNomPltCultivee(&$nom) {
1759
	private function construireSuffixeNomPltCultivee(&$nom) {
1741
		$suffixe = array();
1760
		$suffixe = array();
1742
		$suffixe[] = $this->construireNomCultivarGroupe($nom);
1761
		$suffixe[] = $this->construireNomCultivarGroupe($nom);
1743
		$suffixe[] = $this->construireNomCommercial($nom);
1762
		$suffixe[] = $this->construireNomCommercial($nom);
1744
		$suffixe[] = $this->construireNomCultivar($nom);
1763
		$suffixe[] = $this->construireNomCultivar($nom);
1745
		$suffixe = array_filter($suffixe);
1764
		$suffixe = array_filter($suffixe);
1746
		return implode(' ', $suffixe);
1765
		return implode(' ', $suffixe);
1747
	}
1766
	}
1748
	
1767
	
1749
	private function construireNomCultivarGroupe(&$nom) {
1768
	private function construireNomCultivarGroupe(&$nom) {
1750
		$nom_groupe_cultivar = '';
1769
		$nom_groupe_cultivar = '';
1751
		if ($nom['cultivar_groupe'] != '') {
1770
		if ($nom['cultivar_groupe'] != '') {
1752
			if (preg_match('/ gx$/', $nom['cultivar_groupe'])) {
1771
			if (preg_match('/ gx$/', $nom['cultivar_groupe'])) {
1753
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].')';
1772
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].')';
1754
			} else {
1773
			} else {
1755
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].' Gp)';
1774
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].' Gp)';
1756
			}
1775
			}
1757
		}
1776
		}
1758
		return $nom_groupe_cultivar;
1777
		return $nom_groupe_cultivar;
1759
	}
1778
	}
1760
	
1779
	
1761
	private function construireNomCommercial(&$nom) {
1780
	private function construireNomCommercial(&$nom) {
1762
		$nom_commercial = '';
1781
		$nom_commercial = '';
1763
		if ($nom['nom_commercial'] != '') {
1782
		if ($nom['nom_commercial'] != '') {
1764
			$nom_commercial =  strtoupper($nom['nom_commercial']);
1783
			$nom_commercial =  strtoupper($nom['nom_commercial']);
1765
		}
1784
		}
1766
		return $nom_commercial;
1785
		return $nom_commercial;
1767
	}
1786
	}
1768
	
1787
	
1769
	private function construireNomCultivar(&$nom) {
1788
	private function construireNomCultivar(&$nom) {
1770
		$nom_cultivar = '';
1789
		$nom_cultivar = '';
1771
		if ($nom['cultivar'] != '') {
1790
		if ($nom['cultivar'] != '') {
1772
			$nom_cultivar =  "'".$nom['cultivar']."'";
1791
			$nom_cultivar =  "'".$nom['cultivar']."'";
1773
		}
1792
		}
1774
		return $nom_cultivar;
1793
		return $nom_cultivar;
1775
	}
1794
	}
1776
	
1795
	
1777
	private function classerNomsParNomComplet() {
1796
	private function classerNomsParNomComplet() {
1778
		$noms_classes = array();
1797
		$noms_classes = array();
1779
		foreach ($this->noms as &$nom) {
1798
		foreach ($this->noms as &$nom) {
1780
			if (!isset($noms_classes[$nom['nom_sci']])) {
1799
			if (!isset($noms_classes[$nom['nom_sci']])) {
1781
				$noms_classes[$nom['nom_sci']] = 1;
1800
				$noms_classes[$nom['nom_sci']] = 1;
1782
			} else {
1801
			} else {
1783
				$noms_classes[$nom['nom_sci']]++;
1802
				$noms_classes[$nom['nom_sci']]++;
1784
			}
1803
			}
1785
		}
1804
		}
1786
		return $noms_classes;
1805
		return $noms_classes;
1787
	}
1806
	}
1788
}
1807
}
1789
?>
1808
?>