% /****************************************************************************** * 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.custom.*" %> <%@ page import="java.util.*" %> <%@ page import="com.edeal.frontline.*" %> <%@ page import="com.edeal.frontline.process.business.api.ProcessActorRule" %> <%@ page import="com.edeal.frontline.process.business.api.ProcessInstance" %> <%@ page import="com.edeal.frontline.process.business.api.ProcessInstanceStatus" %> <%@ page import="com.edeal.frontline.process.business.api.ProcessRule" %> <%@ page import="com.edeal.frontline.process.business.api.ProcessRuleManager" %> <%@ page import="com.edeal.frontline.helper.custom.ProcessHelper" %> <%@ 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(); boolean fHasRightSupp = false; String id=null; try { id = Opportunity.getID(); } catch (FieldNotInitializedException e) { id = null; } String entID = null; try { entID = Opportunity.getOppEntID(); } catch (FieldNotInitializedException e) { entID = null; } String perID = null; try { perID = Opportunity.getOppPerID(); } catch (FieldNotInitializedException e) { perID = null; } String clientCase = "2"; // 1 pour le Guest , 2 poursTiers, 3 pour Tiers if(perID!=null && entID == null) { clientCase = "1"; } else if (perID == null && entID != null) { clientCase = "2"; } else if (perID != null && entID != null) { clientCase = "3"; } String almID = (String)flRequest.getAttribute("AlmID"); boolean existsAlert = almID != null; String needDetected; try { needDetected = dico.getRefIdByCode("Sto", "Te1", "NEED"); } catch (Exception e) { needDetected = null; } String corrID; try { corrID = dico.getRefIdByCode("IntType_", "COR"); } catch (FieldNotInitializedException e) { corrID = ""; } // Détecter statut de l'opportunité String statutID; try { statutID = Opportunity.getOppStoID(); } catch (FieldNotInitializedException e) { statutID = null; } boolean isValid = false; try { isValid = ((Boolean)Opportunity.getCustomProperty("OppIsValidated_")).booleanValue(); } catch (FieldNotInitializedException e) { isValid = false; } String OppExportFlag_ = ""; boolean isExport = false; try { OppExportFlag_ = (String)Opportunity.getCustomProperty("OppExportFlag_").toString(); } catch (FieldNotInitializedException e) { OppExportFlag_ = ""; } if(OppExportFlag_.equals("") || OppExportFlag_.equals("0")){ isExport=true; }else{ isExport=false; } // expédition validée ou pas? boolean isValidEtiq = false; try { isValidEtiq = ((Boolean)Opportunity.getCustomProperty("OppValidEtiq_")).booleanValue(); } catch (FieldNotInitializedException e) { isValidEtiq = false; } // ramener les ids des 4 statuts de l'opportunité String devisState; String devrefState; String commandeState; String factureState; String avoirState; String typoStasi; try { devisState = dico.getRefIdByCode("Sto", "Te1", "DEV"); devrefState = dico.getRefIdByCode("Sto", "Te1", "DEVREF"); commandeState = dico.getRefIdByCode("Sto", "Te1", "ORD"); factureState = dico.getRefIdByCode("Sto", "Te1", "FAC"); avoirState = dico.getRefIdByCode("Sto", "Te1", "AVO"); typoStasi = dico.getRefIdByCode("Tc_", "Te1", "STASI"); } catch (Exception e) { devisState = null; devrefState = null; commandeState = null; factureState = null; avoirState = null; typoStasi = null; } String devisDocTyp; String commandeDocTyp; String factureDocTyp; String avoirDocTyp; String etiqMasseDocTyp =""; String notifStaciDocTyp =""; String modeMensualite=""; 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"); etiqMasseDocTyp = dico.getRefIdByCode("To_", "Te1", "ETQ"); notifStaciDocTyp = dico.getRefIdByCode("To_", "Te1", "STC"); modeMensualite = dico.getRefIdByCode("Mg_", "Te1", "MS"); } catch (Exception e) { devisDocTyp = null; commandeDocTyp = null; factureDocTyp = null; avoirDocTyp = null; } // If "NEED" doesn't exist for some reason, just take the first one if (needDetected == null) { Vector vect = dico.getRefCodeList("OppStoID"); Vector firstElement = (Vector)vect.firstElement(); needDetected = (String)firstElement.firstElement(); } // Pour ne pas créer d'autres avoirs à partir d'une facture "Avoir" String oppFactAvoir = ""; try { oppFactAvoir = (String) Opportunity.getCustomProperty("OppFactAvoir_"); } catch (FieldNotInitializedException e) { oppFactAvoir ="false"; } String pdfTitle = ""; String mailTitle = ""; String typeOppDocument = ""; String courrierTitle = ""; boolean isEcheancier=false; if((statutID != null) && (statutID.equalsIgnoreCase(devisState))) { pdfTitle ="LF158"; mailTitle = "FF1F9"; typeOppDocument = devisDocTyp; courrierTitle = "LF15B"; OpportunityBean opp = new OpportunityBean(id,context); String titleOpp = opp.getOppTitle(); if(titleOpp.contains("Echéancier")){ isEcheancier=true; } } else if ((statutID != null) && (statutID.equalsIgnoreCase(commandeState))) { pdfTitle ="LF159"; mailTitle = "FF1FA"; typeOppDocument = commandeDocTyp; courrierTitle = "LF15C"; } else if ((statutID != null) && (statutID.equalsIgnoreCase(factureState))) { pdfTitle ="LF15A"; mailTitle = "FF1FB"; typeOppDocument = factureDocTyp; courrierTitle = "LF15D"; /* if (oppFactAvoir.equalsIgnoreCase("true")){ pdfTitle ="LF234"; mailTitle = "LF235"; courrierTitle = "LF236"; typeOppDocument = avoirDocTyp; } */ } else if ((statutID != null) && (statutID.equalsIgnoreCase(avoirState))) { if (oppFactAvoir.equalsIgnoreCase("true")){ pdfTitle ="LF234"; mailTitle = "LF235"; courrierTitle = "LF236"; typeOppDocument = avoirDocTyp; } } String oppTypo = null; boolean isCmdStasi = false; try { oppTypo = (String) Opportunity.getCustomProperty("OppCmdTypo_"); if (oppTypo.equalsIgnoreCase(typoStasi)) isCmdStasi = true; } catch (FieldNotInitializedException e) { } String title = null; boolean isDevEcheancier = false; try { title = (String) Opportunity.getOppTitle(); if (title.contains("Echéancier")) isDevEcheancier = true; } catch (FieldNotInitializedException e) { } boolean isNotifierStaci = false; try { int notifInt = (Integer)Opportunity.getCustomProperty("OppNotificationFournEns_"); if(notifInt == 1){ isNotifierStaci = true; } //isNotifierStaci = ((Boolean)Opportunity.getCustomProperty("OppSTACINotification_")).booleanValue(); } catch (FieldNotInitializedException e) { isNotifierStaci = false; } //permetre au rôle admin et ... de pouvoir supprimer String actID = null; if (session != null) { actID = (String)session.getAttribute("effectiveActorID"); if (actID == null) { actID = (String)session.getAttribute("actorID"); if (actID == null) { throw new FrontlineException("there is not an actor ID in session"); } } } try { ActorBean act = new ActorBean(actID, context); Vector actRolesIDs = new Vector(); actRolesIDs.addAll(act.getRoles()); String roleADMID = dico.getRefIdByCode("ActRoles", "ADMIN"); /* Role Administrateur*/ String roleTECHADMID = dico.getRefIdByCode("ActRoles", "S_ADM_TECH"); /* Role Administrateur Technique*/ String roleA_RESP_ADM_FIN = dico.getRefIdByCode("ActRoles", "A_RESP_ADM_FIN"); /* Role charge web*/ for (int i = 0; i < actRolesIDs.size(); i++) { String actRoleIDactuel = actRolesIDs.get(i).toString(); if( (actRoleIDactuel.equalsIgnoreCase(roleADMID) ) ) { fHasRightSupp = true; } else if (actRoleIDactuel.equalsIgnoreCase(roleTECHADMID)){ fHasRightSupp = true; } else if (actRoleIDactuel.equalsIgnoreCase(roleA_RESP_ADM_FIN)){ fHasRightSupp = true; } } } catch (Exception e) { } %> <%-- " href="javascript:doWord('','Opportunity','Word');"> "> " href="javascript:doWord('','Opportunity', 'PDF');"> "> --%> <%if(isEcheancier){ %> ','Opportunity', 'PDF', '<%=typeOppDocument%>', '<%=clientCase%>');"/> " alt="Visualiser le PDF"/>" title=""> <%}else{ %> ','Opportunity', 'PDF', '<%=typeOppDocument%>', '<%=clientCase%>');"/> " alt="Visualiser le PDF"/>" title=""> <%} %> <%if(!isEcheancier){ %> " alt="Visualiser le PDF"/>" title=""> "/>"> " alt="Envoyer le Courrier"/>" title=""> <% } %> <% if((statutID != null) && (!isValid)){ %> <%if(isExport){ %> "/>"> <%} %> <%if(fHasRightSupp){ %> <% } } %> &IntType_=<%= corrID %>&initIntOppID=<%= id %>"> + <% if (!existsAlert) { %> <% } else { %> <% } %> <% if((statutID != null) && (statutID.equalsIgnoreCase(devisState)) && !isEcheancier) { %> "/>"> <%} else if((statutID != null) && (statutID.equalsIgnoreCase(commandeState))) { %> <% if(isNotifierStaci && isCmdStasi) { %> " title=""> <%} %> "/>"> " title=""> <% if (!isValidEtiq) {%> <%} else { %> <%} %> <% if (!isValidEtiq) { %> "/>"> <%} %> <%} else if((statutID != null) && (statutID.equalsIgnoreCase(factureState)) && (!oppFactAvoir.equalsIgnoreCase("true"))) { %> <% if(isValid){ %> &initOppFactAvoir_=true&initOppRefFact_=<%=id%>&initOppStoID=<%= avoirState %>"> <% } %> <% if(!isValid){ %> "/>"> <%}} %>
+