Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 770 Rev 771
Line 988... Line 988...
988
		return conservationOnglet;
988
		return conservationOnglet;
989
	}
989
	}
Line 990... Line 990...
990
	
990
	
991
	private void collecterStructurePersonnel() {
991
	private void collecterStructurePersonnel() {
-
 
992
		if (personnelOnglet.getData("acces").equals(true)) {
992
		if (personnelOnglet.getData("acces").equals(true)) {
993
			personnelGrilleMagazin.commitChanges();
993
			int nbrePersonne = personnelGrilleMagazin.getCount();
994
			int nbrePersonne = personnelGrilleMagazin.getCount();
994
			for (int i = 0; i < nbrePersonne; i++) {
995
			for (int i = 0; i < nbrePersonne; i++) {
995
				StructureAPersonne personne = personnelGrilleMagazin.getAt(i);
996
				StructureAPersonne personne = personnelGrilleMagazin.getAt(i);
996
				
997
 
-
 
998
				// Seules les lignes ajoutées ou modifiées sont prises en compte.
997
				// Seules les lignes ajoutées ou modifiées sont prises en compte.
999
				Record record = personnelGrilleMagazin.getRecord(personne);
-
 
1000
				if (personnelGrilleMagazin.getModifiedRecords().contains(record) == true 
Line 998... Line 1001...
998
				if (personnelGrilleMagazin.getModifiedRecords().contains(personnelGrilleMagazin.getRecord(personne)) == true) {
1001
						|| (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE) )) {
999
					
1002
					
1000
					// Gestion de l'id de la structure
1003
					// Gestion de l'id de la structure
1001
					if (mode.equals("MODIF")) {
1004
					if (mode.equals("MODIF")) {
Line 1057... Line 1060...
1057
					// Gestion de la spécialité
1060
					// Gestion de la spécialité
1058
					String specialite = personne.get("specialite");
1061
					String specialite = personne.get("specialite");
1059
					personne.setSpecialite(specialite);
1062
					personne.setSpecialite(specialite);
Line 1060... Line 1063...
1060
					
1063
					
1061
					// Ajout de la personne dans la liste correspondant à son état (ajouté ou modifié)
1064
					// Ajout de la personne dans la liste correspondant à son état (ajouté ou modifié)
1062
					if (personne.get("etat") != null && personne.get("etat").equals("A")) {// Une personne ajoutée
1065
					if (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE)) {// Une personne ajoutée
1063
						personnelAjoute.put(""+i, personne);
1066
						personnelAjoute.put(""+i, personne);
1064
					} else {// Une personne modifiée
1067
					} else {// Une personne modifiée
1065
						personnelModifie.put(personne.getId(), personne);
1068
						personnelModifie.put(personne.getId(), personne);
1066
					}
1069
					}
Line 1410... Line 1413...
1410
		grillePersonnel.addPlugin(r);
1413
		grillePersonnel.addPlugin(r);
1411
		grillePersonnel.getView().setForceFit(true);
1414
		grillePersonnel.getView().setForceFit(true);
1412
  		grillePersonnel.setAutoExpandColumn("specialite");
1415
  		grillePersonnel.setAutoExpandColumn("specialite");
1413
  		grillePersonnel.setStripeRows(true);
1416
  		grillePersonnel.setStripeRows(true);
1414
  		grillePersonnel.setTrackMouseOver(true);
1417
  		grillePersonnel.setTrackMouseOver(true);
1415
  		grillePersonnel.addListener(Events.Change, new Listener<GridEvent<StructureAPersonne>>() {
-
 
1416
 
-
 
1417
			public void handleEvent(GridEvent<StructureAPersonne> ge) {
-
 
1418
				// CommitChanges évite que la grille perde la valeur des combobox éditables
-
 
1419
				personnelGrilleMagazin.commitChanges();
-
 
1420
			}
-
 
1421
  			
-
 
1422
  		});
-
 
1423
  		cp.add(grillePersonnel);
1418
  		cp.add(grillePersonnel);
1424
		personnelOnglet.add(cp);
1419
		personnelOnglet.add(cp);
Line 1425... Line 1420...
1425
		
1420
		
1426
		return personnelOnglet;
1421
		return personnelOnglet;
Line 2069... Line 2064...
2069
	}
2064
	}
Line 2070... Line 2065...
2070
	
2065
	
2071
	private void ajouterMembreAGrillePersonnel(StructureAPersonne personnel) {
2066
	private void ajouterMembreAGrillePersonnel(StructureAPersonne personnel) {
2072
		grillePersonnel.stopEditing();
2067
		grillePersonnel.stopEditing();
2073
		personnelGrilleMagazin.insert(personnel, 0);
-
 
2074
		
-
 
2075
		// Nous modifions l'enregistrement pour que le modèle soit pris en compte lors de la collecte.
-
 
2076
		Record record = personnelGrilleMagazin.getRecord(personnelGrilleMagazin.getAt(0));
-
 
2077
		record.beginEdit();
-
 
2078
		
-
 
2079
		if (!personnel.getFonction().equals("")) {
-
 
2080
			Object fonction = fonctionEditor.preProcessValue(personnel.getFonction());
-
 
2081
			if (fonction != null && fonction instanceof Valeur) {
-
 
2082
				record.set("fonction", ((Valeur)fonction).getNom());
-
 
2083
			}
-
 
2084
		}
-
 
2085
		
-
 
2086
		if (!personnel.getPrenom().equals("")) {
-
 
2087
			record.set("prenom", personnel.getPrenom());
-
 
2088
		}
-
 
2089
		
-
 
2090
		if (!personnel.getNom().equals("")) {
-
 
2091
			record.set("nom", personnel.getNom());
-
 
2092
		}
-
 
2093
		
-
 
2094
		if (!personnel.getTelephoneFixe().equals("")) {
-
 
2095
			record.set("tel_fix", personnel.getTelephoneFixe());
-
 
2096
		}
-
 
2097
		
-
 
2098
		if (!personnel.getFax().equals("")) {
-
 
2099
			record.set("tel_fax", personnel.getFax());
-
 
2100
		}
-
 
2101
		
-
 
2102
		if (!personnel.getCourriel().equals("")) {
-
 
2103
			record.set("courriel", personnel.selectionnerCourriel(1));
-
 
2104
		}
-
 
2105
		
-
 
2106
		if (!personnel.getStatut().equals("")) {
-
 
2107
			record.set("statut", personnel.getStatut());
-
 
2108
		}
-
 
2109
		
-
 
2110
		String tempsDeTravail = personnel.getBotaTravailHebdoTps();
-
 
2111
		record.set("travail", (tempsDeTravail.matches("^[0-9]+$")  ? Integer.parseInt(tempsDeTravail) : 0));
-
 
2112
		
-
 
2113
		if (!personnel.getSpecialite().equals("")) {
-
 
2114
			record.set("specialite", personnel.afficherSpecialite());
-
 
2115
		}
-
 
2116
		
-
 
2117
		record.set("contact", (personnel.getContact().equals("1") ? true : false));
-
 
2118
		
-
 
2119
		record.set("etat", personnel.get("etat"));
-
 
2120
		record.endEdit();
-
 
2121
		
2068
		personnelGrilleMagazin.insert(personnel, 0);
2122
		grillePersonnel.startEditing(0, 0);
2069
		grillePersonnel.startEditing(0, 0);
Line 2123... Line 2070...
2123
	}
2070
	}
2124
	
2071