%@page import="com.edeal.frontline.FrontlineException"%> <%@page import="com.edeal.frontline.BasicBean"%> <%@page session="true" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Map" %> <%@ page import="java.util.Vector" %> <%@ page import="java.util.Hashtable" %> <%@ page import="java.util.Iterator" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.navigation.WebUtils"%> <%@ page import="com.edeal.frontline.DataDictionary"%> <%@ page import="com.edeal.frontline.MessagesBean"%> <%@ page import="com.edeal.frontline.OpportunityBean"%> <%@ page import="com.edeal.frontline.EnterpriseBean"%> <%@ page import="com.edeal.frontline.PersonBean"%> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@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 id = flRequest.getRequestParameterOrAttribute("id"); // il faut rappatrier la LngID String oppEntid = null; String oppPerid = null; String lngId = null; OpportunityBean oppor = new OpportunityBean(id, context); String lngFRId = null; try{ lngFRId = dico.getRefIdByCode("Lna", "Te1", "fr_FR"); }catch(FrontlineException fle){ } try { oppEntid = oppor.getOppEntID(); // on recupère la langue réferente du client Tiers EnterpriseBean ent = new EnterpriseBean(oppEntid, context); try { lngId = (String) ent.getCustomProperty("EntRefLngID_"); // on recupère la langue réferente du client Tiers } catch (FieldNotInitializedException fnie) { oppPerid = oppor.getOppPerID(); PersonBean pers = new PersonBean(oppPerid, context); try{ lngId = (String) pers.getCustomProperty("PerLngRef_"); } catch(FieldNotInitializedException exc){ // FR par défaut lngId = lngFRId; } } } catch (FieldNotInitializedException fnie) { try{ oppPerid = oppor.getOppPerID(); PersonBean pers = new PersonBean(oppPerid, context); try{ lngId = (String) pers.getCustomProperty("PerLngRef_"); } catch(FieldNotInitializedException exc){ // FR par défaut lngId = lngFRId; } } catch(FieldNotInitializedException ex) { lngId = lngFRId; } } String sfwID = flRequest.getRequestParameterOrAttribute("SfwID"); String type = (String)flRequest.getAttribute("type"); String title = (String)flRequest.getAttribute("title"); String typOppDoc = ""; typOppDoc = (String)flRequest.getAttribute("typOppDoc"); String display = (String)flRequest.getAttribute("display"); String mailTo = (String)flRequest.getAttribute("mailTo"); String clientCase = ""; clientCase = (String)flRequest.getAttribute("clientCase"); String docFamily = null; clientCase = flRequest.getParameter("clientCase"); if(clientCase != null && clientCase.equalsIgnoreCase("1")) { try{ docFamily = context.getDataDictionary().getRefIdByCode("Fdc", "Te1", "GUEST"); }catch(Exception e){ } } else if(clientCase != null && clientCase.equalsIgnoreCase("2")) { try{ docFamily = context.getDataDictionary().getRefIdByCode("Fdc", "Te1", "TIERS"); }catch(Exception e){ } } else if(clientCase != null && clientCase.equalsIgnoreCase("3")) { try{ docFamily = context.getDataDictionary().getRefIdByCode("Fdc", "Te1", "TIERS"); }catch(Exception e){ } } //String modelType = "Person".equals(type) ? "MODELE" : "OPPMODELE"; String modelType = "MODELE"; // initialisation du modèle par défaut String code = null; String idModDefaut = ""; String dispModele = ""; String devisDocTyp= null; String commandeDocTyp= null; String factureDocTyp= null; String staciDocTyp= null; String avoirDocTyp = null; try { devisDocTyp = dico.getRefIdByCode("To_", "Te1", "DEV"); commandeDocTyp = dico.getRefIdByCode("To_", "Te1", "ORD"); factureDocTyp = dico.getRefIdByCode("To_", "Te1", "FAC"); avoirDocTyp = dico.getRefIdByCode("To_", "Te1", "AVO"); staciDocTyp = dico.getRefIdByCode("To_", "Te1", "STC"); } catch (Exception e) { devisDocTyp =""; commandeDocTyp =""; factureDocTyp =""; staciDocTyp =""; } if(typOppDoc.equalsIgnoreCase(devisDocTyp)) { code = "DEV"; } else if (typOppDoc.equalsIgnoreCase(commandeDocTyp)) { code = "ORD"; } else if (typOppDoc.equalsIgnoreCase(factureDocTyp)) { code = "FAC"; } else if (typOppDoc.equalsIgnoreCase(staciDocTyp)) { code = "STC"; } else if (typOppDoc.equalsIgnoreCase(avoirDocTyp)) { code = "AVO"; } if(code != null) { if("FAC".equals(code)){ String[] fieldsQuery = {"MsgID", "MsgSubject"}; String sqlQuery = new String("SELECT MsgID, MsgSubject FROM Messages WHERE MsgCode LIKE 'FAC__' AND MsgLngRef = " + Utils.formatToSQL(context, lngId)); String[] orderBy = {"MsgCrDt DESC"}; Vector listRes = BasicBean.listSQL(context, fieldsQuery, sqlQuery); if(listRes != null && !listRes.isEmpty()) { Hashtable tab = (Hashtable)listRes.firstElement(); idModDefaut = (String)tab.get("MsgID"); dispModele = (String)tab.get("MsgSubject"); } else{ if(!lngFRId.equals(lngId)){ sqlQuery = new String("SELECT MsgID, MsgSubject FROM Messages WHERE MsgCode = 'FACFR' "); listRes = BasicBean.listSQL(context, fieldsQuery, sqlQuery); if(listRes != null && !listRes.isEmpty()) { Hashtable tab = (Hashtable)listRes.firstElement(); idModDefaut = (String)tab.get("MsgID"); dispModele = (String)tab.get("MsgSubject"); } } } } else{ String[] fieldsQuery = {"MsgID", "MsgSubject"}; String[][] queryList = {{"MsgCode = '" + code + "'"}}; String[] orderBy = {"MsgCrDt DESC"}; Vector listRes = MessagesBean.listSummary(context, fieldsQuery, queryList); if(listRes != null && !listRes.isEmpty()) { Hashtable tab = (Hashtable)listRes.firstElement(); idModDefaut = (String)tab.get("MsgID"); dispModele = (String)tab.get("MsgSubject"); } } } %> " ou=""> <%= display %> <%= title %> <% if(docFamily != null) {%> " > <%} else { %> " > <%} %> " for="MsgID"> " alt="" class="icon" src="/icons/ico/rechercher.gif"/> " alt="" class="icon" src="/icons/ico/supprimer.gif"/> " alt="" class="icon" src="/icons/ico/importer.gif"/> À ! "> ">