<%@page import="com.itextpdf.text.log.SysoLogger"%> <% /****************************************************************************** * Copyright (c) 2000-2013 E-DEAL * * E-DEAL S.A. * 41, rue Périer * 92120 Montrouge * France * * T: +33 (0)1 73 03 29 80 * F: +33 (0)1 73 01 69 77 * http://www.e-deal.com * * La diffusion de ce code source sous quelque forme que ce soit sans * l'autorisation de E-DEAL est interdite. * * Vous êtes autorisés à modifier ce code source uniquement pour votre usage * propre et sous réserve que les mentions de copyright demeurent intactes. * * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour * responsable des dommages pouvant résulter de l'utilisation de ce code * source. ******************************************************************************/ %> <%@ page contentType="text/html; charset=UTF8" session="true" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.EnterpriseBean" %> <%@ page import="java.util.Date" %> <%@ page import="java.util.Hashtable" %> <%@ page import="com.edeal.frontline.FrontlineException" %> <%@ page import="com.edeal.frontline.LocationBean" %> <%@ page import="com.edeal.frontline.SalesInvestBean" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.BasicBean" %> <%@ page import="com.edeal.frontline.custom.Photo_Bean" %> <%@ page import="com.edeal.frontline.PersonBean" %> <%@ page import="com.edeal.frontline.helper.ContextHelper" %> <%@ page import="com.edeal.frontline.controller.actions.GetSilhouetteFromEmailOrCookieAction" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@page import="com.edeal.frontline.ActorBean"%> <%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String objID = dico.getTable("rad", "Per").getID(); Boolean hasDoubloon = false; try{ hasDoubloon = (Boolean)flRequest.getAttribute("HasDoubloon"); } catch(Exception e) { } if(hasDoubloon == null) { hasDoubloon = false; } Vector listFieldsForDbl = (Vector)flRequest.getAttribute("matchCodeFields"); // If no match code fields is undefined if (listFieldsForDbl == null) { listFieldsForDbl = new Vector(); } //Vector matchCodeTemplates = (Vector)flRequest.getAttribute("matchCodeTemplates"); Vector fieldDisplay = (Vector)flRequest.getAttribute("fieldDisplay"); if (fieldDisplay == null) { fieldDisplay = new Vector(); } Vector seuils = (Vector)flRequest.getAttribute("seuils"); boolean isCreation = true; String perId = null; try { perId = Person.getID(); isCreation = false; } catch(FieldNotInitializedException fnie) { } // JSA Yellow Pages integation if (flRequest.getAttribute("__YPBean__") != null) { BasicBean bean = (BasicBean)flRequest.getAttribute("__YPBean__"); if (bean != null) { request.setAttribute("Person", (PersonBean)bean); Person = (PersonBean)bean; //formatter le telephone try { String pPhone = Person.getPerPhone(); if (!pPhone.startsWith("+33") && !pPhone.startsWith("33")) { //pPhone = Utils.formatPhone("+33 (?)? ?? ?? ?? ?? ",pPhone); pPhone = Utils.formatPhone("?? ?? ?? ?? ??", pPhone); Person.setPerPhone(pPhone); } if (pPhone.startsWith("33")) { //pPhone = Utils.formatPhone("+33 (?)? ?? ?? ?? ?? ","0"+pPhone.substring(2, pPhone.length())); pPhone = Utils.formatPhone("?? ?? ?? ?? ??","0" + pPhone.substring(2, pPhone.length())); Person.setPerPhone(pPhone); } } catch (FieldNotInitializedException e) { } } flRequest.removeAttribute("__YPBean__"); } else if (flRequest.getAttribute("__Address__Person") != null || session.getAttribute("__Address__Person") != null) { BasicBean bean = (BasicBean)flRequest.getAttribute("__Address__Person"); if (bean == null) { bean = (BasicBean)session.getAttribute("__Address__Person"); } if (bean != null) { request.setAttribute("Person", (PersonBean) bean); Person = (PersonBean) bean; //formatter le telephone try { String pPhone = Person.getPerPhone(); if (!pPhone.startsWith("+33") && !pPhone.startsWith("33")) { //pPhone = Utils.formatPhone("+33 (?)? ?? ?? ?? ?? ",pPhone); pPhone = Utils.formatPhone("?? ?? ?? ?? ??", pPhone); Person.setPerPhone(pPhone); } if (pPhone.startsWith("33")) { //pPhone = Utils.formatPhone("+33 (?)? ?? ?? ?? ?? ","0"+pPhone.substring(2, pPhone.length())); pPhone = Utils.formatPhone("?? ?? ?? ?? ??","0" + pPhone.substring(2, pPhone.length())); Person.setPerPhone(pPhone); } } catch (FieldNotInitializedException e) { } } flRequest.removeAttribute("__Address__Person"); } String id = null; String strActID = (String)session.getAttribute("actorID"); try { id = Person.getID(); } catch (FieldNotInitializedException fnie) { Person.setPerCounselor(strActID); } StringBuffer fullName = new StringBuffer(); if (id != null) { String val; try { val = Person.getPerCivID(); fullName.append(dico.getRefDisp(session, "PerCivID", val) + " "); } catch (FieldNotInitializedException e) { } try { val = Person.getPerName(); fullName.append(val + " "); } catch (FieldNotInitializedException e) { Person.setPerName(Utils.getMessage(session, "F611D", true, "")); } try { val = Person.getPerFstName(); fullName.append(val + " "); } catch (FieldNotInitializedException e) { Person.setPerFstName(Utils.getMessage(session, "F611C", true, "")); } } else { //voir si entreprise existe try { logger.debug("je recupère l'id de l'entreprise"); Person.setPerEntID(Enterprise.getEntID()); logger.debug("j'ai bien une entreprise " + Enterprise.getEntID()); } catch (FieldNotInitializedException e) { } String perName = null; try { perName = Person.getPerName(); } catch (FieldNotInitializedException e) { Person.setPerName(Utils.getMessage(session, "F611D", true, "")); } String perFstName = null; try { perFstName = Person.getPerFstName(); } catch (FieldNotInitializedException e) { Person.setPerFstName(Utils.getMessage(session, "F611C", true, "")); } } String salesModel = context.getContextParameter("SalesModel"); String personAddress = context.getContextParameter("PersonAddress"); String personScoring = context.getContextParameter("PersonScoring"); String emailPattern = (String) request.getAttribute("emailPattern"); if (emailPattern == null) { emailPattern = ""; } boolean isB2C = "B2C".equalsIgnoreCase(salesModel); Vector vectLoc = new Vector(); String PerLocID; try { PerLocID = Person.getPerLocID(); } catch (FieldNotInitializedException e) { PerLocID = ""; } //if sales model is B2C, no enterprise boolean hasEnterprise = false; if (!isB2C) { try { EnterpriseBean enterprise = Person.getPerEnterprise(); hasEnterprise = true; pageContext.setAttribute("Enterprise", enterprise); try { vectLoc = LocationBean.listSummary( context, new String[] { "LocName", "LocID" }, new String[][] {{ "LocEntID = " + Utils.formatToSQL(context, enterprise.getID()) }}, new String[] { "LocName" } ); } catch (Exception e) { } } catch (FieldNotInitializedException e) { pageContext.setAttribute("Enterprise", new EnterpriseBean()); } } String tempAttr = (String) request.getAttribute("personalAddressDefault"); boolean personalAddressDefault = "true".equalsIgnoreCase(tempAttr); // People history stuff String valPehEntID = Utils.getRequestParameter(context, request, "PehEntID"); if (valPehEntID == null) { try { valPehEntID = Person.getPerEntID(); } catch (FieldNotInitializedException fnie) { valPehEntID = ""; } } String valPehFctID = Utils.getRequestParameter(context, request, "PehFctID"); if (valPehFctID == null) { try { valPehFctID = Person.getPerFctID(); } catch (FieldNotInitializedException fnie) { valPehFctID = ""; } } String valPehFunction = null; try { valPehFunction = (String) dico.getRefDisp(session, "PerFctID" , valPehFctID); } catch (FrontlineException fex) { } if (valPehFunction == null) { valPehFunction = ""; } String valPehPhone = Utils.getRequestParameter(context, request, "PehPhone"); if (valPehPhone == null) { try { valPehPhone = Person.getPerPhone(); } catch (FieldNotInitializedException fnie) { valPehPhone = ""; } } String valPehFax = Utils.getRequestParameter(context, request, "PehFax"); if (valPehFax == null) { try { valPehFax = Person.getPerFax(); } catch (FieldNotInitializedException fnie) { valPehFax = ""; } } String valPehMail = Utils.getRequestParameter(context, request, "PehMail"); if (valPehMail == null) { try { valPehMail = Person.getPerMail(); } catch (FieldNotInitializedException fnie) { valPehMail = ""; } } Enterprise = (EnterpriseBean) pageContext.getAttribute("Enterprise"); if (Enterprise == null) { try { Enterprise = new EnterpriseBean(session); } catch (Exception e) { } pageContext.setAttribute("Enterprise", Enterprise); } String perFirstNameOnFocus = "if (this.value == '" + Utils.getMessage(session, "F611C", true, "") + "') { this.value = ''; }"; String perNameOnFocus = "if (this.value == '" + Utils.getMessage(session, "F611D", true, "") + "') { this.value = ''; }"; String initPerEntID = flRequest.getParameter("initPerEntID"); String perFctID = null; try { perFctID = Person.getPerFctID(); } catch (FieldNotInitializedException fnie) { perFctID = ""; } String perDepID = null; try { perDepID = Person.getPerDepID(); } catch (FieldNotInitializedException e) { } String perCtrID = null; try { perCtrID = Person.getPerCtrID(); System.out.println("Person.getPerCtrID() = "+Person.getPerCtrID()); } catch (Exception e) { perCtrID = ""; } String ctrAssID = null; ctrAssID = dico.getRefIdByCode("PerGrpFct_", "ASS"); // On récupère l'ID de l'acteur connecté String actID = null; String query = ""; if (session != null) { actID = (String)session.getAttribute("effectiveActorID"); if (actID == null) { actID = (String)session.getAttribute("actorID"); if (actID == null) { throw new FrontlineException("there is not an actor ID in session"); } } } Boolean createGuest = false; try { ActorBean act = new ActorBean(actID, context); Vector actRolesIDs = new Vector(); // On récupère les roles actRolesIDs.addAll(act.getRoles()); String roleADMID = dico.getRefIdByCode("ActRoles", "ADMIN"); /* Role Administrateur*/ String roleTECHADMID = dico.getRefIdByCode("ActRoles", "S_ADM_TECH"); /* Role Administrateur Technique*/ String role1ID = dico.getRefIdByCode("ActRoles", "D_ATTACH_DIR"); /* Role Attache de Direction*/ String role2ID = dico.getRefIdByCode("ActRoles", "D_SECR_DIR"); /* Role Secretariat de direction */ String role3ID = dico.getRefIdByCode("ActRoles", "R_RESP_RES_AFFIL"); /* Role Responsable Affilies */ String role4ID = dico.getRefIdByCode("ActRoles", "ASSO_SAL"); /* Role Association avec Salarié */ String role5ID = dico.getRefIdByCode("ActRoles", "ASSO_SANS_SAL"); /* Role Association sans Salarié*/ String role6ID = dico.getRefIdByCode("ActRoles", "R_DEV_AFFIL"); /* Devel affiliés*/ String role7ID = dico.getRefIdByCode("ActRoles", "C_COMRCLE"); /* Commercial*/ String role8ID = dico.getRefIdByCode("ActRoles", "C_CONS_TECH"); /* Role conseiller technique */ String role9ID = dico.getRefIdByCode("ActRoles", "P_RESP_CHARG_DEV"); /* Role resp charge de dev */ if(!(actRolesIDs.isEmpty())) { // on prend le 1er role de l'acteur connecté String actRoleIDactuel = actRolesIDs.get(0).toString(); if(actRoleIDactuel.equals(role3ID) || actRoleIDactuel.equals(role6ID)) { query ="[[EntTyeID:RefVal = 'ETAB'], [EntTyeID:RefVal = 'HOTEL'], [EntTyeID:RefVal = 'RESTO']]"; } else if (actRoleIDactuel.equals(role7ID)) { query ="[[EntTyeID:RefVal = 'PART']]"; } else if (actRoleIDactuel.equals(role1ID) || actRoleIDactuel.equals(role2ID)) { query ="[[EntTyeID:RefVal = 'ASSO']]"; //Mantis 29108 //} else if (actRoleIDactuel.equals(role9ID) || actRoleIDactuel.equals(role8ID) || actRoleIDactuel.equals(role4ID) || actRoleIDactuel.equals(role5ID)) { } else if (actRoleIDactuel.equals(role9ID) || actRoleIDactuel.equals(role8ID)) { query ="[[EntTyeID:RefVal = 'HOTEL']]"; } else if (actRoleIDactuel.equals(roleADMID) || actRoleIDactuel.equals(roleTECHADMID)) { query =""; } else { createGuest= true; } } } catch (FrontlineException e) { } /* String codeXploitant = null; codeXploitant = dico.getRefIdByCode("PerFctID", "EXPL"); String perEntID = null; try { perEntID = Person.getPerEntID(); } catch (FieldNotInitializedException e) { } if( perEntID != null && codeXploitant.equals(perFctID) ){ String mail = null; EnterpriseBean entB = new EnterpriseBean(perEntID,context); try{ mail = (String) entB.getCustomProperty("EntMail_"); }catch (FieldNotInitializedException e) { } Person.setPerMail(mail); } */ // Extension de la civilité // charger l'AttId de la photo String personPhotoID = null; String personPhotoAttID = null; try { personPhotoID = (String) Person.getCustomProperty("PerPhoto_"); } catch (FieldNotInitializedException fnie) { } if(personPhotoID != null){ Photo_Bean po_ = new Photo_Bean(personPhotoID , context); try { personPhotoAttID = (String) po_.getPo_Apercu(); } catch (FieldNotInitializedException fnie) { } } %> <% if (ContextHelper.hasMultifunction(context)) { %> <%-- variable pour le multifunction --%> "> "> "> <% } %> "> <% if (!hasEnterprise || isB2C) { %> <% } else if ("NO".equalsIgnoreCase(personAddress)) { %> <% } if (isB2C) { %> <% } %> " ou="/edit_person.fl">
<%if(personPhotoAttID != null) { %> <%} else { %> <%} %>
"/>
">
<%-- --%> <%-- if (!createGuest) {--%> <%-- } --%> <%-- --%> <%-- rendre le champ PerMail obligatoire si la fonction du contact = "Expoiltant" --%> <%String codeXploitant = null; codeXploitant = dico.getRefIdByCode("PerFctID", "EXPL"); if(!codeXploitant.equals(perFctID) ){%> <%} else { %> <%} %>
<%-- --%> <%-- --%>
<%-- A afficher seulement si le groupe de fonctions est "ASSOCIATION" --%>