%
/******************************************************************************
* 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();
String id;
try {
id = Opportunity.getID();
} catch (FieldNotInitializedException e) {
id = null;
}
String entID;
try {
entID = Opportunity.getOppEntID();
} catch (FieldNotInitializedException e) {
entID = null;
}
String perID;
try {
perID = Opportunity.getOppPerID();
} catch (FieldNotInitializedException e) {
perID = null;
}
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;
}
// 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 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");
typoStasi = dico.getRefIdByCode("Tc_", "Te1", "STASI");
} catch (Exception e) {
devisState = null;
devrefState = null;
commandeState = null;
factureState = null;
typoStasi = null;
}
String devisDocTyp;
String commandeDocTyp;
String factureDocTyp;
String etiqMasseDocTyp ="";
String notifStaciDocTyp ="";
try {
devisDocTyp = dico.getRefIdByCode("To_", "Te1", "DEV");
commandeDocTyp = dico.getRefIdByCode("To_", "Te1", "ORD");
factureDocTyp = dico.getRefIdByCode("To_", "Te1", "FAC");
etiqMasseDocTyp = dico.getRefIdByCode("To_", "Te1", "ETQ");
notifStaciDocTyp = dico.getRefIdByCode("To_", "Te1", "STC");
} catch (Exception e) {
devisDocTyp = null;
commandeDocTyp = null;
factureDocTyp = 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 = null;
try {
oppFactAvoir = (String) Opportunity.getCustomProperty("OppFactAvoir_");
} catch (FieldNotInitializedException e) {
oppFactAvoir ="false";
}
String pdfTitle = "";
String mailTitle = "";
String typeOppDocument = "";
String courrierTitle = "";
if((statutID != null) && (statutID.equalsIgnoreCase(devisState))) {
pdfTitle ="LF158";
mailTitle = "FF1F9";
typeOppDocument = devisDocTyp;
courrierTitle = "LF15B";
} 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";
}
String oppTypo = null;
boolean isCmdStasi = false;
try {
oppTypo = (String) Opportunity.getCustomProperty("OppCmdTypo_");
if (oppTypo.equalsIgnoreCase(typoStasi)) isCmdStasi = true;
} catch (FieldNotInitializedException e) {
}
boolean isNotifierStaci = false;
try {
isNotifierStaci = ((Boolean)Opportunity.getCustomProperty("OppSTACINotification_")).booleanValue();
} catch (FieldNotInitializedException e) {
isNotifierStaci = false;
}
%>
|
<%--
" href="javascript:doWord(' ','Opportunity','Word');">
">
" href="javascript:doWord(' ','Opportunity', 'PDF');">
">
--%>
|
|
|
','Opportunity', 'PDF', '<%=typeOppDocument%>');"/>
" alt="Visualiser le PDF"/>" title=" ">
|
|
|
|
|
|
" alt="Visualiser le PDF"/>" title=" ">
|
|
|
|
|
|
|
|
|
|
|
<% if((statutID != null) && (!isValid)){ %>
|
|
|
|
|
|
|
|
|
|
|
|
<%} %>
|
&IntType_=<%= corrID %>&initIntOppID=<%= id %>">
+
|
|
|
|
|
<% if (!existsAlert) { %>
|
|
|
<% } else { %>
|
|
|
<% } %>
|
|
|
<% if((statutID != null) && (statutID.equalsIgnoreCase(devisState))) { %>
|
|
|
|
|
|
<%} else if((statutID != null) && (statutID.equalsIgnoreCase(commandeState))) { %>
<% if(isNotifierStaci && isCmdStasi) { %>
|
" title=" ">
|
|
|
|
|
<%} %>
|
|
|
|
|
|
|
','Opportunity', 'PDF', '<%=etiqMasseDocTyp%>');"/>
" title=" ">
<% if (!isValidEtiq) {%>
<%} else { %>
<%} %>
|
|
|
|
|
<% if (!isValidEtiq) { %>
|
|
|
<%} %>
<%} else if((statutID != null) && (statutID.equalsIgnoreCase(factureState)) && (!oppFactAvoir.equalsIgnoreCase("true"))) { %>
<% if(isValid){ %>
|
&initOppFactAvoir_=true&initOppStoID=<%= factureState %>">
|
|
<% } %>
<% if(!isValid){ %>
|
|
|
<%}} %>