% /****************************************************************************** * 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 session="true" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.SalesInvestBean" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@ page import="com.edeal.frontline.FrontlineException" %> <%@ page import="com.edeal.frontline.BasicBean" %> <%@ page import="com.edeal.frontline.EnterpriseBean" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.helper.ContextHelper" %> <%@ page import="com.edeal.frontline.helper.custom.FlTaskHelper" %> <%@ page import="org.apache.commons.lang.StringUtils" %> <%@ 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", "Ent").getID(); boolean hasDoubloon = false; if(flRequest.getAttribute("HasDoubloon") != null) { 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 entId = null; try { entId = Enterprise.getID(); isCreation = false; } catch(FieldNotInitializedException fnie) { } String typOrganisation = null; boolean isAssociation = false; boolean isResto = false; boolean isPartenaire = false; Boolean afficherDansCatalogue = true; try { typOrganisation = Enterprise.getEntTyeID(); if(typOrganisation != null){ isAssociation = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ASSO")); if(typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ETAB")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "RESTO"))) { isResto = true; } isPartenaire = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "PART")); } } catch (FieldNotInitializedException e) {} // JSA Yellow Pages integation if (flRequest.getAttribute("__YPBean__") != null) { BasicBean bean = (BasicBean)flRequest.getAttribute("__YPBean__"); if (bean != null) { request.setAttribute("Enterprise", (EnterpriseBean)bean); Enterprise = (EnterpriseBean)bean; try { String pPhone = Enterprise.getEntPhone(); if (!pPhone.startsWith("+33")) { //pPhone = Utils.formatPhone("+33 (?)? ?? ?? ?? ?? ",pPhone); pPhone = Utils.formatPhone("?? ?? ?? ?? ??", pPhone); Enterprise.setEntPhone(pPhone); } } catch (FieldNotInitializedException e) { } } flRequest.removeAttribute("__YPBean__"); } else if (flRequest.getAttribute("__Address__Enterprise") != null || session.getAttribute("__Address__Enterprise") != null) { BasicBean bean = (BasicBean)flRequest.getAttribute("__Address__Enterprise"); if (bean == null) bean = (BasicBean)session.getAttribute("__Address__Enterprise"); if (bean != null) { request.setAttribute("Enterprise", (EnterpriseBean)bean); Enterprise=(EnterpriseBean)bean; try { String pPhone = Enterprise.getEntPhone(); if (!pPhone.startsWith("+33")) { //pPhone = Utils.formatPhone("+33 (?)? ?? ?? ?? ?? ",pPhone); pPhone = Utils.formatPhone("?? ?? ?? ?? ??", pPhone); Enterprise.setEntPhone(pPhone); } } catch (FieldNotInitializedException e) { } } flRequest.removeAttribute("__Address__Enterprise"); } String id = null; try { id = Enterprise.getID(); } catch (FieldNotInitializedException fnie) { } boolean isCreate = id == null; String actionSave = null; if (isCreate) { actionSave="/save_enterprise.fl"; } else { actionSave="/save_enterprise.fl"; } logger.debug("isCreate: " + isCreate); logger.debug("Save action: " + actionSave); String entCtrID; String entCtrCode = null; try { entCtrID = Enterprise.getEntCtrID(); entCtrCode = dico.getRefCode("EntCtrID", entCtrID); } catch (Exception e) { entCtrID = ""; } String entFRCtrCode = null; try { entFRCtrCode = dico.getRefIdByCode("EntCtrID", "FR"); } catch (Exception e) { } String entIntraVAT; try { entIntraVAT = Enterprise.getEntIntraVAT(); } catch (FieldNotInitializedException e) { entIntraVAT = ""; } String typoStructID = null; try { typoStructID = (String)Enterprise.getCustomProperty("EntTypoStructure_"); } catch (FieldNotInitializedException e){ typoStructID = ""; } String departID; try { departID = dico.getRefIdByCode("EntTypoStructure_", "DEPARTEMENTALE"); } catch (FrontlineException e) { departID = ""; } String regionID; try { regionID = dico.getRefIdByCode("EntTypoStructure_", "REGIONAL"); } catch (FrontlineException e) { regionID = ""; } String paysID; try { paysID = dico.getRefIdByCode("EntTypoStructure_", "PAYS"); } catch (FrontlineException e) { paysID = ""; } String codePays = null; String codeRegion = null; String regiondedepartementID = null; String paysderegionID = null; String entregionID = null; try { entregionID = (String) Enterprise.getCustomProperty("EntRegionID_"); } catch (FieldNotInitializedException e) { } String entdepartementID = null; try { entdepartementID = (String) Enterprise.getCustomProperty("EntDepartmentID_"); } catch (FieldNotInitializedException e) { } if(entregionID != null) { codePays = (String)dico.getRefDisp("Rg_", "Te2", entregionID); if(codePays != null) { try { paysderegionID = (String) dico.getRefIdByCode("EntCtrID", codePays); if (paysderegionID != null) { Enterprise.setEntCtrID(paysderegionID); } } catch (FrontlineException e) { } } else { Enterprise.setEntCtrID(null); } } if(entdepartementID != null ) { codeRegion = (String)dico.getRefDisp("Dp_", "Te2", entdepartementID); if(codeRegion != null) { try { regiondedepartementID = (String) dico.getRefIdByCode("EntRegionID_", codeRegion); if (regiondedepartementID != null) { Enterprise.setCustomProperty("EntRegionID_", regiondedepartementID); } } catch (FrontlineException e) { } if (regiondedepartementID != null) { codePays = (String)dico.getRefDisp("Rg_", "Te2", regiondedepartementID); } if(codePays != null) { try { paysderegionID = (String) dico.getRefIdByCode("EntCtrID", codePays); if (paysderegionID != null) { Enterprise.setEntCtrID(paysderegionID); } } catch (FrontlineException e) { } } } else { Enterprise.setCustomProperty("EntRegionID_", null); Enterprise.setEntCtrID(null); } } %> <% if(typoStructID.equalsIgnoreCase(departID)) { if(regiondedepartementID != null) { %> <%} else {%> <%} if(paysderegionID != null) {%> <%} else {%> <%}%> <%} %> <% if(typoStructID.equalsIgnoreCase(regionID)) { if(paysderegionID != null) {%> <%} %> <%} %> " listTitle="<%= Utils.getMessage(session, \"L30A2\", false, true, \"Liste des entreprises\") %>" ou="<%= \"/edit_enterprise.fl\" + (id != null ? \"?id=\" + id : \"\") %>"> <%-- --%> <%-- begin : Adresse --%> <% if(!isAssociation && !isResto && !isPartenaire){ %> <% }else if(isResto){ %> <% } %> <%-- --%> <%-- --%> <% if(typoStructID.equalsIgnoreCase(departID) || typoStructID.equalsIgnoreCase(regionID)) { %> <%} else {%> <% if(!isPartenaire){ %> <%}%> <%} %> <% if(isPartenaire){ %> <% } %> <%-- " size="4" style="width: auto;"/> " style="width:100%" /> <%if(!isAssociation && !isPartenaire) {%> <%} %> <% if(!isAssociation && !isPartenaire) { %> <% if (typOrganisation == null ) {%> <%} else if ( (id != null && typOrganisation != null) || (id == null && typOrganisation != null)) {%> " name="EntTyeIDVal" readonly> <%} %> <%} %> <% if(!isAssociation && !isPartenaire) { %> <% } else if (isPartenaire) {%> <% if (typOrganisation == null ) {%> <%} else if ( (id != null && typOrganisation != null) || (id == null && typOrganisation != null)) {%> " name="EntTyeIDVal" readonly> <%} %> <%} %> <% if(isAssociation) { %> <% if( typOrganisation == null ) {%> <%} else if ( (id != null && typOrganisation != null) || (id == null && typOrganisation != null)) {%> " name="EntTyeIDVal" readonly> <%} %> <%} %> <% if(!isAssociation && !isPartenaire) { %> <%-- --%> <%-- --%> <%-- --%> <%} else if (isAssociation) {%> <% if(typoStructID.equalsIgnoreCase(departID)) { %> <%} else if (typoStructID.equalsIgnoreCase(regionID)) {%> <%}%> <%} else if (isPartenaire) {%> <%} %> <%if(isPartenaire) {%> <%-- Infos Société --%> "> <%} else if(isAssociation) {%> <%-- Infos Société --%> "> <%} else if(!isAssociation && !isPartenaire) {%> <%-- Infos Société --%> "> <%-- Prestations --%> "> <%} %> ">