Subversion Repositories Applications.referentiel

Rev

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

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