<% /****************************************************************************** * Copyright (c) 2000-2013 E-DEAL * * E-DEAL S.A. * 41, rue Périer * 92120 Montrougesi * 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="com.edeal.frontline.custom.Photo_Bean" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.helper.ContextHelper" %> <%@ page import="com.edeal.frontline.helper.custom.EnterpriseHelper" %> <%@ 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 titreEntreprise = "Tiers"; String typOrganisation = null; boolean isAssociation = false; boolean isResto = false; boolean isHotel = false; boolean isPartenaire = false; boolean isCabaudit = false; boolean isJournaliste = false; boolean isPresta = false; boolean isFournisseurRef = false; /* cette var a été ajouté pour traiter la necessité du champ @Mail de facturation 69539 */ boolean isHotelRestoORMaisonORInsolite = false; Boolean afficherDansCatalogue = true; try { typOrganisation = Enterprise.getEntTyeID(); String hotelRestoTypeID = (String)dico.getRefIdByCode("EntTyeID", "ETAB"); String hotelTypeID = (String)dico.getRefIdByCode("EntTyeID", "HOTEL"); String restoTypeID = (String)dico.getRefIdByCode("EntTyeID", "RESTO"); if(typOrganisation != null){ titreEntreprise = (String) dico.getRefDisp("EntTyeID", typOrganisation); isAssociation = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ASSO")); if(typOrganisation.equals(hotelRestoTypeID) || typOrganisation.equals(restoTypeID)) { isResto = true; } if(typOrganisation.equals(hotelRestoTypeID) || typOrganisation.equals(hotelTypeID) || typOrganisation.equals(restoTypeID)) { isHotel = true; } isPartenaire = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "PART")); isCabaudit = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "AUDIT")); isJournaliste = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "JOURN")); isPresta = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "PRESTA")); //Mantis 31819 isFournisseurRef = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "FRS")); isHotelRestoORMaisonORInsolite = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "MAISON")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "INSOLIT")) || typOrganisation.equals(hotelRestoTypeID) || typOrganisation.equals(hotelTypeID) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "AUBERGE")); } } 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 entFRCtrCode = null; try { entFRCtrCode = dico.getRefIdByCode("EntCtrID", "FR"); } catch (Exception e) { } String entCtrID = null; String entCtrCode = null; try { entCtrID = Enterprise.getEntCtrID(); entCtrCode = dico.getRefCode("EntCtrID", entCtrID); } catch (Exception e) { Enterprise.setEntCtrID(entFRCtrCode); } String entIntraVAT; try { entIntraVAT = Enterprise.getEntIntraVAT(); } catch (FieldNotInitializedException e) { entIntraVAT = ""; } String entRatach = null; try { entRatach = (String)Enterprise.getCustomProperty("EntRatachHotelID_"); } catch (FieldNotInitializedException e){ } 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 departMultiID; try { departMultiID = dico.getRefIdByCode("EntTypoStructure_", "MULTI"); } catch (FrontlineException e) { departMultiID = ""; } 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); } } // String entPhotoID_ = null; // /* // String po_LienPhotoExt = null; // String po_LienPhotoInt = null; // */ // String po_apercuPhotoID = null; // Photo_Bean entPhoto = null; // try { // entPhotoID_ = (String)Enterprise.getCustomProperty("EntPhotoID_"); // } catch (FieldNotInitializedException e) { // } // if (entPhotoID_ != null) { // try { // entPhoto = new Photo_Bean(entPhotoID_,context); // } catch (FrontlineException e) { // } // } // if(entPhoto != null) { // try { // po_apercuPhotoID = (String)entPhoto.getPo_Apercu(); // } catch (FieldNotInitializedException fne) { // /* // try { // po_LienPhotoInt = (String)entPhoto.getPo_LienPhoto(); // } catch (FieldNotInitializedException fnie) { // } // try { // po_LienPhotoExt = (String)entPhoto.getPo_LienPhotoExt(); // } catch (FieldNotInitializedException fnie) { // } // */ // } // } String entPhotoID_ = null; String po_apercuPhotoID = null; Photo_Bean entPhoto = null; String entPhoto2ID_ = null; Photo_Bean entPhoto2 = null; String po_apercuPhoto2ID = null; String nomPhotoGuide1 = ""; String nomPhotoGuide2 = ""; try { entPhotoID_ = (String)Enterprise.getCustomProperty("EntPhotoID_"); } catch (FieldNotInitializedException e) {} if (entPhotoID_ != null) { try { entPhoto = new Photo_Bean(entPhotoID_,context); nomPhotoGuide1 = entPhoto.getPo_NomPhoto(); } catch (FrontlineException e) {} } if(entPhoto != null) { try { po_apercuPhotoID = (String)entPhoto.getPo_Apercu(); } catch (FieldNotInitializedException fne) {} } try { entPhoto2ID_ = (String)Enterprise.getCustomProperty("EntPhoto2ID_"); } catch (FieldNotInitializedException e) {} if (entPhoto2ID_ != null) { try { entPhoto2 = new Photo_Bean(entPhoto2ID_,context); nomPhotoGuide2 = entPhoto2.getPo_NomPhoto(); } catch (FrontlineException e) {} } if(entPhoto2ID_!= null) { try { po_apercuPhoto2ID = (String)entPhoto2.getPo_Apercu(); } catch (FieldNotInitializedException fne) {} } String siret = null; try { siret = Enterprise.getEntSiret(); Enterprise.setEntSiren(siret.substring(0, 10)); } catch (Exception e) { } // Initialiser l'adresse mail de facturation si elle n'existe pas au momant de la création par l'adresse mail principale if(id==null){ String mail = null; try { mail = (String) Enterprise.getCustomProperty("EntMail_"); if(mail!=null) Enterprise.setCustomProperty("EntBillingMail_",mail); } catch (Exception e) { } } String paysid = ""; if(id == null){ try { paysid = (String) Enterprise.getEntCtrID(); Enterprise.setCustomProperty("EntPaysStruct_",paysid); } catch (Exception e) { } } boolean DISPLAY_PLAQUES = false; try { if(typOrganisation != null){ DISPLAY_PLAQUES = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ETAB")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "HOTEL")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "INSOLIT")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "MAISON")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "AUBERGE")); } } catch (FieldNotInitializedException e) {} if(isCreation){ try { Enterprise.setCustomProperty("EntPlaqueCosseRiz_",new Integer(0)); Enterprise.setCustomProperty("EntPlaqueAlu_",new Integer(0)); } catch (FrontlineException e) { } }else{ try { Enterprise.getCustomProperty("EntPlaqueCosseRiz_"); } catch (FieldNotInitializedException fnie) { Enterprise.setCustomProperty("EntPlaqueCosseRiz_",new Integer(0)); } try { Enterprise.getCustomProperty("EntPlaqueAlu_"); } catch (FieldNotInitializedException fnie) { Enterprise.setCustomProperty("EntPlaqueAlu_",new Integer(0)); } } %> <%-- Mantis 29438: mauvais pays <% if(typoStructID.equalsIgnoreCase(departID)) { if(regiondedepartementID != null) { %> <%} else {%> <%} if(paysderegionID != null) {%> <%} else {%> <%}%> <%} %> <% if(typoStructID.equalsIgnoreCase(regionID)) { if(paysderegionID != null) {%> <%} %> <%} %> <% if(typoStructID.equalsIgnoreCase(paysID)) { %> <% } %> <% if(typoStructID.equalsIgnoreCase(departMultiID)) { %> <%} %> --%> <% %> " ou="<%= \"edit_enterprise.fl\" + (id != null ? \"?id=\" + id : \"\")%>" > <%-- --%>
<%-- begin : Adresse --%> <% if(!isAssociation && !isResto && !isPartenaire && !isCabaudit && !isJournaliste && !isPresta){ %> <%-- --%> <% } %> <% if( entRatach != null || (typOrganisation!= null && (typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ETAB")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "HOTEL")))) ) { %> <% } %> <% if(typoStructID.equalsIgnoreCase(departID) || typoStructID.equalsIgnoreCase(regionID) || typoStructID.equalsIgnoreCase(paysID) || typoStructID.equalsIgnoreCase(departMultiID)) { %> <%} else {%> <% if(!isPartenaire){ %> <%}%> <%} %> <% if(isPartenaire){ %> <% } %> <%-- <%-- --%> <%-- --%> <%if(isHotelRestoORMaisonORInsolite){ %> <%}else{ %> <%} %> <%-- Mantis 31710 --%> <%-- <%if(!isAssociation && !isPartenaire) {%> <%} %> --%> <% if(!isAssociation && !isPartenaire) { %> <%-- <% if (typOrganisation == null ) {%> --%> <%-- <%} else if ( (id != null && typOrganisation != null) || (id == null && typOrganisation != null)) {%> <%} %> --%> <%} %> <% if(!isAssociation && !isPartenaire && !isCabaudit && !isJournaliste && !isPresta) { %> <% if(isFournisseurRef){ %> <%} else{%> <%-- --%> <%} %> <% } else if (isPartenaire) {%> <% if (typOrganisation == null ) {%> <%} else if ( (id != null && typOrganisation != null) || (id == null && typOrganisation != null)) {%> <%} %> <%} %>
<%-- --%> <%-- --%>
<%-- --%> <%-- --%>
 
" size="4" style="width: auto;"/> " style="width:100%" />
" name="EntTyeIDVal" readonly>
" name="EntTyeIDVal" readonly>
<% if(isAssociation) { %> <% if( typOrganisation == null ) {%> <%} else if ( (id != null && typOrganisation != null) || (id == null && typOrganisation != null)) {%> <%} %> <%} %> <% if(!isAssociation && !isPartenaire && !isCabaudit && !isJournaliste && !isPresta) { %> <%-- <%if(po_apercuPhotoID != null) { %> <%} else { %> <%} %> --%> <% if(isHotel){ %> <% } else{ %> <%} %> <%-- --%> <%-- --%> <%if(isResto){ %> <%} %> <%-- --%> <% if(DISPLAY_PLAQUES){ %> <%-- --%> <%-- --%> <% } %> <%} else if (isAssociation) {%> <% if(typoStructID.equalsIgnoreCase(departID)) { %> <%-- --%> <%} else if (typoStructID.equalsIgnoreCase(regionID)) {%> <%} else if(typoStructID.equalsIgnoreCase(departMultiID)) { %> <%-- --%> <%} else if(typoStructID.equalsIgnoreCase(paysID)) {%> <%} %> <%} else if (isPartenaire) {%> <%-- --%> <%} %>
" name="EntTyeIDVal" readonly>
<%if(po_apercuPhotoID != null) { %> <%}%>
"/>
Photo Guide 1 - <%= nomPhotoGuide1 %> Photo Guide 2 - <%= nomPhotoGuide2 %>
<%if(po_apercuPhotoID != null) { %> PhotoGuide1 <%} %> <%if(po_apercuPhoto2ID != null) { %> PhotoGuide2 <%} %>
<%if(isPartenaire) {%> <%-- Infos Société --%> ">
<%-- Infos Partenaire --%> ">
<%} else if(isAssociation) {%> <%-- Infos Société --%> ">
<%} else if(!isAssociation && !isPartenaire) {%> <%-- Infos Société --%> ">
<%-- Prestations --%> <%-- ">
--%> <%} %> ">