<% /****************************************************************************** * Copyright (c) 2000-2004 e-Deal * * e-Deal S.A. * 55 rue Brillat Savarin * 75013 Paris * France * * T: +33 (0)1 53 80 80 30 * 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" import="com.edeal.frontline.*,java.util.*"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@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 dbVendor = context.getContextParameter("DatabaseVendor"); boolean isOracle = "oracle".equalsIgnoreCase(dbVendor); boolean isDB2 = "IBM DB2".equalsIgnoreCase(dbVendor); Vector vectURL = new Vector(); int nb = 0; Vector vectCorQuery = new Vector(); Vector vectActQuery = new Vector(); String oppQuery = new String(); String str = null; if((str = Utils.getRequestParameter(context, request, "nb")) != null && !"".equals(str.trim())) { try { nb = Integer.parseInt(str); } catch (Throwable ex) { } } if((str = Utils.getRequestParameter(context, request, "perID")) != null && !"".equals(str.trim())) { vectCorQuery.addElement("CorPerID = " + Utils.formatToSQL(context, str.trim())); vectURL.addElement("PerID=" + str.trim()); } if((str = Utils.getRequestParameter(context, request, "EntID")) != null && !"".equals(str.trim())) { vectCorQuery.addElement("CorEntID = " + Utils.formatToSQL(context, str.trim())); vectURL.addElement("EntID=" + str.trim()); } if((str = Utils.getRequestParameter(context, request, "JouID")) != null && !"".equals(str.trim())) { vectCorQuery.addElement("CorJouID = " + Utils.formatToSQL(context, str.trim())); vectURL.addElement("JouID=" + str.trim()); } if((str = Utils.getRequestParameter(context, request, "SupID")) != null && !"".equals(str.trim())) { vectCorQuery.addElement("CorSupID = " + Utils.formatToSQL(context, str.trim())); vectURL.addElement("SupID=" + str.trim()); } if((str = Utils.getRequestParameter(context, request, "ActID")) != null && !"".equals(str.trim())) { vectCorQuery.addElement("MvaText = " + Utils.formatToSQL(context, str.trim())); vectURL.addElement("ActID=" + str.trim()); } if((str = Utils.getRequestParameter(context, request, "OppID")) != null && !"".equals(str.trim())) { oppQuery = "IntOppID = " + Utils.formatToSQL(context, str.trim()); vectURL.addElement("OppID=" + str.trim()); } String strQuery = "SELECT DISTINCT IntID, IntStiID, IntDate, IntAtvID, IntSubject, " + (isDB2 ? "''" : "IntDetails") + ", IntPlace \n" + "FROM Interaction "; if(!vectCorQuery.isEmpty()) strQuery += ", MvaIntCorID mCor, Correspondent"; if(!vectActQuery.isEmpty()) strQuery += ", MvaIntActID mAct"; strQuery += "\n"; if(!vectCorQuery.isEmpty() || !vectActQuery.isEmpty() || !"".equals(oppQuery)) { strQuery += "WHERE "; boolean firstClause = true; if(!vectCorQuery.isEmpty()) { if (!firstClause) strQuery += "AND "; strQuery += "mCor.MvaColID = IntID\n" + " AND CorID = mCor.MvaText\n" + " AND " + Utils.implodeList(vectCorQuery, "\n AND ") + "\n"; firstClause = false; } if(!vectActQuery.isEmpty()) { if (!firstClause) strQuery += "AND "; strQuery += "mAct.MvaColID = IntID\n" + " AND " + Utils.implodeList(vectCorQuery, "\n AND ") + "\n"; firstClause = false; } if (!"".equals(oppQuery)) { if (!firstClause) strQuery += "AND "; strQuery += oppQuery + "\n"; firstClause = false; } } strQuery += "ORDER BY IntDate DESC"; Vector vectObjs = BasicBean.listSQL(context, new String[]{"IntID", "IntStiID", "IntDate", "IntAtvID", "IntSubject", "IntDetails", "IntPlace"}, strQuery, 0, nb); %>
<% } %> <% if(vectObjs != null && !vectObjs.isEmpty()) { ObjectsBean actBean = dico.getTable("sql", "Actor"); ObjectsBean perBean = dico.getTable("sql", "Person"); ObjectsBean entBean = dico.getTable("sql", "Enterprise"); ObjectsBean jouBean = dico.getTable("sql", "Journalist"); ObjectsBean supBean = dico.getTable("sql", "Support"); java.sql.Connection cx = null; java.sql.PreparedStatement pstmtAttID = null; java.sql.PreparedStatement pstmtActID = null; java.sql.PreparedStatement pstmtCorID = null; try { cx = context.getConnection(); String attIDQuery = Utils.formatPreparedStatementQueryForUnicode(context, "SELECT MvaText FROM MvaIntAttID WHERE MvaColID = ?", new int[]{1}); pstmtAttID = cx.prepareStatement(attIDQuery); String actIDQuery = Utils.formatPreparedStatementQueryForUnicode(context, "SELECT ActID, ActCivID, ActFstName,ActName FROM MvaIntActID, Actor WHERE MvaColID = ? AND ActID = MvaText", new int[]{1}); pstmtActID = cx.prepareStatement(actIDQuery); String corQuery = ""; if (isOracle) { corQuery = "SELECT PerID, PerCivID, PerFstName, PerName, EntID, EntCorpName, SupID, SupTitle, JouID, JouCivID, JouFstName, JouName "; corQuery += "FROM MvaIntCorID, Correspondent, Person, Enterprise, Journalist, Support "; corQuery += "WHERE MvaText = CorID (+) AND CorPerID = PerID (+) AND CorEntID = EntID (+) AND CorJouID = JouID (+) AND CorSupID = SupID (+) "; corQuery += "AND MvaColID = ? "; corQuery += "ORDER BY EntCorpName, PerName, PerFstName, SupTitle, JouName, JouFstName"; } else { corQuery = "SELECT PerID, PerCivID, PerFstName, PerName, EntID, EntCorpName, SupID, SupTitle, JouID, JouCivID, JouFstName, JouName "; corQuery += "FROM MvaIntCorID LEFT OUTER JOIN Correspondent ON MvaText = CorID "; corQuery += "LEFT OUTER JOIN Person ON PerID = CorPerID "; corQuery += "LEFT OUTER JOIN Enterprise ON EntID = CorEntID "; corQuery += "LEFT OUTER JOIN Journalist ON JouID = CorJouID "; corQuery += "LEFT OUTER JOIN Support ON SupID = CorSupID "; corQuery += "WHERE MvaColID = ? "; corQuery += "ORDER BY EntCorpName, PerName, PerFstName, SupTitle, JouName, JouFstName"; } pstmtCorID = cx.prepareStatement(Utils.formatPreparedStatementQueryForUnicode(context, corQuery, new int[]{1})); for (int i = 0; i < vectObjs.size(); i++) { Hashtable row = (Hashtable)vectObjs.elementAt(i); String strIntID = (String)row.get("IntID"); String intAtvID = (String)row.get("IntAtvID"); Date IntDate = (Date)row.get("IntDate"); String subject = (String)row.get("IntSubject"); String strStiID = (String)row.get("IntStiID"); String formatIntSubject = ""; if(subject != null){ formatIntSubject = Utils.formatToWeb(session,subject,false) + " - "; } String formatIntDate = Utils.formatToWeb(session,IntDate,false,"dd/MM/yyyy"); String elastic = ""; String afterElastic = ""; String formatIntAtvID = ""; if(intAtvID != null){ formatIntAtvID = Utils.formatToWeb(session,(String)dico.getRefCode("IntAtvID",intAtvID),false) + " - "; } String formatDone = ""; if(strStiID != null && dico.getRefIdByCode("IntStiID", "DONE").equals(strStiID)){ formatDone = Utils.getMessage(session, "A3020", "Fait"); } else { formatDone = Utils.getMessage(session, "A3009", "A faire"); } %> <% } } catch (Exception ex) { logger.error("[/sales/interaction/embedded_list.jsp] " + ex.getClass().getName() + " : " + ex.getMessage()); logger.error("STACK TRACE",ex); } finally { try { pstmtAttID.close(); } catch (Exception ex) {} try { pstmtActID.close(); } catch (Exception ex) {} try { pstmtCorID.close(); } catch (Exception ex) {} try { cx.close(); } catch (Exception ex) {} } } %>

  <% if (Utils.getRequestParameter(context, request, "perID") != null ) { %> " style="text-decoration:none;">[+]

> <%= formatIntDate %> - <%= formatIntSubject %> <%= formatIntAtvID %> <%= formatDone %>
<% /****************************************************************************** * CVS Log File - This is no longer maintained! * * Revision 1.2 2004/10/20 16:16:37 raphael * Correction des libellés * * Revision 1.1 2004/07/23 18:20:05 brian * Initial Revision * *****************************************************************************/ %>