first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
115
rus/WEB-INF/lib/ravinale_src/ImportArticoliPresta.java
Normal file
115
rus/WEB-INF/lib/ravinale_src/ImportArticoliPresta.java
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
import com.ablia.anag.ListinoArticolo;
|
||||
import com.ablia.art.Articolo;
|
||||
import com.ablia.art.ArticoloVariante;
|
||||
import com.ablia.db.ApplParm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.util.DbConsole;
|
||||
import com.ablia.util.StringTokenizer;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
|
||||
public class ImportArticoliPresta extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
ImportArticoliXls bean = new ImportArticoliXls();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost";
|
||||
String db = "ravinale";
|
||||
String fileCsv = "/Users/acolzi/Documents/_ablia/work/ravinale/www/admin/_alterTable/elencoArticoliPresta.csv";
|
||||
boolean importArticoli = false;
|
||||
String temp = "";
|
||||
temp = getCi().readLine("importArticoli(" + importArticoli + "):");
|
||||
if (!temp.isEmpty())
|
||||
importArticoli = temp.equals("y");
|
||||
ApplParmFull ap = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
||||
ap.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
int numBanche = 0, numClienti = 0;
|
||||
if (importArticoli) {
|
||||
i = 0;
|
||||
System.out.println("\nimportArticoli");
|
||||
Articolo articolo = new Articolo(ap);
|
||||
BufferedReader reader = new BufferedReader(new FileReader(fileCsv));
|
||||
if (reader != null) {
|
||||
int numbToken = 0;
|
||||
int colname = 2, colNomeArticolo = 3, colid_tipo = 8, colprice = 9, colreference = 12, coldescription_short = 14;
|
||||
int coldescription = 15, colmeta_title = 16, colmeta_description = 18;
|
||||
StringBuffer currentArticolo = new StringBuffer();
|
||||
reader.readLine();
|
||||
reader.readLine();
|
||||
String currentLine;
|
||||
while ((currentLine = reader.readLine()) != null) {
|
||||
StringTokenizer st = new StringTokenizer(currentLine, ";");
|
||||
String name = st.getToken(colname);
|
||||
String nomeArticolo = st.getToken(colNomeArticolo);
|
||||
String nomeVariante = name.replace(nomeArticolo, "");
|
||||
String id_tipo = st.getToken(colid_tipo);
|
||||
String price = st.getToken(colprice);
|
||||
String reference = st.getToken(colreference);
|
||||
String description_short = st.getToken(coldescription_short);
|
||||
String description = st.getToken(coldescription);
|
||||
String meta_title = st.getToken(colmeta_title);
|
||||
String meta_description = st.getToken(colmeta_description);
|
||||
if (reference.isEmpty())
|
||||
continue;
|
||||
String codiceArticolo = reference.substring(0, 6);
|
||||
String codiceVariante = reference.substring(6);
|
||||
articolo = new Articolo(ap);
|
||||
articolo.findArticoloByCodice(codiceArticolo);
|
||||
if (articolo.getDBState() == 0) {
|
||||
articolo.setCodice(codiceArticolo);
|
||||
if (nomeArticolo.isEmpty()) {
|
||||
articolo.setNome(name);
|
||||
} else {
|
||||
articolo.setNome(nomeArticolo);
|
||||
}
|
||||
articolo.setId_tipo(Long.valueOf(id_tipo).longValue());
|
||||
articolo.setMetaTag(meta_title);
|
||||
articolo.setMetaDesc(meta_description);
|
||||
articolo.setId_iva(1L);
|
||||
articolo.setDescTxtLang("descrizione", "it", description);
|
||||
articolo.setDescTxtLang("descrizioneCommerciale", "it", description_short);
|
||||
ResParm rp = articolo.save();
|
||||
if (rp.getStatus()) {
|
||||
ListinoArticolo listinoArticoloBase = articolo.getListinoArticoloBase();
|
||||
listinoArticoloBase.setId_articolo(articolo.getId_articolo());
|
||||
listinoArticoloBase.setId_listino(articolo.getListinoBase().getId_listino());
|
||||
listinoArticoloBase.setPrezzoConIvaLA(Double.parseDouble(price));
|
||||
rp = listinoArticoloBase.save();
|
||||
}
|
||||
}
|
||||
ArticoloVariante av = new ArticoloVariante(ap);
|
||||
av.findArticoloVarianteByCodiceVariante(reference);
|
||||
if (av.getDBState() == 0) {
|
||||
av.setId_articolo(articolo.getId_articolo());
|
||||
av.setCodiceVariante(reference);
|
||||
av.setNomeV(nomeVariante);
|
||||
av.setDescTxtLang("descrizioneV", "it", description_short);
|
||||
ResParm rp = av.save();
|
||||
if (rp.getStatus()) {
|
||||
av.setDescTxtLang("descrizione", "it", description);
|
||||
av.setDescTxtLang("descrizioneCommerciale", "it", description_short);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println(String.valueOf(i) + " / ");
|
||||
}
|
||||
}
|
||||
System.out.println("fine ciclo \n\n\n\n\n\n\n\n\n\n\n" + msg.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
rus/WEB-INF/lib/ravinale_src/META-INF/MANIFEST.MF
Normal file
2
rus/WEB-INF/lib/ravinale_src/META-INF/MANIFEST.MF
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Manifest-Version: 1.0
|
||||
|
||||
|
|
@ -0,0 +1,541 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.anag.Cliente;
|
||||
import com.ablia.anag.Clifor;
|
||||
import com.ablia.anag.DestinazioneDiversa;
|
||||
import com.ablia.anag.Nazione;
|
||||
import com.ablia.anag.TipoPagamento;
|
||||
import com.ablia.art.Articolo;
|
||||
import com.ablia.art.ArticoloTaglia;
|
||||
import com.ablia.art.ArticoloVariante;
|
||||
import com.ablia.cart.AcCartObject;
|
||||
import com.ablia.cart.Cart;
|
||||
import com.ablia.cart.CartItem;
|
||||
import com.ablia.common.Users;
|
||||
import com.ablia.contab.Documento;
|
||||
import com.ablia.contab.DocumentoCR;
|
||||
import com.ablia.contab.DocumentoInterface;
|
||||
import com.ablia.contab.RigaDocumento;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.servlet.SavedHttpRequest;
|
||||
import com.ablia.util.AbMessages;
|
||||
import com.ablia.util.CodiceFiscale;
|
||||
import com.ablia.util.DoubleOperator;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.sql.Date;
|
||||
import java.util.Enumeration;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
public class CartSvlt extends com.ablia.www.servlet.CartSvlt {
|
||||
private static final long serialVersionUID = -1138852541428884366L;
|
||||
|
||||
protected void afterAddItem(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
if (getCal(req).equals("list")) {
|
||||
req.setAttribute("cmd", "search");
|
||||
req.setAttribute("act", "listaArticoli");
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/Catalogo.abl");
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} else {
|
||||
req.setAttribute("cmd", "md");
|
||||
req.setAttribute("act", "");
|
||||
req.setAttribute("id_articoloColore", getRequestParameter(req, "id"));
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/Catalogo.abl");
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void afterCheckCart(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative("cart.jsp", req);
|
||||
try {
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void afterCheckOut(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Cart cart = getCart(req);
|
||||
req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req)));
|
||||
req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req)).findPagamentiWww(cart.getFlgPickup()));
|
||||
setJspPageRelative("checkOut.jsp", req);
|
||||
try {
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void afterDeleteCart(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative("index.jsp", req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void afterDeleteItem(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
checkCart(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void afterModifyItems(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
checkCart(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCheckCartJspPage(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String getCheckOutJspPage(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String getDeleteItemJspPage(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String getModifyItemJspPage(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Users getUser(HttpServletRequest req) {
|
||||
ApplParmFull apFull = getApFull();
|
||||
return new com.ablia.anag.Users(apFull);
|
||||
}
|
||||
|
||||
protected void afterOrderRecorded(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long id_clifor = getRequestLongParameter(req, "id_clifor");
|
||||
forceJspPageRelative("documento.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected ResParm sendLostPasswordMessage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return super.sendLostPasswordMessage(req, res);
|
||||
}
|
||||
|
||||
protected boolean checkAvailability(HttpServletRequest req) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void logOn(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
try {
|
||||
String jspPage = "/checkOut.jsp";
|
||||
if (jspPage.isEmpty())
|
||||
jspPage = getJspHomePage(req);
|
||||
if (!getLogin(req).isEmpty())
|
||||
if (checkLoginName(req, res) == 5L) {
|
||||
if (isFirstAccess(req)) {
|
||||
SavedHttpRequest shr = (SavedHttpRequest)req.getSession().getAttribute("savedHttpRequest");
|
||||
if (shr == null) {
|
||||
shr = new SavedHttpRequest();
|
||||
shr.setCompleteRequestedURI(req.getRequestURI());
|
||||
shr.setServletPath(req.getServletPath());
|
||||
shr.setAllParametersNAttributes(req);
|
||||
req.getSession().setAttribute("savedHttpRequest", shr);
|
||||
}
|
||||
forceJspPageRelative(getCheckCCPage(), req);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} else {
|
||||
HttpSession session = req.getSession();
|
||||
com.ablia.anag.Users users = (com.ablia.anag.Users)session.getAttribute("utenteLogon");
|
||||
if (users.getId_clifor() != 0L) {
|
||||
DocumentoCR CR = new DocumentoCR();
|
||||
CR.setId_clifor(users.getId_clifor());
|
||||
req.setAttribute("list", new Documento(apFull).findByCR(CR, 0, 0));
|
||||
}
|
||||
req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req)));
|
||||
req.setAttribute("listaTipoPagamento",
|
||||
new TipoPagamento(getApFull(req)).findPagamentiWww(getCart(req).getFlgPickup()));
|
||||
getCart(req);
|
||||
String thePage = getRequestParameter(req, "thePage");
|
||||
if (thePage.isEmpty()) {
|
||||
setJspPageRelative(jspPage, req);
|
||||
} else {
|
||||
setJspPageRelative(thePage, req);
|
||||
}
|
||||
callJsp(req, res);
|
||||
}
|
||||
} else {
|
||||
sendMessage(req, AbMessages.getMessage(getLang(req), "LOGIN_FAIL"));
|
||||
String thePage = getRequestParameter(req, "thePage");
|
||||
if (thePage.isEmpty()) {
|
||||
setJspPageRelative(jspPage, req);
|
||||
} else {
|
||||
setJspPageRelative(thePage, req);
|
||||
}
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.getMessage());
|
||||
setJspPageRelative(getCal(req), req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public AcCartObject getCartObject(HttpServletRequest req) throws Exception {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String l_id = getRequestParameter(req, "id");
|
||||
long l_id_articolo = 0L, l_id_articoloVariante = 0L, l_id_articoloTaglia = 0L;
|
||||
if (!l_id.isEmpty()) {
|
||||
if (l_id.indexOf("av_") >= 0) {
|
||||
l_id_articoloVariante = Long.parseLong(l_id.substring(3));
|
||||
req.setAttribute("id_articoloVariante", Long.valueOf(l_id_articoloVariante));
|
||||
} else {
|
||||
l_id_articolo = Long.parseLong(l_id);
|
||||
req.setAttribute("id_articolo", Long.valueOf(l_id_articolo));
|
||||
}
|
||||
} else {
|
||||
l_id_articolo = getRequestLongParameter(req, "id_articolo");
|
||||
l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante");
|
||||
l_id_articoloTaglia = getRequestLongParameter(req, "id_articoloTaglia");
|
||||
}
|
||||
double l_quantity = getRequestDoubleParameter(req, "qt");
|
||||
if (l_quantity == 0.0D)
|
||||
l_quantity = 1.0D;
|
||||
if (l_id_articoloTaglia > 0L) {
|
||||
ArticoloTaglia at = new ArticoloTaglia(apFull);
|
||||
at.findByPrimaryKey(l_id_articoloTaglia);
|
||||
if (at.getQuantitaAtByMagFisico(1L) > 0.0D) {
|
||||
req.setAttribute("bean", at.getArticoloVariante());
|
||||
AcCartObject acCartObject = new AcCartObject(ArticoloTaglia.class, at.getItemId(), l_quantity);
|
||||
return acCartObject;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (l_id_articoloVariante > 0L) {
|
||||
ArticoloVariante av = new ArticoloVariante(apFull);
|
||||
av.findByPrimaryKey(l_id_articoloVariante);
|
||||
if (av.getQuantitaAvByMagFisico(1L) > 0.0D) {
|
||||
req.setAttribute("bean", av);
|
||||
AcCartObject acCartObject = new AcCartObject(ArticoloVariante.class, av.getItemId(), l_quantity);
|
||||
return acCartObject;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Articolo bean = new Articolo(apFull);
|
||||
bean.findByPrimaryKey(l_id_articolo);
|
||||
req.setAttribute("bean", bean);
|
||||
AcCartObject aco = new AcCartObject(Articolo.class, bean.getItemId(), l_quantity);
|
||||
return aco;
|
||||
}
|
||||
|
||||
protected ResParm recordOrder(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ResParm rp = new ResParm(true);
|
||||
synchronized (this) {
|
||||
try {
|
||||
System.out.println("record ORDINE ----------------------------");
|
||||
Cart cart = getCart(req);
|
||||
if (rp.getStatus()) {
|
||||
com.ablia.anag.Users utente = (com.ablia.anag.Users)getLoginUser(req);
|
||||
long l_id_tipoOrdine = getParm("ID_DOC_ORDINE_WWW").getNumeroLong();
|
||||
Documento ordine = new Documento(apFull);
|
||||
ordine.setId_tipoDocumento(l_id_tipoOrdine);
|
||||
ordine.setFlgStato(1L);
|
||||
ordine.setId_clifor(utente.getId_clifor());
|
||||
ordine.setDataDocumento(new Date(new java.util.Date().getTime()));
|
||||
ordine.setNominativoDocumento(utente.getDescrizione());
|
||||
ordine.setFlgRitiroNegozio(cart.getFlgPickup());
|
||||
if (ordine.getClifor().getNazione().getFlgCee() == 1L) {
|
||||
DoubleOperator spese = new DoubleOperator(cart.getMoreCost());
|
||||
spese.add(cart.getDeliveryCost());
|
||||
ordine.setSpeseTrasporto(spese.getResult());
|
||||
ordine.setId_ivaDoc(getParm("CODICE_IVA_STD_VEND").getNumeroLong());
|
||||
} else {
|
||||
DoubleOperator spese = new DoubleOperator(cart.getMoreCostWVat());
|
||||
spese.add(cart.getDeliveryCostWVat());
|
||||
ordine.setSpeseTrasporto(spese.getResult());
|
||||
ordine.setId_ivaDoc(getParm("CODICE_IVA_ART8").getNumeroLong());
|
||||
}
|
||||
if (req.getParameter("note") != null && !req.getParameter("note").equals(""))
|
||||
ordine.setNote(req.getParameter("note"));
|
||||
ordine.setFlgStatoOrdineWww(0L);
|
||||
ordine.setFlgPagata(0L);
|
||||
if (ordine.isOrdineWwwFatturaObbligatoria())
|
||||
ordine.setFlgWwwRichiedeFattura(1L);
|
||||
long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento");
|
||||
if (l_id_tipoPagamento == 0L)
|
||||
l_id_tipoPagamento = 1L;
|
||||
ordine.setId_tipoPagamento(l_id_tipoPagamento);
|
||||
if (getParm(Cart.P_PROCEDI_PAGAMENTO).getNumeroLong() == 1L)
|
||||
ordine.setFlgProcediPagamento(1L);
|
||||
long ckDestinazioneDiversa = getRequestLongParameter(req, "ckDestinazioneDiversa");
|
||||
ckDestinazioneDiversa = 1L;
|
||||
DestinazioneDiversa dd = utente.getClifor().getDestinazioneDiversa(0);
|
||||
if (ckDestinazioneDiversa == 1L && dd.getId_destinazioneDiversa() > 0L) {
|
||||
ordine.setPresso(dd.getPressoDD());
|
||||
ordine.setIndirizzoSped(dd.getIndirizzoDD());
|
||||
ordine.setNumeroCivicoSped(dd.getNumeroCivicoDD());
|
||||
ordine.setCittaSped(dd.getDescrizioneComuneDD());
|
||||
ordine.setProvinciaSped(dd.getProvinciaComuneDD());
|
||||
ordine.setCapSped(dd.getCapComuneDD());
|
||||
System.out.println("Destinazione diversa :" + ordine.getPresso());
|
||||
}
|
||||
rp = ordine.save();
|
||||
Enumeration<CartItem> enu = cart.getItems();
|
||||
while (enu.hasMoreElements()) {
|
||||
CartItem ci = enu.nextElement();
|
||||
if (ci.getQuantity() > 0.0D) {
|
||||
RigaDocumento rigaOrdine = new RigaDocumento(apFull);
|
||||
if (ci.getDbItem() instanceof ArticoloTaglia) {
|
||||
ArticoloTaglia at = (ArticoloTaglia)ci.getDbItem();
|
||||
rigaOrdine.setId_articolo(at.getId_articolo());
|
||||
rigaOrdine.setId_articoloVariante(at.getId_articoloVariante());
|
||||
rigaOrdine.setId_articoloTaglia(at.getId_articoloTaglia());
|
||||
rigaOrdine.setQuantita(ci.getQuantity());
|
||||
rigaOrdine.setPrezzoPubblicoConIva(ci.getPriceWVat(utente.getId_users()));
|
||||
rigaOrdine.setSconto(at.getArticolo().getPrezzoArticolo(ordine.getClifor()).getPercSconto());
|
||||
rigaOrdine.setDescrizioneRiga(String.valueOf(rigaOrdine.getArticoloVariante().getDescrizioneCompleta()) + " - " +
|
||||
rigaOrdine.getArticolo().getDescrizione() + " Taglia " +
|
||||
rigaOrdine.getArticoloTaglia().getTaglia().getCodice());
|
||||
if (ordine.getClifor().getNazione().getFlgCee() == 1L) {
|
||||
rigaOrdine.setId_iva(at.getArticolo().getId_iva());
|
||||
} else {
|
||||
rigaOrdine.setId_iva(getParm("CODICE_IVA_ART8").getNumeroLong());
|
||||
}
|
||||
} else if (ci.getDbItem() instanceof ArticoloVariante) {
|
||||
ArticoloVariante av = (ArticoloVariante)ci.getDbItem();
|
||||
rigaOrdine.setId_articolo(av.getId_articolo());
|
||||
rigaOrdine.setId_articoloVariante(av.getId_articoloVariante());
|
||||
rigaOrdine.setQuantita(ci.getQuantity());
|
||||
rigaOrdine.setPrezzoPubblicoConIva(ci.getPriceWVat(utente.getId_users()));
|
||||
rigaOrdine.setSconto(av.getArticolo().getPrezzoArticolo(ordine.getClifor()).getPercSconto());
|
||||
rigaOrdine.setDescrizioneRiga(String.valueOf(rigaOrdine.getArticoloVariante().getDescrizioneCompleta()) + " - " +
|
||||
rigaOrdine.getArticolo().getDescrizione());
|
||||
if (ordine.getClifor().getNazione().getFlgCee() == 1L) {
|
||||
rigaOrdine.setId_iva(av.getArticolo().getId_iva());
|
||||
} else {
|
||||
rigaOrdine.setId_iva(getParm("CODICE_IVA_ART8").getNumeroLong());
|
||||
}
|
||||
} else {
|
||||
Articolo articolo = (Articolo)ci.getDbItem();
|
||||
rigaOrdine.setId_articolo(articolo.getId_articolo());
|
||||
rigaOrdine.setQuantita(ci.getQuantity());
|
||||
rigaOrdine.setImponibile(articolo.getPrezzoArticolo(ordine.getClifor()).getPrezzoBase());
|
||||
rigaOrdine.setSconto(articolo.getPrezzoArticolo(ordine.getClifor()).getPercSconto());
|
||||
rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta());
|
||||
rigaOrdine.setId_iva(articolo.getId_iva());
|
||||
}
|
||||
rp = Documento.addRigaDocumento((DocumentoInterface)ordine, rigaOrdine);
|
||||
}
|
||||
}
|
||||
ordine.setFlgStato(1L);
|
||||
ordine.setFlgStatoOrdineWww(0L);
|
||||
ordine.setFlgStatoPrenotazione(0L);
|
||||
ordine.setNote("Tel. :" + ordine.getClifor().getTelefono() + " - Email: " + ordine.getClifor().getEMail());
|
||||
rp = ordine.save();
|
||||
if (rp.getStatus())
|
||||
rp = ordine.sendOrderMailMessageRavinale(utente.getLang(), true, true, false);
|
||||
System.out.println("fine record ORDINE ############");
|
||||
if (!rp.getStatus()) {
|
||||
sendMessage(req, "Ordine registrato ma non è stato possibile inviare email di conferma: " + rp.getMsg());
|
||||
rp.setStatus(true);
|
||||
rp.setMsg("Ordine registrato ma non è stato possibile inviare email di conferma: " + rp.getMsg());
|
||||
}
|
||||
req.setAttribute(PROP_ORDER, ordine);
|
||||
req.setAttribute("righeDocumento", ordine.findRigheDocumento(0, 0));
|
||||
TipoPagamento tp = new TipoPagamento(apFull);
|
||||
Vectumerator<TipoPagamento> vec = tp.findPagamentiWww(ordine.getFlgRitiroNegozio());
|
||||
req.setAttribute("listaTipoPagamento", vec);
|
||||
forceJspPageRelative("documento.jsp", req);
|
||||
} else {
|
||||
req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, "CheckOut: record order error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
protected String getJspHomePage(HttpServletRequest req) {
|
||||
return "index.jsp";
|
||||
}
|
||||
|
||||
protected ResParm sendCheckOutMessage(HttpServletRequest req, HttpServletResponse res) {
|
||||
Documento ordine = (Documento)req.getAttribute(PROP_ORDER);
|
||||
ResParm rp = new ResParm(true);
|
||||
if (ordine.getTipoPagamento().getFlgTipoPagamento() == 2L ||
|
||||
ordine.getTipoPagamento().getFlgTipoPagamento() == 3L)
|
||||
rp = ordine.sendOrderMailMessage(getLang(req), true, true, false);
|
||||
return rp;
|
||||
}
|
||||
|
||||
protected double getDeliveryCost(HttpServletRequest req, Cart cart) {
|
||||
double totCart = cart.getTotPriceVAT();
|
||||
if (totCart >= getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble())
|
||||
return 0.0D;
|
||||
double delivCost = 0.0D;
|
||||
com.ablia.anag.Users user = (com.ablia.anag.Users)getLoginUser(req);
|
||||
if (user != null && user.getDBState() == 1) {
|
||||
delivCost = user.getClifor().getNazione().getCostoSpedizione();
|
||||
if (delivCost == 0.0D)
|
||||
delivCost = getParm(Cart.P_DELIVERY_COST).getNumeroDouble();
|
||||
} else {
|
||||
delivCost = getParm(Cart.P_DELIVERY_COST).getNumeroDouble();
|
||||
}
|
||||
return delivCost;
|
||||
}
|
||||
|
||||
public void _aggiornaNazione(HttpServletRequest req, HttpServletResponse res) {
|
||||
com.ablia.anag.Users user = (com.ablia.anag.Users)getLoginUser(req);
|
||||
if (user != null && user.getDBState() == 1) {
|
||||
Clifor clifor = user.getClifor();
|
||||
clifor.setId_nazione(getRequestParameter(req, "id_nazione"));
|
||||
clifor.save();
|
||||
req.setAttribute("cmd", CMD_CHECKOUT);
|
||||
req.setAttribute("act", ATTR_CART);
|
||||
checkOut(req, res);
|
||||
} else {
|
||||
forceJspPage("/index.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getCmd(req).equals("aggiornaNazione")) {
|
||||
_aggiornaNazione(req, res);
|
||||
} else {
|
||||
super.otherCommands(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected ResParm saveUser(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ResParm rp = new ResParm(true);
|
||||
com.ablia.anag.Users bean = (com.ablia.anag.Users)getLoginUser(req);
|
||||
fillObject(req, bean);
|
||||
Cliente cli = new Cliente(apFull);
|
||||
fillObject(req, cli);
|
||||
bean.setClifor((Clifor)cli);
|
||||
String msg = "Impossibile Registrare un nuovo utente:";
|
||||
if (bean.isLogonDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Login già presente in archivio";
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(msg);
|
||||
return rp;
|
||||
}
|
||||
if (bean.isEmailDuplicated()) {
|
||||
com.ablia.anag.Users userMl = new com.ablia.anag.Users(apFull);
|
||||
userMl.findUsersByEmail(bean.getEMail());
|
||||
if (userMl.getId_userProfile() == bean.getIdUserProfileMailingList()) {
|
||||
req.setAttribute("id_users", String.valueOf(userMl.getId_users()));
|
||||
req.setAttribute("flgValido", "S");
|
||||
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
|
||||
rp = saveUserAndClifor(req, res);
|
||||
} else {
|
||||
msg = String.valueOf(msg) + " Email già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} else {
|
||||
if (cli.isCodFiscDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Codice Fiscale già presente in archivio";
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(msg);
|
||||
return rp;
|
||||
}
|
||||
if (cli.isPIvaDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Partita Iva già presente in archivio";
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(msg);
|
||||
return rp;
|
||||
}
|
||||
if (!cli.getCodFisc().isEmpty() && !CodiceFiscale.controlloFormale(cli.getCodFisc())) {
|
||||
msg = String.valueOf(msg) + " Il codice fiscale non è valido:";
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(msg);
|
||||
return rp;
|
||||
}
|
||||
if (!cli.getPIva().isEmpty() && cli.getPIva().length() != 11) {
|
||||
msg = String.valueOf(msg) + " Partita iva non valida:";
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(msg);
|
||||
return rp;
|
||||
}
|
||||
req.setAttribute("flgValido", "S");
|
||||
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
|
||||
rp = saveUserAndClifor(req, res);
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
protected ResParm saveUserAndClifor(HttpServletRequest req, HttpServletResponse res) {
|
||||
ResParm rp = new ResParm(true);
|
||||
com.ablia.anag.Users user = (com.ablia.anag.Users)getLoginUser(req);
|
||||
long l_id_users = getLoginUserId(req);
|
||||
fillObject(req, user);
|
||||
Clifor cliente = user.getClifor();
|
||||
fillObject(req, cliente);
|
||||
String nominativo = getRequestParameter(req, "nominativo");
|
||||
if (!nominativo.isEmpty()) {
|
||||
cliente.setFlgAzienda(1L);
|
||||
cliente.setCognome(nominativo);
|
||||
cliente.setNome("");
|
||||
}
|
||||
cliente.setFlgTipo("C");
|
||||
rp = cliente.save();
|
||||
if (rp.getStatus()) {
|
||||
long ckDestinazioneDiversa = getRequestLongParameter(req, "ckDestinazioneDiversa");
|
||||
if (ckDestinazioneDiversa == 1L) {
|
||||
DestinazioneDiversa dd = cliente.getCurrentDD();
|
||||
fillObject(req, dd);
|
||||
if (!dd.getIndirizzoDD().isEmpty()) {
|
||||
if (dd.getId_destinazioneDiversa() > 0L) {
|
||||
dd.findByPrimaryKey(dd.getId_destinazioneDiversa());
|
||||
fillObject(req, dd);
|
||||
}
|
||||
dd.setId_clifor(cliente.getId_clifor());
|
||||
dd.setId_nazioneDD(cliente.getId_nazione());
|
||||
dd.setFlgDDDefault(1L);
|
||||
dd.setDescrizioneDD("Sped. WWW");
|
||||
rp.append(dd.save());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
user.setId_clifor(cliente.getId_clifor());
|
||||
if (user.getId_userProfile() == 0L)
|
||||
user.setId_userProfile(10L);
|
||||
user.setFlgValido("S");
|
||||
rp.append(user.save());
|
||||
}
|
||||
if (!rp.getStatus()) {
|
||||
sendMessage(req, "Impossibile salvare: " + rp.getMsg());
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Impossibile salvare: " + rp.getMsg());
|
||||
return rp;
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
protected boolean useDeliveryCostOnUser() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.art.Articolo;
|
||||
import com.ablia.art.ArticoloCR;
|
||||
import com.ablia.art.ArticoloComponente;
|
||||
import com.ablia.art.ArticoloTaglia;
|
||||
import com.ablia.art.ArticoloVariante;
|
||||
import com.ablia.art.Lista;
|
||||
import com.ablia.art.TipoAccessorio;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class CatalogoSvlt extends com.ablia.www.servlet.CatalogoSvlt {
|
||||
private static final long serialVersionUID = -5684833919477899107L;
|
||||
|
||||
protected int getPageRow(HttpServletRequest req) {
|
||||
return (int)getRequestLongParameter(req, "pageRow");
|
||||
}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
try {
|
||||
ArticoloCR CR = new ArticoloCR(apFull);
|
||||
fillObject(req, CR);
|
||||
CR.setFlgDisponibile(1L);
|
||||
req.setAttribute("listaPadri", getTipo(req).findPadri());
|
||||
CR.setFlgUsaDisponibilita(1L);
|
||||
ArticoloVariante bean = (ArticoloVariante)l_bean;
|
||||
req.setAttribute("listaArticoliVariante", bean.getArticolo().findArticoliVarianti(0L, 0L));
|
||||
CR.setId_tipoSel(bean.getArticolo().getId_tipo());
|
||||
req.setAttribute("listaAccessori", bean.getAccessori());
|
||||
req.setAttribute("listaTipiAccessorio", new TipoAccessorio(apFull).findAll());
|
||||
req.setAttribute("listaCaratteristicheArticolo", bean.getArticolo().getCaratteristicheArticolo());
|
||||
req.setAttribute("listaArticoloComponenti", new ArticoloComponente(apFull).findByArticolo(bean.getId_articolo()));
|
||||
if (bean.getArticolo().getTipo().getFlgUsaTagliaEffettivo() == 2L)
|
||||
req.setAttribute("listaTaglieArticolo", new ArticoloTaglia(apFull).findByArticoloVariante(bean.getId_articoloVariante()));
|
||||
req.setAttribute("CR", CR);
|
||||
if (getAct(req).equals("zoom")) {
|
||||
String imgNumber = getRequestParameter(req, "imgNumber");
|
||||
req.setAttribute("imgNumber", imgNumber);
|
||||
}
|
||||
if (req.getAttribute("msg").equals("Lettura effettuata") || req.getAttribute("msg").equals("Read Ok"))
|
||||
req.setAttribute("msg", "");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ArticoloCR CR = new ArticoloCR(apFull);
|
||||
fillObject(req, CR);
|
||||
CR.setFlgNascondi(0L);
|
||||
CR.setFlgEscludiWeb(0L);
|
||||
req.setAttribute("CR", CR);
|
||||
if (getAct(req).equals("articolo")) {
|
||||
super.showBean(req, res);
|
||||
} else {
|
||||
long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante");
|
||||
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
|
||||
Articolo articolo = new Articolo(apFull);
|
||||
if (l_id_articolo == 0L && l_id_articoloVariante > 0L) {
|
||||
ArticoloVariante av = new ArticoloVariante(apFull);
|
||||
av.findByPrimaryKey(l_id_articoloVariante);
|
||||
req.setAttribute("id_articolo", Long.valueOf(av.getId_articolo()));
|
||||
}
|
||||
if (l_id_articoloVariante == 0L && getTipo(req) != null && getTipo(req).getFlgUsaVarianti() == 1L) {
|
||||
articolo.findByPrimaryKey(l_id_articolo);
|
||||
if (articolo.getArticoloVarianteBase() == null) {
|
||||
req.setAttribute("md", "search");
|
||||
req.setAttribute("CR", new ArticoloCR());
|
||||
req.setAttribute("bean", articolo);
|
||||
setJspPage("/articolo.jsp", req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
req.setAttribute("id_articoloVariante", Long.valueOf(articolo.getArticoloVarianteBase().getId_articoloVariante()));
|
||||
super.showBean(req, res);
|
||||
}
|
||||
} else {
|
||||
req.removeAttribute("bean");
|
||||
super.showBean(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {
|
||||
ArticoloCR CR = (ArticoloCR)CRA;
|
||||
req.setAttribute("listaPadri", CR.getTipo().findPadri());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
return new ArticoloVariante(apFull);
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
String jspPage = "";
|
||||
if (getCmd(req).equals("search")) {
|
||||
jspPage = "/articolo";
|
||||
} else {
|
||||
jspPage = "/articoloVariante";
|
||||
}
|
||||
return jspPage;
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ArticoloCR CR = new ArticoloCR(apFull);
|
||||
if (getAct(req).equals("back")) {
|
||||
CR = (ArticoloCR)req.getSession().getAttribute("CR");
|
||||
if (CR != null) {
|
||||
if (CR.getPageNumber() > 0)
|
||||
req.setAttribute("pageNumber", String.valueOf(CR.getPageNumber()));
|
||||
} else {
|
||||
CR = new ArticoloCR(apFull);
|
||||
}
|
||||
} else {
|
||||
fillObject(req, CR);
|
||||
}
|
||||
fillObject(req, CR);
|
||||
CR.setId_tipo(CR.getId_tipoSel());
|
||||
CR.setFlgNascondi(0L);
|
||||
CR.setFlgEscludiWeb(0L);
|
||||
req.setAttribute("list", new ArticoloVariante(apFull).findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req)));
|
||||
req.setAttribute("listaPadri", CR.getTipo().findPadri());
|
||||
Lista lista = new Lista(getApFull(req));
|
||||
req.setAttribute("listaCaratteristica1", lista.findLista(1L, 0, 0));
|
||||
req.getSession().setAttribute("CR", CR);
|
||||
req.setAttribute("CR", CR);
|
||||
forceJspPage("/articoloVarianteCR.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _aggiornaQuantitaTaglie(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_articoloTaglia = getRequestLongParameter(req, "id_articoloTaglia");
|
||||
ArticoloTaglia at = new ArticoloTaglia(apFull);
|
||||
at.findByPrimaryKey(l_id_articoloTaglia);
|
||||
sendHtmlMsgResponse(req, res, String.valueOf((long)at.getQuantitaAt()));
|
||||
}
|
||||
|
||||
public void _searchAv(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ArticoloCR CR = new ArticoloCR(apFull);
|
||||
fillObject(req, CR);
|
||||
CR.setFlgNascondi(0L);
|
||||
CR.setFlgEscludiWeb(0L);
|
||||
req.setAttribute("list", new ArticoloVariante(apFull).findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req)));
|
||||
req.setAttribute("listaPadri", CR.getTipo().findPadri());
|
||||
req.setAttribute("CR", CR);
|
||||
forceJspPage("/articoloVarianteCR.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.common.Users;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import java.util.Properties;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Deprecated
|
||||
public class LogonSvlt extends com.ablia.servlet.LogonSvlt {
|
||||
protected boolean checkLoginProfile(HttpServletRequest req) {
|
||||
try {
|
||||
if (getLoginUser(req) == null) {
|
||||
forceJspPage(getLoginPage(req, null), req);
|
||||
return true;
|
||||
}
|
||||
if (getLoginUser(req).getFlgValido().equals("N")) {
|
||||
forceJspPage(getLoginPage(req, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return false;
|
||||
}
|
||||
if (getLoginUser(req).getId_userProfile() > 0L) {
|
||||
forceJspPage(getLoginPage(req, null), req);
|
||||
return true;
|
||||
}
|
||||
forceJspPage(getLoginPage(req, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return getRequestParameter(req, "thePage");
|
||||
}
|
||||
|
||||
protected Users getUser(HttpServletRequest req) {
|
||||
ApplParmFull apFull = getApFull();
|
||||
return new com.ablia.anag.Users(apFull);
|
||||
}
|
||||
|
||||
protected void loginOK(HttpServletRequest req, HttpServletResponse res) throws Exception {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String url = "com.ablia.servlet.AcCartSvlt";
|
||||
Properties parm = new Properties();
|
||||
parm.setProperty("cmd", "updateCart");
|
||||
startRemoteCmd(apFull, parm, url);
|
||||
super.loginOK(req, res);
|
||||
req.setAttribute("msg", "");
|
||||
}
|
||||
|
||||
protected boolean useControlCodeAccess() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.anag.TipoPagamento;
|
||||
import com.ablia.anag.Users;
|
||||
import com.ablia.contab.Documento;
|
||||
import com.ablia.contab.DocumentoCR;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.util.AbMessages;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class OrdineSvlt extends com.ablia.www.servlet.OrdineSvlt {
|
||||
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
Documento bean = (Documento)l_bean;
|
||||
req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req)).findPagamentiWww(bean.getFlgRitiroNegozio()));
|
||||
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0));
|
||||
if (req.getAttribute("msg").equals("Lettura effettuata"))
|
||||
req.setAttribute("msg", "");
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Documento(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new DocumentoCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void payBonifico(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
Documento bean = new Documento(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
bean.setDataPagamento(DBAdapter.getToday());
|
||||
ResParm rp = bean.save();
|
||||
String theMsg = "";
|
||||
rp.getStatus();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
forceMessage(req, e.getMessage());
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
protected void payCc(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
Documento bean = new Documento(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
long l_flgTipoPagamento = getRequestLongParameter(req, "flgTipoPagamento");
|
||||
ResParm rp = bean.save();
|
||||
String theMsg = "";
|
||||
req.setAttribute("bean", bean);
|
||||
if (rp.getStatus()) {
|
||||
forceJspPageRelative("DocumentoCc.jsp", req);
|
||||
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0));
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
forceMessage(req, e.getMessage());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void refreshPayment(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
Documento bean = new Documento(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento");
|
||||
bean.setId_tipoPagamento(l_id_tipoPagamento);
|
||||
ResParm rp = bean.save();
|
||||
String theMsg = "";
|
||||
req.setAttribute("bean", bean);
|
||||
forceJspPageRelative("Documento.jsp", req);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
forceMessage(req, e.getMessage());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cancelOrder(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
Documento bean = new Documento(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
bean.setFlgStatoOrdineWww(99L);
|
||||
bean.setFlgStatoPrenotazione(100L);
|
||||
ResParm rp = bean.save();
|
||||
String theMsg = "";
|
||||
req.setAttribute("bean", bean);
|
||||
sendMessage(req, "Documento annullato");
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
forceMessage(req, e.getMessage());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendMailOrder(HttpServletRequest req, HttpServletResponse res) {
|
||||
Documento bean = null;
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = getRequestLongParameter(req, "id_documento");
|
||||
bean = new Documento(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
rp = bean.sendOrderMailMessageRavinale(getLang(req), true, true, false);
|
||||
sendMessage(req, rp.getMsg());
|
||||
} catch (Exception e) {
|
||||
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
protected String getCRAttribute(HttpServletRequest req) {
|
||||
return "CROrd";
|
||||
}
|
||||
|
||||
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
|
||||
DocumentoCR CR = new DocumentoCR(getApFull(req));
|
||||
fillObject(req, CR);
|
||||
if (getLoginUserId(req) != null && getLoginUserId(req) > 0L) {
|
||||
Users user = (Users)getLoginUser(req);
|
||||
if (user.getId_clifor() == 0L) {
|
||||
req.setAttribute("id_clifor", "-1");
|
||||
} else {
|
||||
req.setAttribute("id_clifor", String.valueOf(user.getId_clifor()));
|
||||
}
|
||||
req.setAttribute("id_tipoDocumento", Long.valueOf(getParm("ID_DOC_ORDINE_WWW").getNumeroLong()));
|
||||
if (CR.getFlgStatoOrdineWww() < 0L)
|
||||
req.setAttribute("flgStatoOrdineWww", "0");
|
||||
req.setAttribute("id_users", "0");
|
||||
} else {
|
||||
sendMessage(req, " ");
|
||||
}
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
String idCryptParm = "idcrypt";
|
||||
String l_id_ordineCript = (String)req.getSession().getAttribute(idCryptParm);
|
||||
if (l_id_ordineCript != null && !l_id_ordineCript.isEmpty()) {
|
||||
_vediOrdineCrypt(req, res);
|
||||
} else {
|
||||
String cmd = getCmd(req);
|
||||
if (cmd.equals("payBon")) {
|
||||
payBonifico(req, res);
|
||||
} else if (cmd.equals("payCc")) {
|
||||
payCc(req, res);
|
||||
} else if (cmd.equals("refreshPayment")) {
|
||||
refreshPayment(req, res);
|
||||
} else if (cmd.equals("cancelOrder")) {
|
||||
cancelOrder(req, res);
|
||||
} else if (cmd.equals("sendMailOrder")) {
|
||||
sendMailOrder(req, res);
|
||||
} else {
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
Documento bean = new Documento(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
if (bean.getDBState() == 1 && bean.getId_tipoPagamento() == 4L && bean.getFlgProcediPagamento() == 1L &&
|
||||
bean.getDescTransaction().isEmpty())
|
||||
bean.agiornaNuovoId_documentoXpay();
|
||||
super.showBean(req, res);
|
||||
}
|
||||
|
||||
public void _aggiornaRichiediFatturaMd(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users user = (Users)getLoginUser(req);
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
if (user != null && user.getDBState() == 1) {
|
||||
Documento bean = new Documento(apFull);
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
long l_flgWwwRichiedeFattura = getRequestLongParameter(req, "flgWwwRichiedeFattura");
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
if (bean.getId_documento() > 0L) {
|
||||
bean.setFlgWwwRichiedeFattura(l_flgWwwRichiedeFattura);
|
||||
bean.superSave();
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _aggiornaRichiediFattura(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users user = (Users)getLoginUser(req);
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
if (user != null && user.getDBState() == 1) {
|
||||
Documento bean = new Documento(apFull);
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
long l_flgWwwRichiedeFattura = getRequestLongParameter(req, "flgWwwRichiedeFattura");
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
if (bean.getId_documento() > 0L) {
|
||||
bean.setFlgWwwRichiedeFattura(l_flgWwwRichiedeFattura);
|
||||
bean.superSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.bank.paypal.PayPalResp;
|
||||
import com.ablia.cart.Cart;
|
||||
import com.ablia.contab.Documento;
|
||||
import com.ablia.db.ApplParm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PayPalDoPaymentSvlt extends PayPalSvlt {
|
||||
protected static ApplParmFull ap2;
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
if (ppResponse != null && ppResponse.isPaymentDone()) {
|
||||
long l_id_ordine = ppResponse.getId_ordine();
|
||||
Documento bean = new Documento(apFull);
|
||||
bean.findByPrimaryKey(l_id_ordine);
|
||||
bean.setDataPagamento(DBAdapter.getToday());
|
||||
bean.setDataTransaction(DBAdapter.getToday());
|
||||
bean.setDescTransaction(ppResponse.getTRANSACTIONID());
|
||||
bean.setFlgPagata(1L);
|
||||
ResParm rp = bean.save();
|
||||
if (rp.getStatus())
|
||||
rp = bean.sendOrderMailMessage(getLang(req), true, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
|
||||
long l_id_ordine = 0L;
|
||||
if (ppResponse != null)
|
||||
l_id_ordine = ppResponse.getId_ordine();
|
||||
}
|
||||
|
||||
protected String getCheckOutMailMessage() {
|
||||
return getParm(Cart.P_CHECKOUTMSG).getTesto();
|
||||
}
|
||||
|
||||
protected ApplParmFull getAp2() {
|
||||
if (ap2 == null)
|
||||
ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(),
|
||||
getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto()));
|
||||
return ap2;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.bank.paypal.PayPalResp;
|
||||
import com.ablia.bank.servlet.paypal.GetPayPalResponseSvlt;
|
||||
import com.ablia.cart.Cart;
|
||||
import com.ablia.db.ApplParm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PayPalResponseSvlt extends GetPayPalResponseSvlt {
|
||||
protected static ApplParmFull ap2;
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
|
||||
long l_id_ordine = 0L;
|
||||
if (ppResponse != null)
|
||||
l_id_ordine = ppResponse.getId_ordine();
|
||||
}
|
||||
|
||||
protected String getCheckOutMailMessage() {
|
||||
return getParm(Cart.P_CHECKOUTMSG).getTesto();
|
||||
}
|
||||
|
||||
protected ApplParmFull getAp2() {
|
||||
if (ap2 == null)
|
||||
ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(),
|
||||
getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto()));
|
||||
return ap2;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.bank.paypal.PayPalResp;
|
||||
import com.ablia.bank.sella.SellaResp;
|
||||
import com.ablia.cart.Cart;
|
||||
import com.ablia.db.ApplParm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PayPalSvlt extends com.ablia.bank.servlet.paypal.PayPalSvlt {
|
||||
protected static ApplParmFull ap2;
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
|
||||
if (sellaRes != null && sellaRes.getMyerrorcode().equals("0"))
|
||||
long l = sellaRes.getId_ordine();
|
||||
}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
|
||||
long l_id_ordine = 0L;
|
||||
if (sellaRes != null)
|
||||
l_id_ordine = sellaRes.getId_ordine();
|
||||
}
|
||||
|
||||
protected String getCheckOutMailMessage() {
|
||||
return getParm(Cart.P_CHECKOUTMSG).getTesto();
|
||||
}
|
||||
|
||||
protected ApplParmFull getAp2() {
|
||||
if (ap2 == null)
|
||||
ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(),
|
||||
getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto()));
|
||||
return ap2;
|
||||
}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
|
||||
long l_id_ordine = 0L;
|
||||
if (ppResponse != null)
|
||||
l_id_ordine = ppResponse.getId_ordine();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.contab.Documento;
|
||||
import com.ablia.contab.DocumentoCR;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.util.AbMessages;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ResoSvlt extends com.ablia.www.servlet.ResoSvlt {
|
||||
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
Documento bean = (Documento)l_bean;
|
||||
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0));
|
||||
if (req.getAttribute("msg").equals("Lettura effettuata"))
|
||||
req.setAttribute("msg", "");
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Documento(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new DocumentoCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void sendMailReso(HttpServletRequest req, HttpServletResponse res) {
|
||||
Documento bean = null;
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = getRequestLongParameter(req, "id_ordine");
|
||||
bean = new Documento(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
rp = bean.sendResoMailMessage();
|
||||
sendMessage(req, rp.getMsg());
|
||||
} catch (Exception e) {
|
||||
forceMessage(req,
|
||||
AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
protected String getCRAttribute(HttpServletRequest req) {
|
||||
return "CRRes";
|
||||
}
|
||||
|
||||
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
|
||||
DocumentoCR CR = new DocumentoCR(getApFull(req));
|
||||
if (getLoginUserId(req) != null)
|
||||
req.setAttribute("id_users",
|
||||
String.valueOf(getLoginUserId(req).longValue()));
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
String cmd = getCmd(req);
|
||||
if (cmd.equals("sendMailReso")) {
|
||||
sendMailReso(req, res);
|
||||
} else {
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
return "reso";
|
||||
}
|
||||
|
||||
protected ResParm afterSave(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
Documento bean = (Documento)l_bean;
|
||||
return bean.sendResoMailMessage();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.bank.sella.SellaResp;
|
||||
import com.ablia.bank.servlet.sella.GetSellaResponseSvlt;
|
||||
import com.ablia.cart.Cart;
|
||||
import com.ablia.contab.Documento;
|
||||
import com.ablia.db.ApplParm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class RicevutaSellaSvlt extends GetSellaResponseSvlt {
|
||||
protected static ApplParmFull ap2;
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
if (sellaRes != null && sellaRes.getMyerrorcode().equals("0")) {
|
||||
long l_id_ordine = sellaRes.getId_ordine();
|
||||
Documento bean = new Documento(apFull);
|
||||
bean.findByPrimaryKey(l_id_ordine);
|
||||
bean.setDataPagamento(DBAdapter.getToday());
|
||||
bean.setDataTransaction(DBAdapter.getToday());
|
||||
bean.setDescTransaction(sellaRes.getMyauthcode());
|
||||
bean.setFlgPagata(1L);
|
||||
bean.setFlgStatoOrdineWww(1L);
|
||||
ResParm rp = bean.save();
|
||||
if (rp.getStatus()) {
|
||||
if (bean.getFlgWwwRichiedeFattura() == 1L) {
|
||||
long l_id_tipodocFatturaDifferita = 22L;
|
||||
bean.creaDocumentoFiglio(bean.getId_clifor(), l_id_tipodocFatturaDifferita, null, false);
|
||||
} else {
|
||||
long l_id_tipodocRicevuta = 23L;
|
||||
bean.creaDocumentoFiglio(bean.getId_clifor(), l_id_tipodocRicevuta, null, false);
|
||||
}
|
||||
rp = bean.sendOrderMailMessageRavinale(getLang(req), true, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
|
||||
long l_id_ordine = 0L;
|
||||
if (sellaRes != null)
|
||||
l_id_ordine = sellaRes.getId_ordine();
|
||||
Documento bean = new Documento(getApFull());
|
||||
bean.findByPrimaryKey(l_id_ordine);
|
||||
req.setAttribute("bean", bean);
|
||||
}
|
||||
|
||||
protected String getCheckOutMailMessage() {
|
||||
return getParm(Cart.P_CHECKOUTMSG).getTesto();
|
||||
}
|
||||
|
||||
protected ApplParmFull getAp2() {
|
||||
if (ap2 == null)
|
||||
ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(),
|
||||
getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto()));
|
||||
return ap2;
|
||||
}
|
||||
|
||||
public void _test(HttpServletRequest req, HttpServletResponse res) {}
|
||||
}
|
||||
|
|
@ -0,0 +1,404 @@
|
|||
package com.ablia.ravinale.www.servlet;
|
||||
|
||||
import com.ablia.anag.Cliente;
|
||||
import com.ablia.anag.Clifor;
|
||||
import com.ablia.anag.DestinazioneDiversa;
|
||||
import com.ablia.anag.Nazione;
|
||||
import com.ablia.anag.NazioneCR;
|
||||
import com.ablia.anag.Users;
|
||||
import com.ablia.anag.UsersCR;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.util.CodiceFiscale;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class UsersSvlt extends com.ablia.www.servlet.UsersSvlt {
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
NazioneCR nCR = new NazioneCR();
|
||||
nCR.setLang(getLang(req));
|
||||
req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req)));
|
||||
if (req.getAttribute("msg").equals("Lettura effettuata"))
|
||||
req.setAttribute("msg", "");
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Users(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new UsersCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
||||
NazioneCR nCR = new NazioneCR();
|
||||
nCR.setLang(getLang(req));
|
||||
req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req)));
|
||||
sendMessage(req, "");
|
||||
Users bean = new Users(getApFull(req));
|
||||
bean.setFlgMl(1L);
|
||||
bean.setId_userProfile(bean.getIdUserProfileWww());
|
||||
bean.setCallingJsp(getRequestParameter(req, "callingJsp"));
|
||||
bean.setId_documento(getRequestLongParameter(req, "id_documento"));
|
||||
req.setAttribute("bean", bean);
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
return super.getBeanPageName(req);
|
||||
}
|
||||
|
||||
protected String getCmd(HttpServletRequest req) {
|
||||
if (super.getCmd(req).isEmpty())
|
||||
return "ni";
|
||||
return super.getCmd(req);
|
||||
}
|
||||
|
||||
protected String newDispathcerAfterShowBean(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
Users bean = (Users)beanA;
|
||||
bean.setCallingJsp(getRequestParameter(req, "callingJsp"));
|
||||
bean.setId_documento(getRequestLongParameter(req, "id_documento"));
|
||||
req.setAttribute("bean", bean);
|
||||
return "";
|
||||
}
|
||||
|
||||
private boolean mailConfermaCambiamentoDati(HttpServletRequest req, Users bean) {
|
||||
return bean.sendUserDataMailMessage().getStatus();
|
||||
}
|
||||
|
||||
protected String getRegistrazioneMailMessage() {
|
||||
return getParm("MAIL_REG").getTesto();
|
||||
}
|
||||
|
||||
protected void sqlActions(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users bean = new Users(getApFull(req));
|
||||
long l_id_users = getRequestLongParameter(req, "id_users");
|
||||
if (l_id_users > 0L)
|
||||
bean.findByPrimaryKey(l_id_users);
|
||||
fillObject(req, bean);
|
||||
Cliente cli = new Cliente(getApFull(req));
|
||||
if (bean.getId_users() > 0L)
|
||||
cli.findByPrimaryKey(bean.getId_clifor());
|
||||
fillObject(req, cli);
|
||||
req.setAttribute("eMail", bean.getLogin());
|
||||
DestinazioneDiversa dd = new DestinazioneDiversa(getApFull(req));
|
||||
fillObject(req, dd);
|
||||
cli.setCurrentDD(dd);
|
||||
bean.setClifor((Clifor)cli);
|
||||
String msg = "Impossibile Registrare un nuovo utente:";
|
||||
if (bean.isLogonDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Login già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else if (bean.isEmailDuplicated()) {
|
||||
Users userMl = new Users(getApFull(req));
|
||||
userMl.findUsersByEmail(bean.getEMail());
|
||||
if (userMl.getId_userProfile() == bean.getIdUserProfileMailingList()) {
|
||||
req.setAttribute("id_users", String.valueOf(userMl.getId_users()));
|
||||
req.setAttribute("flgValido", "S");
|
||||
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
|
||||
saveUserAndClifor(req, res);
|
||||
} else {
|
||||
msg = String.valueOf(msg) + " Email già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} else if (cli.isCodFiscDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Codice Fiscale già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
cli.setCodFisc("");
|
||||
bean.setCodFisc("");
|
||||
bean.setClifor((Clifor)cli);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else if (cli.isPIvaDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Partita Iva già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
bean.setPIva("");
|
||||
cli.setPIva("");
|
||||
bean.setPIva("");
|
||||
bean.setClifor((Clifor)cli);
|
||||
callJsp(req, res);
|
||||
} else if (!cli.getCodFisc().isEmpty() && !CodiceFiscale.controlloFormale(cli.getCodFisc())) {
|
||||
msg = String.valueOf(msg) + " Il codice fiscale non è valido:";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
cli.setCodFisc("");
|
||||
bean.setCodFisc("");
|
||||
bean.setClifor((Clifor)cli);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else if (!cli.getPIva().isEmpty() && cli.getPIva().length() != 11) {
|
||||
msg = String.valueOf(msg) + " Partita iva non valida:";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
bean.setPIva("");
|
||||
cli.setPIva("");
|
||||
bean.setPIva("");
|
||||
bean.setClifor((Clifor)cli);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
req.setAttribute("flgValido", "S");
|
||||
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
|
||||
saveUserAndClifor(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void recordMailingList(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users bean = new Users(getApFull(req));
|
||||
fillObject(req, bean);
|
||||
ResParm rp = new ResParm();
|
||||
String msg = "Impossibile Registrare utente ML:";
|
||||
if (bean.isEmailDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Email già presente in archivio - " + bean.getEMail();
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(msg);
|
||||
if (bean.isEmailDuplicatedNoMl()) {
|
||||
rp.setErrorCode(1L);
|
||||
} else {
|
||||
rp.setErrorCode(2L);
|
||||
}
|
||||
req.setAttribute("RP", rp);
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
bean.setFlgValido("N");
|
||||
bean.setFlgMl(1L);
|
||||
bean.setId_userProfile(bean.getIdUserProfileMailingList());
|
||||
bean.setLangMl(getRequestParameter(req, "langMl"));
|
||||
bean.setLogin("ML_" + bean.getEMail());
|
||||
bean.setCognome("MLC_" + bean.getEMail());
|
||||
bean.setNome("MLN_" + bean.getEMail());
|
||||
if (bean.getLogin().length() > 30)
|
||||
bean.setLogin(bean.getLogin().substring(0, 30));
|
||||
if (bean.getCognome().length() > 30)
|
||||
bean.setCognome(bean.getCognome().substring(0, 30));
|
||||
if (bean.getNome().length() > 30)
|
||||
bean.setNome(bean.getNome().substring(0, 30));
|
||||
rp = bean.save();
|
||||
if (rp.getStatus())
|
||||
bean.sendMLMailMessageOLD(String.valueOf(req.getRemoteHost()) + " " + req.getRemoteAddr());
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkCc(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users bean = new Users(getApFull(req));
|
||||
fillObject(req, bean);
|
||||
ResParm rp = new ResParm();
|
||||
String msg = "Impossibile Registrare utente ML:";
|
||||
if (bean.isEmailDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Email già presente in archivio - " + bean.getEMail();
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(msg);
|
||||
if (bean.isEmailDuplicatedNoMl()) {
|
||||
rp.setErrorCode(1L);
|
||||
} else {
|
||||
rp.setErrorCode(2L);
|
||||
}
|
||||
req.setAttribute("RP", rp);
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
bean.setFlgValido("N");
|
||||
bean.setFlgMl(1L);
|
||||
bean.setId_userProfile(bean.getIdUserProfileMailingList());
|
||||
bean.setLogin("ML_" + bean.getEMail());
|
||||
bean.setCognome("MLC_" + bean.getEMail());
|
||||
bean.setNome("MLN_" + bean.getEMail());
|
||||
rp = bean.save();
|
||||
if (rp.getStatus())
|
||||
bean.sendMLMailMessageOLD(String.valueOf(req.getRemoteHost()) + " " + req.getRemoteAddr());
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected com.ablia.common.Users getUser(HttpServletRequest req) {
|
||||
return new Users(getApFull(req));
|
||||
}
|
||||
|
||||
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
String msg;
|
||||
Users bean = (Users)beanA;
|
||||
long l_id_user = getRequestLongParameter(req, "id_users");
|
||||
if (bean.getDBState() == 1) {
|
||||
msg = "Salvataggio effettuato";
|
||||
req.getSession().setAttribute("utenteLogon", bean);
|
||||
req.getSession().setAttribute("loginUser_id", new Long(bean.getId_users()));
|
||||
if (l_id_user == 0L) {
|
||||
if (!mailConfermaCambiamentoDati(req, bean)) {
|
||||
msg = String.valueOf(msg) + " Attenzione!! Impossibile mandare email di conferma.";
|
||||
bean.setFlgEmailOk(0L);
|
||||
} else {
|
||||
msg = String.valueOf(msg) + " Inviata mail di conferma.";
|
||||
bean.setFlgEmailOk(1L);
|
||||
}
|
||||
} else {
|
||||
bean.setFlgEmailOk(1L);
|
||||
}
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + "Reg.jsp", req);
|
||||
} else {
|
||||
msg = "ERRORE!. Non è stato possibile salvare. Contattare l'amministratore o immettere login diverso";
|
||||
}
|
||||
forceMessage(req, msg);
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getCmd(req).equals("ML")) {
|
||||
recordMailingList(req, res);
|
||||
} else if (getCmd(req).equals("checkCC")) {
|
||||
recordMailingList(req, res);
|
||||
} else if (getCmd(req).equals("checkUCF")) {
|
||||
checkUserCF(req, res);
|
||||
} else {
|
||||
super.otherCommands(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void saveUserAndClifor(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users user = new Users(getApFull(req));
|
||||
long l_id_users = getRequestLongParameter(req, "id_users");
|
||||
user.findByPrimaryKey(l_id_users);
|
||||
fillObject(req, user);
|
||||
if (user.getId_nazione().toLowerCase().equals("i")) {
|
||||
user.setLangMl("it");
|
||||
user.setLang("it");
|
||||
} else {
|
||||
user.setLangMl("en");
|
||||
user.setLang("en");
|
||||
}
|
||||
Clifor cliente = user.getClifor();
|
||||
fillObject(req, cliente);
|
||||
String nominativo = getRequestParameter(req, "nominativo");
|
||||
if (!nominativo.isEmpty()) {
|
||||
cliente.setFlgAzienda(1L);
|
||||
cliente.setCognome(nominativo);
|
||||
cliente.setNome("");
|
||||
}
|
||||
cliente.setFlgTipo("C");
|
||||
ResParm rp = cliente.save();
|
||||
if (rp.getStatus()) {
|
||||
DestinazioneDiversa dd = cliente.getCurrentDD();
|
||||
fillObject(req, dd);
|
||||
if (dd.getIndirizzoDD().isEmpty()) {
|
||||
if (dd.getId_destinazioneDiversa() != 0L)
|
||||
rp.append(dd.delete());
|
||||
} else {
|
||||
dd.setId_clifor(cliente.getId_clifor());
|
||||
dd.setFlgDDDefault(1L);
|
||||
dd.setDescrizioneDD("Sped. WWW");
|
||||
rp.append(dd.save());
|
||||
}
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
user.setId_clifor(cliente.getId_clifor());
|
||||
if (user.getId_userProfile() == 0L)
|
||||
user.setId_userProfile(10L);
|
||||
user.setFlgValido("S");
|
||||
rp.append(user.save());
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
afterSave((DBAdapter)user, req, res);
|
||||
sendMessage(req, "Record salvato correttamente");
|
||||
setJspPage("/usersReg.jsp", req);
|
||||
} else {
|
||||
sendMessage(req, "Impossibile salvare: " + rp.getMsg());
|
||||
setJspPage("/users.jsp", req);
|
||||
req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req)));
|
||||
}
|
||||
req.setAttribute("bean", user);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected void checkUserCF(HttpServletRequest req, HttpServletResponse res) {
|
||||
String l_cf = getRequestParameter(req, "codFiscR");
|
||||
ResParm rp = new ResParm(true);
|
||||
if (l_cf.isEmpty()) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Codice Fiscale errato!");
|
||||
} else {
|
||||
Clifor clifor = new Clifor(getApFull(req));
|
||||
clifor.findByCF(l_cf);
|
||||
if (clifor.getDBState() == 0) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Il Codice Fiscale richiesto non è nei nostri database. ");
|
||||
} else if (clifor.getDBState() == 1 && clifor.getEMail().isEmpty()) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Il Codice Fiscale è nei nostri database ma l'indirizzo email non è stato comunicato.");
|
||||
} else {
|
||||
Users user = new Users(getApFull(req));
|
||||
Vectumerator vec = user.findByClifor(clifor.getId_clifor(), 1, 1);
|
||||
if (vec.getTotNumberOfRecords() == 0) {
|
||||
user.setCognome(clifor.getCognome());
|
||||
user.setNome(clifor.getNome());
|
||||
if (clifor.getFlgAzienda() == 1L)
|
||||
user.setNominativo(clifor.getCognome());
|
||||
user.setFlgValido("S");
|
||||
user.setId_userProfile(10L);
|
||||
user.setId_clifor(clifor.getId_clifor());
|
||||
user.setEMail(clifor.getEMail());
|
||||
if (!clifor.getCellulare().isEmpty()) {
|
||||
user.setTelefono(clifor.getCellulare());
|
||||
} else {
|
||||
user.setTelefono(clifor.getTelefono());
|
||||
}
|
||||
user.setLogin(user.getEMail());
|
||||
user.setPwd(String.valueOf(Math.random() * 1000000.0D).substring(0, 6));
|
||||
rp = user.save();
|
||||
if (rp.getStatus()) {
|
||||
rp = user.sendUserDataMailMessage();
|
||||
if (rp.getStatus())
|
||||
rp.setMsg("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email " + user.getEMail());
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Utente creato correttamente ma non è stato possibile inviare l'email di conferma.");
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(
|
||||
"Attenzione! Il codice fiscale è nei nostri database ma esiste già un utente web associato. Richiedi i dati di accesso attraverso il recupero del login tramite indirizzo email.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
forceJspPage("/usersReg.jsp", req);
|
||||
} else {
|
||||
forceJspPage("/usersRegError.jsp", req);
|
||||
}
|
||||
sendMessage(req, rp.getMsg());
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id_usersDoc = getRequestLongParameter(req, "id_usersDoc");
|
||||
req.setAttribute("id_users", String.valueOf(getLoginUserId(req)));
|
||||
if (l_id_usersDoc > 0L)
|
||||
req.setAttribute("id_users", Long.valueOf(l_id_usersDoc));
|
||||
super.showBean(req, res);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue