Subversion Repositories eFlore/Applications.coel

Rev

Rev 1263 | Rev 1293 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1263 Rev 1271
Line 1... Line 1...
1
package org.tela_botanica.client.vues.structure;
1
package org.tela_botanica.client.vues.structure;
Line 2... Line 2...
2
 
2
 
-
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.Date;
4
import java.util.Iterator;
5
import java.util.Iterator;
Line 5... Line 6...
5
import java.util.List;
6
import java.util.List;
6
 
7
 
Line 117... Line 118...
117
	private ComboBox<InterneValeur> comboAcronyme = null;
118
	private ComboBox<InterneValeur> comboAcronyme = null;
118
	private TextField<String> ihChp = null;
119
	private TextField<String> ihChp = null;
119
	private TextField<String> mnhnChp = null;
120
	private TextField<String> mnhnChp = null;
120
	private ComboBox<InterneValeur> comboTypeStructure = null;
121
	private ComboBox<InterneValeur> comboTypeStructure = null;
121
	private TextField<String> nomStructureChp = null;
122
	private TextField<String> nomStructureChp = null;
122
	private DateField dateFondationChp = null;
123
	private TextField<String> dateFondationChp = null;
123
	private TextArea descriptionChp = null;
124
	private TextArea descriptionChp = null;
124
	private TextArea conditionAccesChp = null;
125
	private TextArea conditionAccesChp = null;
125
	private TextArea conditionUsageChp = null;
126
	private TextArea conditionUsageChp = null;
126
	private TextArea adrChp = null;
127
	private TextArea adrChp = null;
127
	private TextArea adrComplementChp = null;
128
	private TextArea adrComplementChp = null;
Line 341... Line 342...
341
			if (!personnelNumero.equals("")) {
342
			if (!personnelNumero.equals("")) {
342
				messages.add("Veuillez indiquez un prénom et un nom au personnel numéro : "+personnelNumero);
343
				messages.add("Veuillez indiquez un prénom et un nom au personnel numéro : "+personnelNumero);
343
			}
344
			}
344
		}
345
		}
Line -... Line 346...
-
 
346
 
-
 
347
		//Vérification de la date de fondation
-
 
348
		String valeurDateFondation = dateFondationChp.getValue();
-
 
349
		if (!UtilString.isEmpty(valeurDateFondation) && (!valeurDateFondation.matches("\\d{2}/\\d{2}/\\d{4}") && 
-
 
350
				!valeurDateFondation.matches("\\d{4}")))	{
-
 
351
				messages.add("La date de fondation n'est pas au format jj/MM/AAAA ou AAAA");
-
 
352
			} 
345
 
353
		
346
		// Affichage des messages d'alerte
354
		// Affichage des messages d'alerte
347
		if (messages.size() != 0) {
355
		if (messages.size() != 0) {
348
			String[] a = {};
356
			String[] a = {};
349
			a = messages.toArray(a);
357
			a = messages.toArray(a);
350
			MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
358
			MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
351
			return false;
359
			return false;
-
 
360
		}
352
		}
361
		
353
		return true;
362
		return true;
Line 354... Line 363...
354
	}
363
	}
355
	
364
	
Line 661... Line 670...
661
					structureCollectee.setTypePublic(comboLstpu.getValue().getId());
670
					structureCollectee.setTypePublic(comboLstpu.getValue().getId());
662
				} else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
671
				} else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
663
					structureCollectee.setTypePrive(comboLstpr.getValue().getId());
672
					structureCollectee.setTypePrive(comboLstpr.getValue().getId());
664
				}
673
				}
665
			}
674
			}
-
 
675
			
-
 
676
			String valeurDateFondation = dateFondationChp.getValue();
-
 
677
			if (!UtilString.isEmpty(valeurDateFondation))	{
-
 
678
				if (valeurDateFondation.matches("\\d{2}/\\d{2}/\\d{4}"))	{
-
 
679
					Date dateFondation = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDateFondation);
666
			structureCollectee.setDateFondation(dateFondationChp.getValue());
680
					structureCollectee.setDateFondation(dateFondation);
-
 
681
				} else if (valeurDateFondation.matches("\\d{4}"))	{
-
 
682
					structureCollectee.setDateFondation(valeurDateFondation + "-00-00");
-
 
683
				}
-
 
684
			}
Line 667... Line 685...
667
			
685
			
668
			structureCollectee.setDescription(descriptionChp.getValue());
686
			structureCollectee.setDescription(descriptionChp.getValue());
669
			structureCollectee.setConditionAcces(conditionAccesChp.getValue());
687
			structureCollectee.setConditionAcces(conditionAccesChp.getValue());
Line 756... Line 774...
756
				if (identification.getTypePublic().matches("^[0-9]+$")) {
774
				if (identification.getTypePublic().matches("^[0-9]+$")) {
757
					comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
775
					comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
758
					comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
776
					comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
759
				}
777
				}
760
			}
778
			}
-
 
779
			
-
 
780
			String dateFondation = identification.getAnneeOuDateFondation();
-
 
781
			if (!dateFondation.equals(""))	{
-
 
782
				if (dateFondation.endsWith("00-00"))	{
761
			dateFondationChp.setValue(identification.getDateFondation());
783
					dateFondationChp.setValue(dateFondation.substring(0, 4));
-
 
784
				} else {
-
 
785
					Date date = DateTimeFormat.getFormat("yyyy-MM-dd").parse(dateFondation);
-
 
786
					dateFondationChp.setValue(DateTimeFormat.getFormat("dd/MM/yyyy").format(date));
-
 
787
				}
-
 
788
			}
Line 762... Line 789...
762
			
789
			
763
			descriptionChp.setValue(identification.getDescription());
790
			descriptionChp.setValue(identification.getDescription());
764
			conditionAccesChp.setValue(identification.getConditionAcces());
791
			conditionAccesChp.setValue(identification.getConditionAcces());
Line 1679... Line 1706...
1679
		
1706
		
1680
		ligneTs.add(gaucheTs, new ColumnData(0.5));  
1707
		ligneTs.add(gaucheTs, new ColumnData(0.5));  
1681
		ligneTs.add(droiteTs, new ColumnData(0.5));
1708
		ligneTs.add(droiteTs, new ColumnData(0.5));
Line 1682... Line 1709...
1682
		fieldSetIdentite.add(ligneTs);
1709
		fieldSetIdentite.add(ligneTs);
1683
		
1710
		
1684
		dateFondationChp = new DateField();
1711
		dateFondationChp = new TextField();
1685
		dateFondationChp.setTabIndex(tabIndex++);
-
 
1686
		dateFondationChp.setFieldLabel("Date de fondation");
-
 
1687
		dateFondationChp.getPropertyEditor().getFormat();
-
 
1688
		dateFondationChp.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
1712
		dateFondationChp.setTabIndex(tabIndex++);
Line 1689... Line 1713...
1689
		dateFondationChp.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
1713
		dateFondationChp.setFieldLabel("Date de fondation");
1690
		fieldSetIdentite.add(dateFondationChp);
1714
		fieldSetIdentite.add(dateFondationChp);
1691
		
1715