Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1208 → Rev 1206

/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/structure/StructureAPersonne.java
5,7 → 5,6
 
import org.tela_botanica.client.modeles.aDonnee;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.util.UtilString;
 
import com.google.gwt.json.client.JSONObject;
 
251,14 → 250,6
set("nom", nom);
}
// NOM COMPLET
public String getNomComplet() {
return renvoyerValeurCorrecte("fmt_nom_complet");
}
public void setNomComplet(String nomComplet) {
set("fmt_nom_complet", nomComplet);
}
// TÉLÉPHONE
public String getTelephone() {
return renvoyerValeurCorrecte("telephone");
272,7 → 263,7
return getInfoDenormaliseParType(renvoyerValeurCorrecte("telephone"), Personne.TELEPHONE_FIXE);
}
public void setTelephoneFixe(String fixe) {
// Nous remplaçons le premier numéro de Téléphone FIXE de la personne
// Nous remplaçons le premier numéro de Téléphone FIX de la personne
modifierChaineDenormaliseParType("telephone", Personne.TELEPHONE_FIXE, fixe);
}
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/structure/StructureAPersonneAsyncDao.java
6,7 → 6,6
import org.tela_botanica.client.http.JsonRestRequestCallback;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilDAO;
 
import com.extjs.gxt.ui.client.Registry;
58,11 → 57,6
}
 
public void ajouter(String structureId, StructureAPersonne personnel) {
Debug.log("<<<< BEGIN StructureAPersonneAsyncDao.ajouter()");
 
Debug.log("<<<< StructureAPersonneAsyncDao.ajouter(), personnel="+personnel.toString());
String postDonneesEncodees = construirePost(structureId, personnel);
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
78,9 → 72,6
}
}
});
Debug.log("<<<< END StructureAPersonneAsyncDao.supprimer()");
}
public void modifier(StructureAPersonne personnel) {
137,7 → 128,6
"&cp_ce_projet=" + URL.encodeComponent(personnel.getIdProjetPersonne()) +
"&cp_prenom=" + URL.encodeComponent(personnel.getPrenom()) +
"&cp_nom=" + URL.encodeComponent(personnel.getNom()) +
"&cp_fmt_nom_complet=" + URL.encodeComponent(personnel.getNomComplet()) +
"&cp_truk_telephone=" + URL.encodeComponent(personnel.getTelephone()) +
"&cp_truk_courriel=" + URL.encodeComponent(personnel.getCourriel()) +
"&cp_ce_truk_specialite=" + URL.encodeComponent(personnel.getSpecialite()) +
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/structure/StructureForm.java
7,7 → 7,6
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
25,7 → 24,6
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
import org.tela_botanica.client.modeles.structure.StructureConservation;
import org.tela_botanica.client.modeles.structure.StructureValorisation;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.Pattern;
import org.tela_botanica.client.util.UtilArray;
import org.tela_botanica.client.util.UtilString;
36,7 → 34,6
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.event.KeyListener;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
260,9 → 257,6
}
public boolean soumettreFormulaire() {
Debug.log("===> BEGIN StructureForm.soumettreFormulaire()");
// Vérification de la validité des champs du formulaire
boolean fomulaireValide = verifierFormulaire();
if (fomulaireValide) {
278,20 → 272,14
// L'ajout des relations StructureAPersonne se fait quand la structure a été ajoutée
// Voir la méthode rafraichir().
} else if (mode.equals(MODE_MODIFIER)) {
Debug.log("===> StructureForm.soumettreFormulaire(), mode="+mode);
// Modification des informations sur la Structure
if (structure == null && conservation == null && valorisation == null) {
InfoLogger.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
Info.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
} else {
mediateur.modifierStructure(this, identification.getId(), structure, conservation, valorisation);
}
Debug.log("===> StructureForm.soumettreFormulaire(), personnelModifie.size="+personnelModifie.size() + ", personnelAjoute.size()="+personnelAjoute.size());
if (personnelModifie.size() == 0 && personnelAjoute.size() == 0 && personnelSupprime.size() == 0) {
InfoLogger.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
Info.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
} else {
if (personnelModifie.size() != 0) {
decompteRafraichissementPersonnel++;
310,9 → 298,6
}
}
}
Debug.log("===> END StructureForm.soumettreFormulaire()");
return fomulaireValide;
}
1042,14 → 1027,11
int nbrePersonne = personnelGrilleMagazin.getCount();
for (int i = 0; i < nbrePersonne; i++) {
StructureAPersonne personne = personnelGrilleMagazin.getAt(i);
Debug.log(":::> StructureForm.collecterStructurePersonnel()");
Debug.log(":::> etat="+personne.get("etat"));
 
// Seules les lignes ajoutées ou modifiées sont prises en compte.
Record record = personnelGrilleMagazin.getRecord(personne);
if (personnelGrilleMagazin.getModifiedRecords().contains(record) == true
|| (personne.get("etat") != null && (personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE) || personne.get("etat").equals(StructureAPersonne.ETAT_MODIFIE)) )) {
|| (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE) )) {
// Gestion de l'id de la structure
if (mode.equals("MODIF")) {
1073,10 → 1055,6
} else {
personne.setFonction("");
}
 
// Gestion du nom complet
String nomComplet = personne.getPrenom()+" "+personne.getNom();
personne.setNomComplet(nomComplet);
// Gestion de la notion de "contact"
personne.setContact(false);
1154,16 → 1132,6
personnel.get(index).set("statut", personnel.get(index).getStatut().replaceFirst("AUTRE##", ""));
}
// Gestion de la specialite
if (((String) personnel.get(index).getSpecialite()).matches("^[0-9]+$")) {
// Author : Cyprien
// TODO
// Ici faire un combobox ?
// ...
} else {
personnel.get(index).set("specialite", personnel.get(index).getSpecialite().replaceFirst("AUTRE##", ""));
}
// Gestion du temps de travail
String tps = personnel.get(index).getBotaTravailHebdoTps();
personnel.get(index).set("travail", (tps.matches("^[0-9]+$") ? Integer.parseInt(tps) : 0));
1189,9 → 1157,6
personnelOnglet.setStyleAttribute("padding", "0");
personnelOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
Debug.log(":::> StructureForm.creerOngletPersonnel.HandleEvent()");
// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
personnelOnglet.setData("acces", true);
 
1199,9 → 1164,6
if (mode.equals(MODE_AJOUTER)) {
rafraichirPersonnel();
}
else {
initialiserGrillePersonnelEnModification();
}
}
});
1215,9 → 1177,8
cp.setFrame(true);
personnelGrilleMagazin = new ListStore<StructureAPersonne>();
personnelGrilleMagazin.setMonitorChanges(true);
personnelGrilleMagazin.addListener(Store.Add, new Listener<StoreEvent<StructureAPersonne>>() {
 
public void handleEvent(StoreEvent<StructureAPersonne> ce) {
// Activation du bouton supprimer si la grille contient un élément
if (grillePersonnel.getStore().getCount() > 0) {
1227,17 → 1188,6
}
});
/* TODELETE
personnelGrilleMagazin.addListener(Store.Update, new Listener<StoreEvent<StructureAPersonne>>() {
public void handleEvent(StoreEvent<StructureAPersonne> ce) {
personnelGrilleMagazin.getAt(ce.getIndex()).set("etat", StructureAPersonne.ETAT_MODIFIE);
Debug.log("Modification de : "+personnelGrilleMagazin.getAt(ce.getIndex()).getNom());
}
});
*/
RowNumberer r = new RowNumberer();
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
1502,9 → 1452,6
grillePersonnel.setAutoExpandColumn("specialite");
grillePersonnel.setStripeRows(true);
grillePersonnel.setTrackMouseOver(true);
grillePersonnel.addListener(null, sm);
cp.add(grillePersonnel);
personnelOnglet.add(cp);
2003,9 → 1950,6
}
public void rafraichir(Object nouvellesDonnees) {
Debug.log("|0> StructureForm.rafraichir, nouvellesDonnees.getClass() = "+nouvellesDonnees.getClass());
try {
if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
2030,35 → 1974,33
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
}
 
Debug.log("|0> StructureForm.rafraichirInformation, info.getType() = "+info.getType());
if (info.getType().equals("modif_structure")) {
InfoLogger.display("Modification d'une institution", info.toString());
Info.display("Modification d'une institution", info.toString());
} else if (info.getType().equals("ajout_structure")) {
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
String structureId = (String) info.getDonnee(0);
InfoLogger.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
Info.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
// Suite à la récupération de l'id de l'institution nouvellement ajoutée nous ajoutons le personnel
mediateur.ajouterStructureAPersonne(this, structureId, personnelAjoute);
} else {
InfoLogger.display("Ajout d'une Institution", info.toString());
Info.display("Ajout d'une Institution", info.toString());
}
} else if (info.getType().equals("modif_structure_a_personne")) {
InfoLogger.display("Modification du Personnel", info.toString());
Info.display("Modification du Personnel", info.toString());
GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
testerLancementRafraichirPersonnel();
} else if (info.getType().equals("suppression_structure_a_personne")) {
InfoLogger.display("Suppression du Personnel", info.toString());
Info.display("Suppression du Personnel", info.toString());
GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
testerLancementRafraichirPersonnel();
} else if (info.getType().equals("ajout_structure_a_personne")) {
InfoLogger.display("Ajout du Personnel", info.toString());
Info.display("Ajout du Personnel", info.toString());
GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
testerLancementRafraichirPersonnel();
} else if (info.getType().equals("selection_structure")) {
InfoLogger.display("Modification d'une institution", info.toString());
Info.display("Modification d'une institution", info.toString());
String titre = i18nC.titreModifFormStructurePanneau();
if (info.getDonnee(0) != null) {
identification = (Structure) info.getDonnee(0);
2082,23 → 2024,14
}
}
}
panneauFormulaire.setHeading(titre);
} else if (info.getType().equals("liste_structure_a_personne")) {
Debug.log("==> StructureForm.rafraichirInformation, typeInfo=liste_structure_a_personne");
if (info.getDonnee(0) != null) {
personnel = (StructureAPersonneListe) info.getDonnee(0);
 
peuplerStructurePersonnel();
/* TODELETE
int nbPersonnel = this.personnelGrilleMagazin.getCount();
for (int i=0; i<nbPersonnel; i++){
Debug.log("==> setEtat(ETAT_MODIFIE) : personne="+this.personnelGrilleMagazin.getAt(i).getId());
this.personnelGrilleMagazin.getAt(i).set("etat", StructureAPersonne.ETAT_MODIFIE);
}
*/
personnelOnglet.layout();
InfoLogger.display("Chargement du Personnel", "ok");
Info.display("Chargement du Personnel", "ok");
 
// Remise à zéro des modification dans la liste du personnel
personnelModifie = new StructureAPersonneListe();
2240,19 → 2173,14
}
private void testerLancementRafraichirPersonnel() {
Debug.log("==> BEGIN StructureForm.testerLancementRafraichirPersonnel()");
decompteRafraichissementPersonnel--;
if (decompteRafraichissementPersonnel == 0) {
// Nous rechargeons la liste du Personnel
rafraichirPersonnel();
}
Debug.log("==> END StructureForm.testerLancementRafraichirPersonnel()");
}
}
private void rafraichirPersonnel() {
Debug.log("==> BEGIN StructureForm.rafraichirPersonnel()");
decompteRafraichissementPersonnel = 0;
if (mode.equals(MODE_MODIFIER)) {
initialiserGrillePersonnelEnModification();
2259,7 → 2187,6
} else if (mode.equals(MODE_AJOUTER)) {
initialiserGrillePersonnelEnAjout();
}
Debug.log("==> END StructureForm.rafraichirPersonnel()");
}
private void rafraichirPersonneExistante(String nom) {
2281,7 → 2208,7
personnelOnglet.layout();
}
private void initialiserGrillePersonnelEnModification() {
mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE);
private void initialiserGrillePersonnelEnModification() {
mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE);
}
}
}