Subversion Repositories Applications.referentiel

Rev

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

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