<%/****************************************************************************** * 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.synchro.SyncUser.SynchroParamType"%> <%@page import="com.edeal.frontline.synchro.googleapps.GoogleAppsConstants.GoogleAppsActorOptions"%> <%@page import="com.edeal.frontline.synchro.SyncUser.EdealActorSynchroParams"%> <%@page import="com.edeal.frontline.synchro.SyncUser"%> <%@page import="java.lang.reflect.Method"%> <%@page import="org.apache.commons.lang.StringUtils"%> <%@page import="java.util.HashMap"%> <%@page import="java.util.Iterator"%> <%@page import="com.edeal.frontline.synchro.webdavex.WebDavExConstants.WebDavExActorSynchroOptions"%> <%@page import="com.edeal.frontline.synchro.webdavex.WebDavExConstants"%> <%@page import="com.edeal.frontline.synchro.domino.DominoConstants.DominoActorSynchroParams"%> <%@page import="com.edeal.frontline.synchro.domino.DominoConstants"%> <%@page import="com.edeal.frontline.synchro.SyncConstants.ExternalSystemType"%> <%@page import="com.edeal.frontline.LicenceManager.LicenceType"%> <%@page import="com.edeal.frontline.synchro.googleapps.GoogleAppsConstants"%> <%@page import="com.edeal.frontline.synchro.exchwebservice.EWSConstants.ExchangeWSActorSynchroOptions"%> <%@page import="com.edeal.frontline.helper.BasicHelper"%> <%@page import="com.edeal.frontline.helper.custom.ActorHelper"%> <%@page import="com.edeal.frontline.helper.ActorBaseHelper"%> <%@ 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.ActorBean" %> <%@ page import="com.edeal.frontline.SalesInvestBean" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.LicenceManager" %> <%@ page import="com.edeal.frontline.SiteBean" %> <%@ page import="com.edeal.frontline.services.cti.CTIServiceClient" %> <%@ page import="com.edeal.frontline.helper.ContextHelper" %> <%@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(); LicenceManager licenceManager = context.getLicenceManager(); String id = null; try { id = Actor.getID(); } catch (FieldNotInitializedException fnie) { } try { Actor.getActEmpSta(); } catch (FieldNotInitializedException fnie) { Actor.setActEmpSta(dico.getRefIdByCode("ActEmpSta", "ACTIF")); } Vector nameCompRef = dico.getRefList(session, "ActCpoID"); Vector valCompRef = dico.getRefList(session, "ActNcoID"); //GET THE COUNTRY OF EACH SITE String actSitID = null; try { actSitID = Actor.getActSitID(); } catch (FieldNotInitializedException e) { } String countryIDForFormatTel = null; String sitIDs = ""; String sitCtrIDs = ""; String[] fields = {"SitID", "SitCtrID"}; Vector vect = SiteBean.listSummary(context, fields); for (int i = 0; i < vect.size(); i++) { Hashtable curCtr = (Hashtable)vect.elementAt(i); String sitID = (String)curCtr.get("SitID"); String idCtr = (String)curCtr.get("SitCtrID"); if (i == 0) { sitIDs += "\"" + sitID + "\""; sitCtrIDs += "\"" + idCtr + "\""; } else { sitIDs += "," + "\"" + sitID + "\""; sitCtrIDs += "," + "\"" + idCtr + "\""; } if (id != null && id.equals(actSitID)) { countryIDForFormatTel = idCtr; } } if (countryIDForFormatTel == null) { countryIDForFormatTel = dico.getRefIdByCode("EntCtrID", "FR"); } String actFirstNameOnFocus = "if (this.value == '" + Utils.getMessage(session, "F611C", true, "") + "') { this.value = ''; }"; String actNameOnFocus = "if (this.value == '" + Utils.getMessage(session, "F611D", true, "") + "') { this.value = ''; }"; String actFirstNameOnBlur = "if (this.value == '" + Utils.getMessage(session, "F611C", true, "") + "') { return true; } if (!this.value) { this.value = '" + Utils.getMessage(session, "F611C", true, "") + "'; } else { this.value = checkString(this.value, 'capitalize'); }"; String actNameOnBlur = "if (this.value == '" + Utils.getMessage(session, "F611D", true, "") + "') { return true; } if (!this.value) { this.value = '" + Utils.getMessage(session, "F611D", true, "") + "'; } else { this.value = checkString(this.value, 'upper'); }"; try { id = Actor.getID(); } catch (FieldNotInitializedException fnie) { } try { Actor.getActName(); } catch (FieldNotInitializedException fnie) { Actor.setActName(Utils.getMessage(session, "F611D", true, "")); } try { Actor.getActFstName(); } catch (FieldNotInitializedException fnie) { Actor.setActFstName(Utils.getMessage(session, "F611C", true, "")); } boolean isSalesInvestActive = SalesInvestBean.isSalesInvestActive(context); if (isSalesInvestActive) { try { Actor.getActCoeffPondComCost(); }catch (FieldNotInitializedException ex){ Actor.setActCoeffPondComCost(1); } } String[] softwareCodes = licenceManager.getLicencedSoftwareCodes(); ActorHelper actHelper = null; try { actHelper = BasicHelper.factory(Actor); } catch (FrontlineException e) { logger.error("Could not get ActorHelper(?!)", e); } HashMap syncOptions = null; try { syncOptions = actHelper.getActSyncOptions(); } catch (FrontlineException fe) { } String syncType; try { syncType = Actor.getActSyncType(); } catch (Exception e) { syncType = ""; } String actSyncType = null; try { actSyncType = dico.getRefCode("ActSyncType", syncType); } catch (Exception e) { } if (actSyncType == null) { syncOptions = new HashMap(); } %> <%-- the ActPwdIsEncrypted field indicates whether the value in field ActPwd is already encrypted or not : the pwd is encrypted if the value comes from the database and has not been changed, the pwd is not encrypted if the value has just been changed --%> " ou="<%= \"/edit_actor.fl\" + (id != null ? \"?id=\" + id : \"\") %>">
 
" autocomplete="off" class="input text" size="30" maxlength="100" >
<% if (context.getAutoDisplayManager().hasEntry("Actor", "Acteur 1")) { %> <% } %> "> ">
<%-- --%>

<% Vector permLics; try { permLics = Actor.getActPermLics(); } catch (FieldNotInitializedException e) { permLics = new Vector(); } Vector flotLics; try { flotLics = Actor.getActFloatLics(); } catch (FieldNotInitializedException e) { flotLics = new Vector(); } String permStr = Utils.getMessage(session, "L6601", "Permanente"); String floatStr = Utils.getMessage(session, "L6602", "Flottante"); String permNAStr = Utils.getMessage(session, "L6603", "Pas des licences permanentes disponible"); String floatNAStr = Utils.getMessage(session, "L6604", "Pas des licences flottantes disponible"); String pattribStr = Utils.getMessage(session, "L6605", "Pas attribuée"); %> <% for (String softCode : softwareCodes) { // Check if the given software is a valid one, meaning it's found in // the licence file and if at least one Perm lics or Float lics in licence file if(licenceManager.availableSoftwareCode(softCode)){ String softName = licenceManager.getLicencedSoftwareName(softCode); String display = (softName == null ? softCode : softName + " (" + softCode + ")"); boolean hasPermLic = permLics.contains(softCode); boolean hasFloatLic = flotLics.contains(softCode); boolean canAddPerm = licenceManager.canAddUser(id, softCode, LicenceManager.LicenceType.PermanentLicence); boolean canAddFloat = licenceManager.canAddUser(id, softCode, LicenceManager.LicenceType.FloatingLicence); %> <% } } %>
<%=display%> " value="pasAttrib"<%=!(hasPermLic || hasFloatLic) ? " checked" : ""%>>_label" for="<%="Lic_" + softCode%>" title="<%=pattribStr%>"><%=pattribStr%> name="<%="Lic_" + softCode%>" value="perm"<%=hasPermLic ? " checked" : ""%>>_label" for="<%="Lic_" + softCode%>" title="<%=canAddPerm ? permStr : permNAStr%>"><%=permStr%> name="<%="Lic_" + softCode%>" value="float"<%=hasFloatLic ? " checked" : ""%>>_label" for="<%="Lic_" + softCode%>" title="<%=canAddFloat ? floatStr : floatNAStr%>"><%=floatStr%>
">
<%-- Insert a CTI tab if there is a known CTI provider that needs specific actor fields. --%> <% CTIServiceClient cti = null; boolean isVocalcomCTI = false; boolean isCCACTI = false; boolean isGenesysCTI = false; boolean isC3TCTI = false; try { cti = (CTIServiceClient)context.getServiceManager().getServiceClient(session, "CTI"); isVocalcomCTI = ("vocalcom".equalsIgnoreCase(cti.getImplementation().getProviderId())); isCCACTI = ("cca".equalsIgnoreCase(cti.getImplementation().getProviderId())); isGenesysCTI = ("genesys".equalsIgnoreCase(cti.getImplementation().getProviderId())); isC3TCTI = ("C3T".equalsIgnoreCase(cti.getImplementation().getProviderId())); } catch (Exception e) { logger.warn("Error in CTI service :\nMessage : " + e.getMessage() + "\nCause : " + e.getCause()); } if (cti != null && isVocalcomCTI) { %>
<% } else if (cti != null && isCCACTI) { %>
<% } else if (cti != null && isGenesysCTI) { %>
<% } else if (cti != null && isC3TCTI) { %>
<%}%> " displayGroup="SERVICE">
<% Vector idValObject = null; Vector idCompObject = null; try { idValObject = Actor.getActNcoID(); } catch (FieldNotInitializedException ex) { idValObject = new Vector(); } try { idCompObject = Actor.getActCpoID(); } catch (FieldNotInitializedException ex) { idCompObject = new Vector(); } String hiddenIdComp = ""; String hiddenValues = ""; for (int i = 0; i < nameCompRef.size(); i++) { Vector currComp = (Vector) nameCompRef.elementAt(i); String currCompID = (String) currComp.elementAt(0); String currCompName = (String) currComp.elementAt(1); int index=idCompObject.indexOf(currCompID); String currObjectValue; try { if (index >= 0) { currObjectValue = (String)idValObject.elementAt(index); } else { currObjectValue = dico.getRefIdByCode("ActNcoID", "ZERO"); } } catch (Exception e) { currObjectValue = "0"; } hiddenIdComp += (i == 0 ? "" : ";" ) + currCompID; hiddenValues += (i == 0 ? "" : ";" ) + currObjectValue; %> <% } %>
"> " > <% if (syncOptions != null) { Iterator iter = syncOptions.keySet().iterator(); while (iter.hasNext()) { Enum key1 = iter.next(); String value1 = StringUtils.defaultIfEmpty(syncOptions.get(key1), ""); String msgCode; String msgCodeDefault; SynchroParamType type1 = null; SynchroParamType type2 = null; try { Method meth = key1.getClass().getMethod("getMsgCode"); msgCode = (String)meth.invoke(key1); } catch (Exception e) { msgCode = "XXXXX"; } try { Method meth = key1.getClass().getMethod("getMsgCodeDefault"); msgCodeDefault = (String)meth.invoke(key1); } catch (Exception e) { msgCodeDefault = "XXXXX"; } try { Method meth = key1.getClass().getMethod("getParamType"); type1 = (SynchroParamType)meth.invoke(key1); } catch (Exception e) { } String msg1 = Utils.getMessage(session, msgCode, msgCodeDefault); Enum key2 = null; String value2 = ""; String msg2 = null; if (iter.hasNext()) { key2 = iter.next(); value2 = StringUtils.defaultIfEmpty(syncOptions.get(key2), ""); try { Method meth = key2.getClass().getMethod("getMsgCode"); msgCode = (String)meth.invoke(key2); } catch (Exception e) { msgCode = "XXXXX"; } try { Method meth = key2.getClass().getMethod("getMsgCodeDefault"); msgCodeDefault = (String)meth.invoke(key2); } catch (Exception e) { msgCodeDefault = "XXXXX"; } try { Method meth = key2.getClass().getMethod("getParamType"); type2 = (SynchroParamType)meth.invoke(key2); } catch (Exception e) { } msg2 = Utils.getMessage(session, msgCode, msgCodeDefault); } %> <% } } %>
" value="<%= value1 %>" class="input text">
<% if (key2 != null) { %> <% } else { %> <% } %>
" value="<%= value2 %>" class="input text">
  
" visible="<%= context.getAutoDisplayManager().hasEntry(\"Actor\", \"Acteur 2\") %>"> " visible="<%= context.getAutoDisplayManager().hasEntry(\"Actor\", \"Acteur 3\") %>">