% /****************************************************************************** * 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.PersonBean" %> <%@ page import="com.edeal.frontline.helper.ContextHelper" %> <%@ page import="com.edeal.frontline.controller.actions.GetSilhouetteFromEmailOrCookieAction" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ 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 = (Boolean)flRequest.getAttribute("HasDoubloon"); 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.getPerFstName(); fullName.append(val + " "); } catch (FieldNotInitializedException e) { Person.setPerFstName(Utils.getMessage(session, "F611C", true, "")); } try { val = Person.getPerName(); fullName.append(val + " "); } catch (FieldNotInitializedException e) { Person.setPerName(Utils.getMessage(session, "F611D", 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 perFstName = null; try { perFstName = Person.getPerFstName(); } catch (FieldNotInitializedException e) { Person.setPerFstName(Utils.getMessage(session, "F611C", true, "")); } String perName = null; try { perName = Person.getPerName(); } catch (FieldNotInitializedException e) { Person.setPerName(Utils.getMessage(session, "F611D", 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; try { perCtrID = Person.getPerCtrID(); } catch (Exception e) { perCtrID = ""; } String ctrAssID = null; ctrAssID = dico.getRefIdByCode("PerGrpFct_", "ASS"); %> &id=<%= id %>&salesModel=<%= salesModel %>&pad=<%= personalAddressDefault %>&emailPattern=<%= emailPattern %>&PerLocID=<%= PerLocID %>"> <% if (ContextHelper.hasMultifunction(context)) { %> <%-- variable pour le multifunction --%> "> "> "> <% } %> "> <% if (!hasEnterprise || isB2C) { %> <% } else if ("NO".equalsIgnoreCase(personAddress)) { %> <% } if (isB2C) { %> <% } %> " ou="/edit_person.fl"> ! "> <%-- A afficher seulement si le groupe de fonctions est "ASSOCIATION" --%>