www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
|
|
@ -0,0 +1,46 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.art.Articolo;
|
||||
import it.acxent.art.ArticoloCR;
|
||||
import it.acxent.common.Access;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.servlet.AblServletSvlt;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ArticoloSvlt extends AblServletSvlt {
|
||||
private static final long serialVersionUID = 8449640401787842418L;
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new ArticoloCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.search(req, res);
|
||||
}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Articolo(getApFull(req));
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
String temp = getBeanName(req);
|
||||
Access access = new Access(getApFull(req));
|
||||
access.findByPrimaryKey(Access.convertFieldToTableName(temp));
|
||||
if (getRequestParameter(req, "sw").equals("1")) {
|
||||
if (!access.getSuffissoE().isEmpty())
|
||||
return temp + temp + "E";
|
||||
return temp + "E";
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.common.Blacklist;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.mail.MailMessage;
|
||||
import it.acxent.mail.MailProperties;
|
||||
import it.acxent.servlet.AcMailer;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class CCMailer extends AcMailer {
|
||||
private static final long serialVersionUID = 4639118494615519041L;
|
||||
|
||||
protected ResParm checkBlacklist(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ResParm rp = new ResParm(true);
|
||||
if (apFull.getParm("MAIL_BLACKLIST_AUTO_FILL").isTrue()) {
|
||||
System.out.println(getClass().getName());
|
||||
Blacklist bl = new Blacklist(apFull);
|
||||
bl.findByIp(apFull.getReqIpAddress(), false);
|
||||
bl.setIpAddress(apFull.getReqIpAddress());
|
||||
bl.setFatalCount(bl.getFatalCount() + 1L);
|
||||
if (apFull.getParm("MAIL_BLACKLIST_AUTO_ENABLE").isTrue()) {
|
||||
Timestamp tmstStartCount = bl.getTmstStartCount();
|
||||
double secondiTraFatal = (double)((DBAdapter.getTimestamp().getTime() - tmstStartCount.getTime()) / 1000L);
|
||||
if (secondiTraFatal < 60.0D) {
|
||||
double l_fatalCountMax = apFull.getParm("MAIL_BLACKLIST_MAX_COUNT").getNumeroDouble() * secondiTraFatal / 60.0D;
|
||||
System.out.println("#####\nsecondiFraInviiMailer: " + l_fatalCountMax + " current send mail count for " +
|
||||
bl.getIpAddress() + ": " + bl.getFatalCount() + "\n#####");
|
||||
if (l_fatalCountMax > 0.0D && (double)bl.getFatalCount() > l_fatalCountMax) {
|
||||
bl.setTmstStartBlacklist(DBAdapter.getTimestamp());
|
||||
bl.setDescrizione("Too many mailer send. Probably a sql injection attack!!!");
|
||||
bl.setNotaBlacklist(apFull.getReqUrl());
|
||||
bl.setFlgAttivo(1L);
|
||||
sendDebugMailMessage(req, "ACXENT MAILER AUTO BLACKLIST :" + bl.getIpAddress(),
|
||||
String.valueOf(bl.getTmstStartBlacklist()) + "\n\n" + String.valueOf(bl.getTmstStartBlacklist()));
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(apFull.translate("Attenzione! Sono stati rilevati troppi invii da questo ip. Il tuo indirizzo ip è stato messo in blacklist:",
|
||||
|
||||
getLang(req)) + " " + apFull.translate("Attenzione! Sono stati rilevati troppi invii da questo ip. Il tuo indirizzo ip è stato messo in blacklist:", getLang(req)));
|
||||
}
|
||||
} else {
|
||||
bl.setTmstStartCount(DBAdapter.getTimestamp());
|
||||
bl.setFatalCount(1L);
|
||||
}
|
||||
}
|
||||
bl.save();
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
protected void sendMail(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
try {
|
||||
ResParm rp = checkBlacklist(req, res);
|
||||
if (rp.getStatus()) {
|
||||
MailMessage mf = null;
|
||||
String mailMessageFile = getMailMessageFile(req);
|
||||
String lang = getLang(req);
|
||||
String ipAddress = req.getRemoteHost() + " " + req.getRemoteHost();
|
||||
Date d = new Date(System.currentTimeMillis());
|
||||
if (!mailMessageFile.isEmpty()) {
|
||||
mf = new MailMessage(apFull, mailMessageFile);
|
||||
Attivita.sendMailStandardData(mf, lang, Attivita.getDefaultInstance(apFull), req);
|
||||
}
|
||||
Enumeration<String> enu = req.getParameterNames();
|
||||
StringBuffer theMsg = new StringBuffer("");
|
||||
String attName = "";
|
||||
String attValue = "";
|
||||
while (enu.hasMoreElements()) {
|
||||
attName = enu.nextElement();
|
||||
attValue = getRequestParameter(req, attName);
|
||||
if (!attName.equals("cmd") && !attName.equals("act") && !attName.equals("mailFrom") &&
|
||||
|
||||
!attName.equals("MAIL_FROM_MAILER") && !attName.equals("MAIL_TO_MAILER") && !attName.equals("mailSubject") &&
|
||||
!attName.equals("mailOkMsg") && !attName.equals("mailKoMsg") &&
|
||||
!attName.equals("mailResponsePage") && !attName.equals("mailFile")) {
|
||||
if (mf != null) {
|
||||
mf.setString(attName, attValue);
|
||||
continue;
|
||||
}
|
||||
theMsg.append(attName);
|
||||
theMsg.append(": ");
|
||||
theMsg.append(attValue);
|
||||
theMsg.append("\n");
|
||||
}
|
||||
}
|
||||
MailProperties prop = new MailProperties();
|
||||
if (getRequestParameter(req, "mailTo").trim().isEmpty()) {
|
||||
if (getRequestParameter(req, "MAIL_TO_MAILER").trim().isEmpty()) {
|
||||
prop.setProperty("TO", getParm("MAIL_TO_MAILER").getTesto().trim());
|
||||
} else {
|
||||
prop.setProperty("TO", getParm(getRequestParameter(req, "MAIL_TO_MAILER")).getTesto().trim());
|
||||
}
|
||||
} else {
|
||||
prop.setProperty("TO", getRequestParameter(req, getRequestParameter(req, "mailTo").trim()));
|
||||
}
|
||||
if (!getParm("MAIL_BCC_MAILER").getTesto().equals(""))
|
||||
prop.setProperty("BCC", getParm("MAIL_BCC_MAILER").getTesto());
|
||||
if (getRequestParameter(req, "mailFrom").equals("")) {
|
||||
prop.setProperty("FROM", getParm(getRequestParameter(req, "MAIL_FROM_MAILER")).getTesto());
|
||||
} else {
|
||||
prop.setProperty("FROM", getRequestParameter(req, "mailFrom"));
|
||||
}
|
||||
prop.setProperty("SUBJECT", getRequestParameter(req, "mailSubject"));
|
||||
if (mf != null) {
|
||||
mf.setString("ip", ipAddress);
|
||||
mf.setString("timestamp", d.toString());
|
||||
prop.setProperty("MSG", mf.getMessage());
|
||||
prop.setProperty("ISHTML", String.valueOf(isMessageHtml(mailMessageFile)));
|
||||
} else {
|
||||
theMsg.append("\nIP: ");
|
||||
theMsg.append(ipAddress);
|
||||
theMsg.append("\ntimestamp:");
|
||||
theMsg.append(d.toString());
|
||||
theMsg.append("\n");
|
||||
prop.setProperty("MSG", theMsg.toString());
|
||||
prop.setProperty("ISHTML", "false");
|
||||
}
|
||||
DBAdapter.logDebug(true, "\n" + prop.toString());
|
||||
MailMessage mm = new MailMessage(getApFull());
|
||||
mm.sendMailMessage(prop, false);
|
||||
if (getRequestParameter(req, "mailOkMsg").equals("")) {
|
||||
sendMessage(req, apFull.translate("La mail e' stata inviata correttamente.", getLang(req)));
|
||||
} else {
|
||||
sendMessage(req, getRequestParameter(req, "mailOkMsg"));
|
||||
}
|
||||
chiamaJsp(req, res);
|
||||
} else {
|
||||
sendMessage(req, rp.getMsg());
|
||||
chiamaJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
if (getRequestParameter(req, "mailKoMsg").equals("")) {
|
||||
sendMessage(req, apFull.translate("Impossibile inviare mail: ", getLang(req)) + " " + apFull.translate("Impossibile inviare mail: ", getLang(req)));
|
||||
} else {
|
||||
sendMessage(req, getRequestParameter(req, "mailKoMsg") + ": " + getRequestParameter(req, "mailKoMsg"));
|
||||
}
|
||||
chiamaJsp(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,583 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.art.Articolo;
|
||||
import it.acxent.art.ArticoloCR;
|
||||
import it.acxent.art.ArticoloComponente;
|
||||
import it.acxent.art.ArticoloTaglia;
|
||||
import it.acxent.art.ArticoloVariante;
|
||||
import it.acxent.art.Lista;
|
||||
import it.acxent.art.Marca;
|
||||
import it.acxent.art.Tipo;
|
||||
import it.acxent.art.TipoAccessorio;
|
||||
import it.acxent.common.Users;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.util.StringTokenizer;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class CatalogoSvlt extends it.acxent.www.servlet.CatalogoSvlt {
|
||||
boolean debug = false;
|
||||
|
||||
private static final long serialVersionUID = -5684833919477899107L;
|
||||
|
||||
protected int getPageRow(HttpServletRequest req) {
|
||||
int pr = (int)getRequestLongParameter(req, "pageRow");
|
||||
if (pr == 0)
|
||||
return 12;
|
||||
return pr;
|
||||
}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
try {
|
||||
req.setAttribute("listaPadri", getTipo(req).findPadri());
|
||||
if (this.debugTs)
|
||||
System.out.println("fillComboAfterDetail listaPadri: ms: " + this.timer.getDurataMilliSec());
|
||||
Articolo bean = (Articolo)l_bean;
|
||||
req.setAttribute("listaAccessori", bean.getAccessori());
|
||||
if (this.debugTs)
|
||||
System.out.println("fillComboAfterDetail listaAccessori: ms: " + this.timer.getDurataMilliSec());
|
||||
req.setAttribute("listaTipiAccessorio", new TipoAccessorio(apFull).findAll());
|
||||
if (this.debugTs)
|
||||
System.out.println("fillComboAfterDetail listaTipiAccessorio: ms: " + this.timer.getDurataMilliSec());
|
||||
req.setAttribute("listaArticoloComponenti", new ArticoloComponente(apFull).findByArticolo(bean.getId_articolo()));
|
||||
if (this.debugTs)
|
||||
System.out.println("fillComboAfterDetail listaArticoloComponenti: ms: " + this.timer.getDurataMilliSec());
|
||||
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) {
|
||||
if (this.debugTs)
|
||||
this.timer.start();
|
||||
if (this.debugTs)
|
||||
System.out.println("\n############### showBean start: ms: " + this.timer.getDurataMilliSec());
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Articolo bean = new Articolo(apFull);
|
||||
String url = (String)req.getAttribute("_requestUrl");
|
||||
boolean vaiAvanti = true;
|
||||
try {
|
||||
String redirectLink = "index.html";
|
||||
if (url.indexOf("Catalogo.abl?") > 0) {
|
||||
vaiAvanti = false;
|
||||
String codice = getRequestParameter(req, "id_articolo");
|
||||
bean.findByCodice(codice);
|
||||
if (bean.getId_articolo() > 0L) {
|
||||
String lang = "it";
|
||||
redirectLink = bean.getTipo().getDescrizioneCompletaPlus(lang) + "+" + bean.getTipo().getDescrizioneCompletaPlus(lang) + "+articolo-" + DBAdapter.convertStringToLink(bean.getDescrizioneNomeUrl()) + "--it.html";
|
||||
}
|
||||
}
|
||||
if (!vaiAvanti) {
|
||||
res.setStatus(301);
|
||||
res.setHeader("Location", redirectLink);
|
||||
res.setHeader("Connection", "close");
|
||||
vaiAvanti = false;
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
if (this.debugTs)
|
||||
System.out.println("showBean redirect: ms: " + this.timer.getDurataMilliSec());
|
||||
if (vaiAvanti) {
|
||||
ArticoloCR CR = (ArticoloCR)req.getSession().getAttribute("CR");
|
||||
if (CR == null)
|
||||
CR = new ArticoloCR(apFull);
|
||||
CR.setSearchTxtWeb(getRequestParameter(req, "searchTxtWeb"));
|
||||
CR.setLang(getLang(req));
|
||||
if (this.debug)
|
||||
System.out.println("attcr1" + CR.getFlgDisponibile());
|
||||
req.setAttribute("CR", CR);
|
||||
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
|
||||
bean.findByPrimaryKey(l_id_articolo);
|
||||
if (this.debugTs)
|
||||
System.out.println("showBean findByPrimaryKey: ms: " + this.timer.getDurataMilliSec());
|
||||
if (bean.getId_articolo() > 0L) {
|
||||
if (!isRequestFromCrawler(req).getStatus()) {
|
||||
Users user = getLoginUser(req);
|
||||
if (user == null || user.getId_userProfile() != 1L)
|
||||
Articolo.addImpression(bean);
|
||||
}
|
||||
req.setAttribute("act", "articolo");
|
||||
} else {
|
||||
sendMessage(req, bean.translate("Il prodotto che stai cercando non è più disponibile.", getLang(req)));
|
||||
forceJspPage("/form-ricerca-prodotti.jsp", req);
|
||||
}
|
||||
if (this.debugTs)
|
||||
System.out.println("showBean impression: ms: " + this.timer.getDurataMilliSec());
|
||||
super.showBean(req, res);
|
||||
if (this.debugTs) {
|
||||
this.timer.stop();
|
||||
System.out.println("--------------- stop ShowBean: ms: " + this.timer.getDurataMilliSec());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ArticoloCR CR = (ArticoloCR)CRA;
|
||||
req.setAttribute("listaPadri", CR.getTipo().findPadri());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
return new Articolo(apFull);
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
return super.getBeanPageName(req);
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ArticoloCR CR = new ArticoloCR(apFull);
|
||||
Articolo bean = new Articolo(apFull);
|
||||
String l_lang = getLang(req);
|
||||
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);
|
||||
}
|
||||
boolean faiRicerca = true;
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 1");
|
||||
if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("**")) {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 2");
|
||||
CR.setCodice(CR.getSearchTxtWeb().substring(2));
|
||||
CR.setSearchTxtWeb("");
|
||||
bean.findByCodice(CR.getCodice());
|
||||
if (bean.getId_articolo() > 0L) {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 3");
|
||||
req.setAttribute("listaPadri", bean.getTipo().findPadri());
|
||||
req.setAttribute("act", "articolo");
|
||||
req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo()));
|
||||
super.showBean(req, res);
|
||||
faiRicerca = false;
|
||||
}
|
||||
} else {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 4");
|
||||
if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("@")) {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 5");
|
||||
CR.setTagArticolo(CR.getSearchTxtWeb().substring(1));
|
||||
}
|
||||
}
|
||||
String url = (String)req.getAttribute("_requestUrl");
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 6");
|
||||
try {
|
||||
boolean redirect = false;
|
||||
if (url.indexOf("sendinblue") < 0)
|
||||
if (url.indexOf("addItem") > 0) {
|
||||
redirect = false;
|
||||
} else if (url.indexOf("Catalogo.abl?") > 0) {
|
||||
redirect = true;
|
||||
} else if (url.indexOf("_") > 0) {
|
||||
redirect = true;
|
||||
}
|
||||
if (redirect) {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 7");
|
||||
res.setStatus(301);
|
||||
res.setHeader("Location", "index.html");
|
||||
res.setHeader("Connection", "close");
|
||||
faiRicerca = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("----------------------------- ERRORE url\n" + url);
|
||||
}
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 8");
|
||||
if (faiRicerca) {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 9");
|
||||
if (CR.getPageRow() > 96) {
|
||||
CR.setPageRow(96);
|
||||
} else if (CR.getPageRow() <= 0) {
|
||||
CR.setPageRow(12);
|
||||
}
|
||||
if (CR.getPageNumber() <= 0)
|
||||
CR.setPageNumber(1);
|
||||
if (!CR.getTag().isEmpty()) {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 10");
|
||||
req.getSession().removeAttribute("tag");
|
||||
}
|
||||
CR.setId_tipo(CR.getId_tipoSel());
|
||||
CR.setFlgNascondi(0L);
|
||||
CR.setFlgEscludiWeb(0L);
|
||||
if (!CR.getFiltri_id().isEmpty()) {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 11");
|
||||
ArticoloCR.setCCCRFromtFiltriId(CR);
|
||||
}
|
||||
bean.setId_iva(bean.getCodiceIvaVendStd());
|
||||
if (CR.getSearchTxtWeb().length() == 0) {
|
||||
CR.setPrezzoMax(bean.getPrezzoPubblicoIvaArticoloMaxByCR(CR));
|
||||
CR.setPrezzoMin(bean.getPrezzoPubblicoIvaArticoloMinByCR(CR));
|
||||
}
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 12");
|
||||
String tag = "";
|
||||
if (req.getSession().getAttribute("tag") != null)
|
||||
tag = (String)req.getSession().getAttribute("tag");
|
||||
CR.setTag(tag);
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 13");
|
||||
Vectumerator<Articolo> list = bean.findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req));
|
||||
try {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 14");
|
||||
ArticoloCR CRS = CR.getClone();
|
||||
req.getSession().setAttribute("CR", CRS);
|
||||
if (this.debug)
|
||||
System.out.println("attcr2" + CR.getFlgDisponibile());
|
||||
req.setAttribute("CR", CRS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 15");
|
||||
if (list.getTotNumberOfRecords() > 0) {
|
||||
if (this.debug)
|
||||
System.out.println("catalogo 16");
|
||||
req.setAttribute("list", list);
|
||||
req.setAttribute("listaPadri", CR.getTipo().findPadri());
|
||||
if (CR.getSearchTxtWeb().isEmpty()) {
|
||||
req.setAttribute("listaMarcheCR", new Marca(apFull).findMarchePresentiByTipoTag(CR.getId_tipo(), CR.getTag()));
|
||||
} else {
|
||||
req.setAttribute("listaMarcheCR", new Marca(apFull).findWebByArticoloCR(CR, 0, 0));
|
||||
long id_tipoSel = CR.getId_tipoSel();
|
||||
CR.setId_tipoSel(0L);
|
||||
req.setAttribute("listaTipoCR", new Tipo(apFull).findWebByArticoloCR(CR, 0, 0));
|
||||
CR.setId_tipoSel(id_tipoSel);
|
||||
}
|
||||
forceJspPage("/articoloCR.jsp", req);
|
||||
} else {
|
||||
forceJspPage("/form-ricerca-prodotti.jsp", req);
|
||||
}
|
||||
if (this.debug)
|
||||
System.out.println("catalogo -------------------");
|
||||
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());
|
||||
if (this.debug)
|
||||
System.out.println("attcr3" + CR.getFlgDisponibile());
|
||||
req.setAttribute("CR", CR);
|
||||
forceJspPage("/articoloVarianteCR.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected void searchVarianti(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("listaFiltri", lista.findByTipo(CR.getId_tipo(), getLang(req)));
|
||||
if (this.debug)
|
||||
System.out.println("attcr4" + CR.getFlgDisponibile());
|
||||
req.setAttribute("CR", CR);
|
||||
forceJspPage("/articoloVarianteCR.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _level1(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ArticoloCR CR = new ArticoloCR(apFull);
|
||||
fillObject(req, CR);
|
||||
if (!CR.getTag().isEmpty())
|
||||
req.getSession().removeAttribute("tag");
|
||||
if (this.debug)
|
||||
System.out.println("attcr5" + CR.getFlgDisponibile());
|
||||
req.setAttribute("CR", CR);
|
||||
long l_id_tipoPadre = CR.getId_tipoSel();
|
||||
Tipo tipo = new Tipo(apFull);
|
||||
tipo.findByPrimaryKey(l_id_tipoPadre);
|
||||
req.setAttribute("currentTipo", tipo);
|
||||
forceJspPage("/level1.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
private void updateCRFiltri(ArticoloCR CR, String currentFiltro, String currentValues) {
|
||||
if (currentValues.endsWith(","))
|
||||
currentValues = currentValues.substring(0, currentValues.length() - 1);
|
||||
if (!currentFiltro.isEmpty() && !currentValues.isEmpty())
|
||||
if (currentFiltro.toLowerCase().equals("m")) {
|
||||
CR.setId_marche(currentValues);
|
||||
} else if (currentFiltro.equals("pd")) {
|
||||
CR.setPrezzoDa((double)Long.parseLong(currentValues));
|
||||
} else if (currentFiltro.toLowerCase().equals("pa")) {
|
||||
CR.setPrezzoA((double)Long.parseLong(currentValues));
|
||||
} else if (currentFiltro.toLowerCase().equals("c")) {
|
||||
CR.setFlgCondizioni(currentValues);
|
||||
} else if (currentFiltro.toLowerCase().equals("d")) {
|
||||
CR.setFlgDisponibilita(currentValues);
|
||||
}
|
||||
}
|
||||
|
||||
public void _mdCodice(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String l_codice = getRequestParameter(req, "codice");
|
||||
Articolo bean = new Articolo(apFull);
|
||||
bean.findByCodice(l_codice);
|
||||
if (bean.getId_articolo() > 0L) {
|
||||
req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo()));
|
||||
showBean(req, res);
|
||||
} else {
|
||||
forceJspPage("/index.html", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void searchOLD(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ArticoloCR CR = new ArticoloCR(apFull);
|
||||
Articolo bean = new Articolo(apFull);
|
||||
String l_lang = getLang(req);
|
||||
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);
|
||||
}
|
||||
boolean faiRicerca = true;
|
||||
if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("**")) {
|
||||
CR.setCodice(CR.getSearchTxtWeb().substring(2));
|
||||
CR.setSearchTxtWeb("");
|
||||
bean.findByCodice(CR.getCodice());
|
||||
if (bean.getId_articolo() > 0L) {
|
||||
req.setAttribute("listaPadri", bean.getTipo().findPadri());
|
||||
req.setAttribute("act", "articolo");
|
||||
req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo()));
|
||||
super.showBean(req, res);
|
||||
faiRicerca = false;
|
||||
}
|
||||
} else if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("@")) {
|
||||
CR.setTagArticolo(CR.getSearchTxtWeb().substring(1));
|
||||
}
|
||||
String url = (String)req.getAttribute("_requestUrl");
|
||||
try {
|
||||
boolean redirect = false;
|
||||
if (url.indexOf("sendinblue") < 0)
|
||||
if (url.indexOf("addItem") > 0) {
|
||||
redirect = false;
|
||||
} else if (url.indexOf("Catalogo.abl?") > 0) {
|
||||
redirect = true;
|
||||
} else if (url.indexOf("_") > 0) {
|
||||
redirect = true;
|
||||
}
|
||||
if (redirect) {
|
||||
res.setStatus(301);
|
||||
res.setHeader("Location", "index.html");
|
||||
res.setHeader("Connection", "close");
|
||||
faiRicerca = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("----------------------------- ERRORE url\n" + url);
|
||||
}
|
||||
if (faiRicerca) {
|
||||
if (CR.getPageRow() > 96) {
|
||||
CR.setPageRow(96);
|
||||
} else if (CR.getPageRow() <= 0) {
|
||||
CR.setPageRow(12);
|
||||
}
|
||||
if (CR.getPageNumber() <= 0)
|
||||
CR.setPageNumber(1);
|
||||
if (!CR.getTag().isEmpty())
|
||||
req.getSession().removeAttribute("tag");
|
||||
CR.setId_tipo(CR.getId_tipoSel());
|
||||
CR.setFlgNascondi(0L);
|
||||
CR.setFlgEscludiWeb(0L);
|
||||
if (!CR.getFiltri_id().isEmpty()) {
|
||||
String filtri = "M,PD,PA,C,D,";
|
||||
StringTokenizer st = new StringTokenizer(CR.getFiltri_id(), ",");
|
||||
String currentFiltro = "";
|
||||
StringBuilder currentValues = new StringBuilder();
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = st.nextToken();
|
||||
if (filtri.contains(token + ",")) {
|
||||
updateCRFiltri(CR, currentFiltro, currentValues.toString());
|
||||
currentFiltro = token;
|
||||
currentValues = new StringBuilder();
|
||||
continue;
|
||||
}
|
||||
currentValues.append(token);
|
||||
currentValues.append(",");
|
||||
}
|
||||
updateCRFiltri(CR, currentFiltro, currentValues.toString());
|
||||
}
|
||||
bean.setId_iva(bean.getCodiceIvaVendStd());
|
||||
if (CR.getSearchTxtWeb().length() == 0) {
|
||||
CR.setPrezzoMax(bean.getPrezzoPubblicoIvaArticoloMaxByCR(CR));
|
||||
CR.setPrezzoMin(bean.getPrezzoPubblicoIvaArticoloMinByCR(CR));
|
||||
}
|
||||
String tag = "";
|
||||
if (req.getSession().getAttribute("tag") != null)
|
||||
tag = (String)req.getSession().getAttribute("tag");
|
||||
CR.setTag(tag);
|
||||
Vectumerator<Articolo> list = bean.findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req));
|
||||
try {
|
||||
ArticoloCR CRS = CR.getClone();
|
||||
req.getSession().setAttribute("CR", CRS);
|
||||
if (this.debug)
|
||||
System.out.println("attcr6" + CR.getFlgDisponibile());
|
||||
req.setAttribute("CR", CRS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (list.getTotNumberOfRecords() > 0) {
|
||||
req.setAttribute("list", list);
|
||||
req.setAttribute("listaPadri", CR.getTipo().findPadri());
|
||||
if (CR.getSearchTxtWeb().isEmpty()) {
|
||||
req.setAttribute("listaMarcheCR", new Marca(apFull).findMarchePresentiByTipoTag(CR.getId_tipo(), CR.getTag()));
|
||||
} else {
|
||||
req.setAttribute("listaMarcheCR", new Marca(apFull).findWebByArticoloCR(CR, 0, 0));
|
||||
long id_tipoSel = CR.getId_tipoSel();
|
||||
CR.setId_tipoSel(0L);
|
||||
req.setAttribute("listaTipoCR", new Tipo(apFull).findWebByArticoloCR(CR, 0, 0));
|
||||
CR.setId_tipoSel(id_tipoSel);
|
||||
}
|
||||
forceJspPage("/articoloCR.jsp", req);
|
||||
} else {
|
||||
forceJspPage("/form-ricerca-prodotti.jsp", req);
|
||||
}
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _fetchInclude(HttpServletRequest req, HttpServletResponse res) {
|
||||
String items = getRequestParameter(req, "items").trim();
|
||||
if (items.isEmpty()) {
|
||||
req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR);
|
||||
} else {
|
||||
String id_articolo = getRequestParameter(req, "id_articolo");
|
||||
if (!id_articolo.equals("undefined"))
|
||||
items = items.replace(id_articolo, "");
|
||||
items = items.replaceAll(",,", "");
|
||||
if (items.isEmpty() || items.equals(",")) {
|
||||
req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR);
|
||||
} else {
|
||||
ArticoloCR CR = new ArticoloCR();
|
||||
CR.setLastItems(items);
|
||||
req.setAttribute("lastItems", new Articolo(getApFull(req)).findWebByArticoloCR(CR, 0, 0));
|
||||
}
|
||||
}
|
||||
req.setAttribute("nf", getNf());
|
||||
req.setAttribute("nf0", getNf0());
|
||||
forceJspPage("/_inc_lastItems.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _infoProdotto(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
|
||||
Articolo bean = new Articolo(apFull);
|
||||
bean.findByPrimaryKey(l_id_articolo);
|
||||
if (bean.getId_articolo() > 0L) {
|
||||
ArticoloCR CR = (ArticoloCR)req.getSession().getAttribute("CR");
|
||||
if (CR == null)
|
||||
CR = new ArticoloCR(apFull);
|
||||
CR.setLang(getLang(req));
|
||||
if (this.debug)
|
||||
System.out.println("attcr7" + CR.getFlgDisponibile());
|
||||
req.setAttribute("CR", CR);
|
||||
req.setAttribute("bean", bean);
|
||||
forceJspPage("/form-info-prodotto.jsp", req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
forceJspPage("/form-ricerca-prodotti.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillObject(HttpServletRequest req, Object CRo) {
|
||||
ArticoloCR CR = (ArticoloCR)CRo;
|
||||
super.fillObject(req, CR);
|
||||
String q = getRequestParameter(req, "q");
|
||||
if (!q.isEmpty())
|
||||
CR.setSearchTxtWeb(q);
|
||||
}
|
||||
|
||||
public void _loadLastItems(HttpServletRequest req, HttpServletResponse res) {
|
||||
String items = getRequestParameter(req, "items").trim();
|
||||
if (items.isEmpty()) {
|
||||
req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR);
|
||||
} else {
|
||||
String id_articolo = getRequestParameter(req, "id_articolo");
|
||||
if (!id_articolo.equals("undefined"))
|
||||
items = items.replace(id_articolo, "");
|
||||
items = items.replaceAll(",,", "");
|
||||
if (items.isEmpty() || items.equals(",")) {
|
||||
req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR);
|
||||
} else {
|
||||
ArticoloCR CR = new ArticoloCR();
|
||||
CR.setLastItems(items);
|
||||
req.setAttribute("lastItems", new Articolo(getApFull(req)).findWebByArticoloCR(CR, 0, 0));
|
||||
}
|
||||
}
|
||||
req.setAttribute("nf", getNf());
|
||||
req.setAttribute("nf0", getNf0());
|
||||
forceJspPage("/_inc_lastItems.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.jsp.Ab;
|
||||
import it.acxent.servlet.AcServlet;
|
||||
import java.util.Locale;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class IndexWwwSvlt extends AcServlet {
|
||||
private static final long serialVersionUID = -6624665938374872005L;
|
||||
|
||||
private static final String HTML = ".html";
|
||||
|
||||
private static final String INDEX = "index-";
|
||||
|
||||
private static final String LOCATION = "Location";
|
||||
|
||||
private static final String _INC_MENU_JSP = "_inc_menu.jsp";
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
Attivita attivita = Attivita.getDefaultInstance(getApFull(req));
|
||||
String currentLang = (String)req.getSession().getAttribute("LANG".toLowerCase());
|
||||
if (currentLang == null || currentLang.isEmpty())
|
||||
currentLang = Ab.getBrowserLang(req, Locale.ENGLISH.getLanguage());
|
||||
if (attivita.getLangDisponibili().indexOf(currentLang) < 0)
|
||||
currentLang = attivita.getLangSeNonDisponibile();
|
||||
req.getSession().setAttribute("LANG".toLowerCase(), currentLang);
|
||||
String url = req.getRequestURL().toString();
|
||||
System.out.println("INDEX.HTML Incomming URL = " + url + " lang_:" + currentLang);
|
||||
res.setStatus(301);
|
||||
res.setHeader("Location", attivita.getWwwAddress() + "index-" + attivita.getWwwAddress() + ".html");
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.common.Users;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class LogonSvlt extends it.acxent.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() == getParm("USER_PROFILE_ID_WWW").getNumeroLong()) {
|
||||
forceJspPage(getLoginPage(req, null), req);
|
||||
return true;
|
||||
}
|
||||
forceJspPage(getLoginPage(req, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return false;
|
||||
} 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 it.acxent.anag.Users(apFull);
|
||||
}
|
||||
|
||||
protected void loginOK(HttpServletRequest req, HttpServletResponse res) throws Exception {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
req.setAttribute("msg", "");
|
||||
req.setAttribute("cmd", "updateCart");
|
||||
setJspPage("Cart.abl", req);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
}
|
||||
|
||||
protected boolean useControlCodeAccess() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void loginKO(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.loginKO(req, res);
|
||||
forceMessage(req, "Login errato o inesistente!");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,274 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.anag.TipoPagamento;
|
||||
import it.acxent.anag.Users;
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.common.Access;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.contab.DocumentoCR;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.util.AbMessages;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class OrdineSvlt extends it.acxent.www.servlet.OrdineSvlt {
|
||||
private static final long serialVersionUID = 8880000554136161006L;
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
Documento bean = (Documento)l_bean;
|
||||
req.setAttribute("listaTipoPagamento", new TipoPagamento(
|
||||
getApFull(req)).findPagamentiWww(!bean.getClifor().getId_nazione().equals("I"),
|
||||
(bean.getFlgDeliveryType() == 2L)));
|
||||
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
|
||||
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso));
|
||||
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 = "";
|
||||
if (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);
|
||||
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
|
||||
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso));
|
||||
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) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Documento bean = null;
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = getRequestLongParameter(req, "id_documento");
|
||||
bean = new Documento(apFull);
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
Users utente = (Users)getLoginUser(req);
|
||||
rp = attivita.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req);
|
||||
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);
|
||||
System.out.println("ordinesvlt beforeSearch: id_clifor " + user.getId_clifor());
|
||||
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 {
|
||||
forceJspPageRelative("documentoCR.jsp", req);
|
||||
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 _impostaMP(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users user = (Users)getLoginUser(req);
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
if (user != null && user.getDBState() == 1) {
|
||||
Documento bean = new Documento(apFull);
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento");
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
if (bean.getId_documento() > 0L) {
|
||||
bean.setId_tipoPagamento(l_id_tipoPagamento);
|
||||
bean.setSpeseTrasporto(bean.getDeliveryCostOrdine(user.getClifor()));
|
||||
ResParm rp = bean.save();
|
||||
if (rp.getStatus())
|
||||
attivita.sendOrderMailMessageCC(bean, user, user.getLang(), true, true, true, false, req);
|
||||
}
|
||||
showBean(req, res);
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected ResParm beforeSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
return super.beforeSave(beanA, req, res);
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
String temp = getBeanName(req);
|
||||
Users user = (Users)getLoginUser(req);
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Access access = new Access(getApFull(req));
|
||||
access.findByPrimaryKey(Access.convertFieldToTableName(temp));
|
||||
if (getRequestParameter(req, "sw").equals("1")) {
|
||||
if (!access.getSuffissoE().isEmpty())
|
||||
return temp + temp + "E";
|
||||
return temp + "E";
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBEANAttribute(HttpServletRequest req) {
|
||||
return super.getBEANAttribute(req);
|
||||
}
|
||||
|
||||
protected boolean isCostoSpedizioneFull() {
|
||||
return getParm("CC_COSTO_SPED_FULL").isTrue();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.anag.Users;
|
||||
import it.acxent.bank.paypal.PayPalResp;
|
||||
import it.acxent.cart.Cart;
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.gtm.GoogleDataLayer;
|
||||
import it.acxent.gtm.GoogleDataLayerBuilder;
|
||||
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);
|
||||
Users utente = (Users)getLoginUser(req);
|
||||
if (ppResponse != null && ppResponse.isPaymentDone()) {
|
||||
long l_id_ordine = ppResponse.getId_ordine();
|
||||
Documento bean = new Documento(apFull);
|
||||
System.out.println("paypaldopayment recordOrder: " + l_id_ordine);
|
||||
bean.findByProgOrdineWww(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.sendOrderMailMessageTuttofoto(utente, true, true, false, false);
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
if (attivita.isTagManagerAttivo()) {
|
||||
GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean));
|
||||
req.setAttribute("_gdl", gdl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
|
||||
long l_id_ordine = 0L;
|
||||
if (ppResponse != null)
|
||||
l_id_ordine = ppResponse.getId_ordine();
|
||||
Documento bean = new Documento(getApFull());
|
||||
bean.findByProgOrdineWww(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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.bank.paypal.PayPalResp;
|
||||
import it.acxent.bank.servlet.paypal.GetPayPalResponseSvlt;
|
||||
import it.acxent.cart.Cart;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PayPalResponseSvlt extends GetPayPalResponseSvlt {
|
||||
private static final long serialVersionUID = -7370187024494888710L;
|
||||
|
||||
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();
|
||||
Documento bean = new Documento(getApFull());
|
||||
bean.findByProgOrdineWww(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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.anag.Users;
|
||||
import it.acxent.bank.paypal.PayPalResp;
|
||||
import it.acxent.cart.Cart;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PayPalSvlt extends it.acxent.bank.servlet.paypal.PayPalSvlt {
|
||||
private static final long serialVersionUID = -7977873008193998783L;
|
||||
|
||||
protected static ApplParmFull ap2;
|
||||
|
||||
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();
|
||||
Documento bean = new Documento(getApFull());
|
||||
bean.findByProgOrdineWww(l_id_ordine);
|
||||
req.setAttribute("bean", bean);
|
||||
}
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users utente = (Users)getLoginUser(req);
|
||||
if (ppResponse != null && ppResponse.isPaymentDone()) {
|
||||
long l_id_ordine = ppResponse.getId_ordine();
|
||||
Documento bean = new Documento(apFull);
|
||||
System.out.println("paypalsvlt recordOrder: " + l_id_ordine);
|
||||
bean.findByProgOrdineWww(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()) {
|
||||
if (bean.getFlgWwwRichiedeFattura() == 1L) {
|
||||
long l = 22L;
|
||||
} else {
|
||||
long l = 23L;
|
||||
}
|
||||
rp = bean.sendOrderMailMessageTuttofoto(utente, true, true, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.processRequest(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.anag.Users;
|
||||
import it.acxent.bank.paypalcheckout.PayPalReq;
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.gtm.GoogleDataLayer;
|
||||
import it.acxent.gtm.GoogleDataLayerBuilder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class PaypalCheckoutSvlt extends it.acxent.bank.servlet.paypalcheckout.PaypalCheckoutSvlt {
|
||||
private static final long serialVersionUID = 5775575153032080843L;
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, JSONObject jso) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String orderId = jso.getString("id");
|
||||
String status = jso.getString("status");
|
||||
System.out.println("paypalsvltcheckout recordOrder prog www: status" + status + " orderid:" + orderId);
|
||||
if (status.equals("COMPLETED")) {
|
||||
Documento bean = new Documento(apFull);
|
||||
bean.findByDescTransaction(orderId);
|
||||
System.out.println("paypalsvltcheckout recordOrder prog www: " + bean.getProgOrdineWww() + " TROVATO E APPROVATO");
|
||||
bean.setDataPagamento(DBAdapter.getToday());
|
||||
bean.setDataTransaction(DBAdapter.getToday());
|
||||
bean.setDescTransaction(orderId);
|
||||
bean.setFlgPagata(1L);
|
||||
ResParm rp = bean.save();
|
||||
if (rp.getStatus()) {
|
||||
if (bean.getFlgWwwRichiedeFattura() == 1L) {
|
||||
long l = 22L;
|
||||
} else {
|
||||
long l = 23L;
|
||||
}
|
||||
Attivita attivita1 = Attivita.getDefaultInstance(apFull);
|
||||
Users utente = (Users)getLoginUser(req);
|
||||
rp = attivita1.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req);
|
||||
}
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
if (attivita.isTagManagerAttivo()) {
|
||||
GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean));
|
||||
req.setAttribute("_gdl", gdl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected PayPalReq getPayPalReq(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
PayPalReq pReq = new PayPalReq();
|
||||
String l_id_docCrypt = getRequestParameter(req, "id");
|
||||
long l_id = 0L;
|
||||
try {
|
||||
l_id = Long.parseLong(DBAdapter.deCrypt(l_id_docCrypt));
|
||||
} catch (Exception e) {}
|
||||
if (l_id > 0L) {
|
||||
Documento doc = new Documento(apFull);
|
||||
doc.findByPrimaryKey(l_id);
|
||||
pReq.setId_ordine(doc.getId_documento());
|
||||
pReq.setAmt(doc.getTotaleDocumento());
|
||||
}
|
||||
return pReq;
|
||||
}
|
||||
|
||||
protected void updatePaypalOrderId(HttpServletRequest req, PayPalReq pReq) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Documento doc = new Documento(apFull);
|
||||
doc.findByPrimaryKey(pReq.getId_ordine());
|
||||
if (doc.getId_documento() > 0L) {
|
||||
doc.setDescTransaction(pReq.getPaypalOrderId());
|
||||
doc.superSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.contab.DocumentoCR;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.util.AbMessages;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ResoSvlt extends it.acxent.www.servlet.ResoSvlt {
|
||||
private static final long serialVersionUID = -1875981812979270687L;
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
Documento bean = (Documento)l_bean;
|
||||
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
|
||||
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso));
|
||||
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,76 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.anag.Users;
|
||||
import it.acxent.bank.sella.SellaResp;
|
||||
import it.acxent.bank.servlet.sella.GetSellaResponseSvlt;
|
||||
import it.acxent.cart.Cart;
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.gtm.GoogleDataLayer;
|
||||
import it.acxent.gtm.GoogleDataLayerBuilder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class RicevutaSellaSvlt extends GetSellaResponseSvlt {
|
||||
private static final long serialVersionUID = -5795730239132540019L;
|
||||
|
||||
protected static ApplParmFull ap2;
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
|
||||
boolean debug = false;
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users utente = (Users)getLoginUser(req);
|
||||
if (sellaRes != null && sellaRes.getMyerrorcode().equals("0")) {
|
||||
long l_id_ordine = sellaRes.getId_ordine();
|
||||
if (debug)
|
||||
l_id_ordine = 48081L;
|
||||
Documento bean = new Documento(apFull);
|
||||
System.out.println("sella recordOrder: " + l_id_ordine);
|
||||
bean.findByProgOrdineWww(l_id_ordine);
|
||||
bean.setDataPagamento(DBAdapter.getToday());
|
||||
bean.setDataTransaction(DBAdapter.getToday());
|
||||
bean.setDescTransaction(sellaRes.getMyauthcode());
|
||||
bean.setFlgPagata(1L);
|
||||
ResParm rp = bean.save();
|
||||
if (rp.getStatus())
|
||||
rp = bean.sendOrderMailMessageTuttofoto(utente, true, true, false, false);
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
if (attivita.isTagManagerAttivo()) {
|
||||
GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean));
|
||||
req.setAttribute("_gdl", gdl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
|
||||
boolean debug = false;
|
||||
long l_id_ordine = 0L;
|
||||
if (sellaRes != null)
|
||||
l_id_ordine = sellaRes.getId_ordine();
|
||||
if (debug)
|
||||
l_id_ordine = 48081L;
|
||||
Documento bean = new Documento(getApFull());
|
||||
bean.findByProgOrdineWww(l_id_ordine);
|
||||
if (debug) {
|
||||
sellaRes.setMyerrorcode("0");
|
||||
recordOrder(req, res, sellaRes);
|
||||
}
|
||||
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,40 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.anag.Users;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ShowOrdineSvlt extends it.acxent.www.servlet.ShowOrdineSvlt {
|
||||
private static final long serialVersionUID = 3253536598483259418L;
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.otherCommands(req, res);
|
||||
}
|
||||
|
||||
public void _vediOrdineCrypt(HttpServletRequest req, HttpServletResponse res) {
|
||||
String l_id_userCript = getRequestParameter(req, "uc");
|
||||
if (l_id_userCript.isEmpty()) {
|
||||
super._vediOrdineCrypt(req, res);
|
||||
} else {
|
||||
String l_login = DBAdapter.deCrypt(l_id_userCript);
|
||||
if (!l_login.isEmpty()) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users user = new Users(apFull);
|
||||
user.findByLogin(l_login);
|
||||
if (user.isNoReg()) {
|
||||
String ip = req.getRemoteHost();
|
||||
user.setCurrentIp(ip);
|
||||
req.getSession().setAttribute("utenteLogon", user);
|
||||
req.getSession().setAttribute("loginUser_id", new Long(user.getId_users()));
|
||||
super._vediOrdineCrypt(req, res);
|
||||
} else {
|
||||
search(req, res);
|
||||
}
|
||||
} else {
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.anag.TipoPagamento;
|
||||
import it.acxent.anag.Users;
|
||||
import it.acxent.bank.servlet.stripe._StripeResponseSvlt;
|
||||
import it.acxent.bank.stripe.StripeResp;
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.gtm.GoogleDataLayer;
|
||||
import it.acxent.gtm.GoogleDataLayerBuilder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class StripeResponseSvlt extends _StripeResponseSvlt {
|
||||
private static final long serialVersionUID = -4056911711739700875L;
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, StripeResp stripeRes) {
|
||||
boolean debug = false;
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String status = stripeRes.getRedirect_status();
|
||||
String clientSecret = stripeRes.getPayment_intent_client_secret();
|
||||
if (debug)
|
||||
System.out.println("StripeSvlt recordOrder prog www: status" + status + " clientSecret:" + clientSecret);
|
||||
if (status.equals("succeeded")) {
|
||||
Documento bean = new Documento(apFull);
|
||||
bean.findByDescTransactionStripe(stripeRes.getPayment_intent_client_secret());
|
||||
if (debug)
|
||||
System.out.println("StripeSvlt recordOrder prog www: " + bean.getProgOrdineWww() + " TROVATO E APPROVATO");
|
||||
bean.setDataPagamento(DBAdapter.getToday());
|
||||
bean.setDataTransaction(DBAdapter.getToday());
|
||||
bean.setDescTransaction(clientSecret);
|
||||
bean.setFlgPagata(1L);
|
||||
ResParm rp = bean.save();
|
||||
if (rp.getStatus()) {
|
||||
if (bean.getFlgWwwRichiedeFattura() == 1L) {
|
||||
long l = 22L;
|
||||
} else {
|
||||
long l = 23L;
|
||||
}
|
||||
Attivita attivita1 = Attivita.getDefaultInstance(apFull);
|
||||
Users utente = (Users)getLoginUser(req);
|
||||
rp = attivita1.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req);
|
||||
}
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
if (attivita.isTagManagerAttivo()) {
|
||||
GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean));
|
||||
req.setAttribute("_gdl", gdl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, StripeResp stripeRes) {
|
||||
boolean debug = false;
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String clientSecret = null;
|
||||
if (stripeRes != null) {
|
||||
String status = stripeRes.getRedirect_status();
|
||||
clientSecret = stripeRes.getPayment_intent_client_secret();
|
||||
}
|
||||
Documento bean = new Documento(apFull);
|
||||
bean.findByDescTransactionStripe(clientSecret);
|
||||
if (debug) {
|
||||
clientSecret = "xxx";
|
||||
stripeRes.setRedirect_status("succeeded");
|
||||
recordOrder(req, res, stripeRes);
|
||||
}
|
||||
req.setAttribute("bean", bean);
|
||||
req.setAttribute("listaTipoPagamento", new TipoPagamento(
|
||||
getApFull(req)).findPagamentiWww(!bean.getClifor().getId_nazione().equals("I"),
|
||||
(bean.getFlgDeliveryType() == 2L)));
|
||||
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
|
||||
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.bank.servlet.stripe._StripeSvlt;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ResParm;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class StripeSvlt extends _StripeSvlt {
|
||||
private static final long serialVersionUID = -1087656160829384851L;
|
||||
|
||||
protected ResParm saveClientSecret(HttpServletRequest req, long l_id, String l_clientSecret) {
|
||||
Documento doc = new Documento(getApFull(req));
|
||||
doc.findByPrimaryKey(l_id);
|
||||
if (doc.getId_documento() > 0L) {
|
||||
doc.setDescTransactionStripe(l_clientSecret);
|
||||
return doc.superSave();
|
||||
}
|
||||
return new ResParm(false, "no doc found:" + l_id);
|
||||
}
|
||||
|
||||
protected long getAmount(HttpServletRequest req, long l_id) {
|
||||
Documento doc = new Documento(getApFull(req));
|
||||
doc.findByPrimaryKey(l_id);
|
||||
if (doc.getId_documento() > 0L)
|
||||
return Math.round(doc.getTotaleDocumento() * 100.0D);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,544 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.anag.Cliente;
|
||||
import it.acxent.anag.Clifor;
|
||||
import it.acxent.anag.DestinazioneDiversa;
|
||||
import it.acxent.anag.Nazione;
|
||||
import it.acxent.anag.NazioneCR;
|
||||
import it.acxent.anag.Users;
|
||||
import it.acxent.anag.UsersCR;
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.reg.EcDc;
|
||||
import it.acxent.util.CodiceFiscale;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class UsersSvlt extends it.acxent.www.servlet.UsersSvlt {
|
||||
private static final long serialVersionUID = 2411106203332570806L;
|
||||
|
||||
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) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
NazioneCR nCR = new NazioneCR();
|
||||
nCR.setLang(getLang(req));
|
||||
req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req)));
|
||||
sendMessage(req, "");
|
||||
Users bean = new Users(apFull);
|
||||
bean.setFlgMl(1L);
|
||||
bean.setId_userProfile(bean.getIdUserProfileWww());
|
||||
bean.setId_nazione("I");
|
||||
bean.setCallingJsp(getRequestParameter(req, "callingJsp"));
|
||||
bean.setId_documento(getRequestLongParameter(req, "id_documento"));
|
||||
try {
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
} catch (Exception e) {}
|
||||
req.setAttribute("bean", bean);
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
String temp = super.getBeanPageName(req);
|
||||
Users user = (Users)getLoginUser(req);
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
if (user != null && user.getDBState() == 1 &&
|
||||
user.isProfileNoReg())
|
||||
temp = "usersNoReg";
|
||||
return temp;
|
||||
}
|
||||
|
||||
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) {
|
||||
Attivita attivita = Attivita.getDefaultInstance(getApFull(req));
|
||||
return attivita.sendUserDataMailMessageCC(bean, getLang(req), req).getStatus();
|
||||
}
|
||||
|
||||
protected String getRegistrazioneMailMessage() {
|
||||
return getParm("MAIL_REG").getTesto();
|
||||
}
|
||||
|
||||
protected void sqlActions(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String l_lang = getLang(req);
|
||||
Users bean = new Users(apFull);
|
||||
long l_id_users = getRequestLongParameter(req, "id_users");
|
||||
if (l_id_users > 0L)
|
||||
bean.findByPrimaryKey(l_id_users);
|
||||
fillObject(req, bean);
|
||||
bean.setEMail(bean.getLogin());
|
||||
req.setAttribute("eMail", bean.getLogin());
|
||||
Cliente cli = new Cliente(getApFull(req));
|
||||
if (bean.getId_users() > 0L)
|
||||
cli.findByPrimaryKey(bean.getId_clifor());
|
||||
fillObject(req, cli);
|
||||
DestinazioneDiversa dd = new DestinazioneDiversa(getApFull(req));
|
||||
fillObject(req, dd);
|
||||
cli.setCurrentDD(dd);
|
||||
bean.setClifor(cli);
|
||||
String msg = bean.translate("Impossibile Registrare un nuovo utente:", l_lang);
|
||||
boolean continuoRegistrazione = true;
|
||||
if (l_id_users == 0L || (l_id_users > 0L && bean.isProfileNoReg()))
|
||||
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()));
|
||||
req.getSession().setAttribute("_sendUserMail", String.valueOf(userMl.getId_users()));
|
||||
saveUserAndClifor(req, res);
|
||||
} else if (userMl.getId_userProfile() == bean.getIdUserProfileNoReg()) {
|
||||
if (userMl.getClifor().getCodFisc().toLowerCase().equals(bean.getCodFisc().toLowerCase())) {
|
||||
req.setAttribute("id_users", String.valueOf(userMl.getId_users()));
|
||||
req.setAttribute("flgValido", "S");
|
||||
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
|
||||
req.getSession().setAttribute("_sendUserMail", String.valueOf(userMl.getId_users()));
|
||||
saveUserAndClifor(req, res);
|
||||
} else {
|
||||
msg = msg + " Email associata ad un codice fiscale diverso!";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
req.setAttribute("beanUser", bean);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} else {
|
||||
msg = msg + " " + msg;
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
req.setAttribute("beanUser", bean);
|
||||
continuoRegistrazione = false;
|
||||
callJsp(req, res);
|
||||
}
|
||||
} else if (cli.isCodFiscDuplicated()) {
|
||||
msg = msg + " " + msg;
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
|
||||
cli.setCodFisc("");
|
||||
bean.setCodFisc("");
|
||||
bean.setClifor(cli);
|
||||
req.setAttribute("beanUser", bean);
|
||||
continuoRegistrazione = false;
|
||||
callJsp(req, res);
|
||||
} else if (cli.isPIvaDuplicated()) {
|
||||
msg = msg + " " + msg;
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
|
||||
bean.setPIva("");
|
||||
cli.setPIva("");
|
||||
bean.setPIva("");
|
||||
bean.setClifor(cli);
|
||||
req.setAttribute("beanUser", bean);
|
||||
continuoRegistrazione = false;
|
||||
callJsp(req, res);
|
||||
} else if (!cli.getCodFisc().isEmpty() && cli.getId_nazione().toLowerCase().equals("i") &&
|
||||
!CodiceFiscale.controlloFormale(cli.getCodFisc())) {
|
||||
msg = msg + " " + msg;
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
|
||||
cli.setCodFisc("");
|
||||
bean.setCodFisc("");
|
||||
bean.setClifor(cli);
|
||||
req.setAttribute("beanUser", bean);
|
||||
continuoRegistrazione = false;
|
||||
callJsp(req, res);
|
||||
} else if (!cli.getPIva().isEmpty() && cli.getId_nazione().toLowerCase().equals("i") && cli.getPIva().length() != 11) {
|
||||
msg = msg + " " + msg;
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
|
||||
bean.setPIva("");
|
||||
cli.setPIva("");
|
||||
bean.setPIva("");
|
||||
bean.setClifor(cli);
|
||||
req.setAttribute("beanUser", bean);
|
||||
continuoRegistrazione = false;
|
||||
callJsp(req, res);
|
||||
}
|
||||
if (continuoRegistrazione) {
|
||||
if (bean.isProfileNoReg() || bean.isProfilML()) {
|
||||
req.setAttribute("flgValido", "N");
|
||||
} else {
|
||||
req.setAttribute("flgValido", "S");
|
||||
}
|
||||
if (bean.getId_userProfile() == 0L)
|
||||
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
|
||||
saveUserAndClifor(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void recordMailingList(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
String l_lang = getLang(req);
|
||||
Users bean = new Users(apFull);
|
||||
fillObject(req, bean);
|
||||
ResParm rp = new ResParm();
|
||||
String msg = attivita.translate("Impossibile Registrare utente ML:", l_lang);
|
||||
if (bean.isEmailDuplicated()) {
|
||||
msg = msg + " " + msg + " - " + attivita.translate("Email già presente in archivio", l_lang);
|
||||
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(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()) {
|
||||
Clifor clifor = new Clifor(apFull);
|
||||
clifor.setFlgTipo("C");
|
||||
clifor.setCognome(bean.getCognome());
|
||||
clifor.setNome(bean.getNome());
|
||||
clifor.setEMail(bean.getEMail());
|
||||
clifor.setFlgMl(1L);
|
||||
rp = clifor.save();
|
||||
if (rp.getStatus()) {
|
||||
bean.setId_clifor(clifor.getId_clifor());
|
||||
rp.append(bean.save());
|
||||
}
|
||||
if (!rp.getStatus())
|
||||
handleDebug("recordMailingList: " + rp.getMsg(), 0);
|
||||
attivita.sendMLMailMessage(bean, getLang(req), req);
|
||||
}
|
||||
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 = bean.translate("Impossibile Registrare utente ML:", getLang(req));
|
||||
if (bean.isEmailDuplicated()) {
|
||||
msg = msg + " Email già presente in archivio - " + msg;
|
||||
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(req.getRemoteHost() + " " + req.getRemoteHost());
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected it.acxent.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;
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String l_lang = getLang(req);
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
long l_id_user = getRequestLongParameter(req, "id_users");
|
||||
if (bean.getDBState() == 1) {
|
||||
msg = attivita.translate("Salvataggio effettuato", l_lang);
|
||||
req.getSession().setAttribute("utenteLogon", bean);
|
||||
req.getSession().setAttribute("loginUser_id", new Long(bean.getId_users()));
|
||||
if (req.getSession().getAttribute("_sendUserMail") != null || l_id_user == 0L) {
|
||||
req.getSession().removeAttribute("_sendUserMail");
|
||||
if (!mailConfermaCambiamentoDati(req, bean)) {
|
||||
msg = msg + " " + msg;
|
||||
bean.setFlgEmailOk(0L);
|
||||
} else {
|
||||
msg = msg + " Inviata mail di conferma.";
|
||||
bean.setFlgEmailOk(1L);
|
||||
}
|
||||
} else {
|
||||
bean.setFlgEmailOk(1L);
|
||||
}
|
||||
setJspPageRelative(getBeanPageName(req) + "Reg.jsp", req);
|
||||
} else {
|
||||
msg = attivita.translate("ERRORE!. Non è stato possibile salvare. Contattare l'amministratore o immettere login diverso", l_lang);
|
||||
}
|
||||
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("MLF")) {
|
||||
recordMailingListF(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) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users user = new Users(apFull);
|
||||
long l_id_users = getRequestLongParameter(req, "id_users");
|
||||
String l_lang = getLang(req);
|
||||
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);
|
||||
cliente.setFlgTipo("C");
|
||||
if (cliente.getFlgAzienda() == 1L) {
|
||||
cliente.setNome("");
|
||||
cliente.setCognome(getRequestParameter(req, "ragioneSociale"));
|
||||
}
|
||||
cliente.setContatto(user.getCognomeNome());
|
||||
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(user.getIdUserProfileWww());
|
||||
user.setFlgValido("S");
|
||||
rp.append(user.save());
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
afterSave((DBAdapter)user, req, res);
|
||||
forceMessage(req, user.translate("Record salvato correttamente", l_lang));
|
||||
String callingJsp = getRequestParameter(req, "callingJsp");
|
||||
if (callingJsp.isEmpty()) {
|
||||
req.setAttribute("bean", user);
|
||||
forceJspPage("/usersReg.jsp", req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
if (l_id_documento > 0L) {
|
||||
Documento documento = new Documento(apFull);
|
||||
documento.findByPrimaryKey(l_id_documento);
|
||||
if (documento.getId_documento() > 0L) {
|
||||
documento.setSpeseTrasporto(documento.getDeliveryCostOrdine(user.getClifor()));
|
||||
rp = documento.save();
|
||||
}
|
||||
}
|
||||
if (callingJsp.endsWith("html")) {
|
||||
try {
|
||||
res.sendRedirect(callingJsp);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
forceJspPage("/" + callingJsp, req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sendMessage(req, user.translate("Impossibile salvare: ", l_lang) + user.translate("Impossibile salvare: ", l_lang));
|
||||
forceJspPage("/users.jsp", req);
|
||||
req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req)));
|
||||
req.setAttribute("bean", user);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkUserCF(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String l_cf = getRequestParameter(req, "codFiscR");
|
||||
String l_lang = getLang(req);
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
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, "C");
|
||||
if (clifor.getDBState() == 0) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(attivita.translate("Il Codice Fiscale richiesto non è nei nostri database.", l_lang));
|
||||
} else if (clifor.getDBState() == 1 && clifor.getEMail().isEmpty()) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(
|
||||
attivita.translate("Il Codice Fiscale è nei nostri database ma l'indirizzo email non è stato comunicato.", l_lang));
|
||||
} else {
|
||||
Users user = new Users(getApFull(req));
|
||||
Vectumerator<Users> 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(user.getIdUserProfileWww());
|
||||
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(attivita.translate("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email", l_lang) + " " + attivita.translate("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email", l_lang));
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(attivita.translate("Utente creato correttamente ma non è stato possibile inviare l'email di conferma.", l_lang));
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(attivita.translate("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.", l_lang));
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
protected void recordMailingListF(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String l_lang = getLang(req);
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
Users bean = new Users(getApFull(req));
|
||||
String l_eMail = EcDc.decode64String(getRequestParameter(req, "eMail"));
|
||||
ResParm rp = new ResParm(false);
|
||||
String msg = attivita.translate("Impossibile Registrare utente : ", l_lang);
|
||||
bean.findByEmail(l_eMail);
|
||||
if (bean.getDBState() == 1) {
|
||||
if (bean.getFlgValido().equals("N")) {
|
||||
msg = msg + "Email " + msg + l_eMail;
|
||||
rp.setErrorCode(9L);
|
||||
} else if (bean.getFlgMl() == 1L) {
|
||||
msg = msg + "Email " + msg + l_eMail;
|
||||
rp.setErrorCode(9L);
|
||||
} else {
|
||||
bean.setFlgMl(1L);
|
||||
rp = bean.save();
|
||||
msg = "Email " + l_eMail + " iscritta correttamente alla newsletter.";
|
||||
if (rp.getStatus())
|
||||
rp.append(bean.sendMLMailMessage(req.getRemoteHost() + " " + req.getRemoteHost(), bean.getLang()));
|
||||
if (!rp.getStatus()) {
|
||||
msg = msg + msg + " " + attivita.translate(" Attenzione. Ci sono stati problemi nella registrazione o nell'invio della mail di conferma: ", l_lang);
|
||||
rp.setErrorCode(9L);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
msg = msg + "Email " + msg + " " + l_eMail;
|
||||
rp.setErrorCode(9L);
|
||||
}
|
||||
sendMessage(req, msg);
|
||||
rp.setMsg(msg);
|
||||
req.setAttribute("RP", rp);
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected String getBEANAttribute(HttpServletRequest req) {
|
||||
return super.getBEANAttribute(req) + "User";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package it.acxent.cc.servlet;
|
||||
|
||||
import it.acxent.cart.Cart;
|
||||
import it.acxent.common.Users;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.servlet.AblServletSvlt;
|
||||
import java.text.NumberFormat;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class _CCvlt extends AblServletSvlt {
|
||||
public static final String PARM_PRONTA_CONSEGNA = "flgProntaConsegna";
|
||||
|
||||
private static NumberFormat nf0;
|
||||
|
||||
protected boolean checkLoginProfile(HttpServletRequest req) {
|
||||
try {
|
||||
if (getLoginUser(req) == null) {
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
return true;
|
||||
}
|
||||
if (getLoginUser(req).getFlgValido().equals("N")) {
|
||||
forceJspPage(super.getLoginPage(null, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return false;
|
||||
}
|
||||
if (getLoginUser(req).getId_userProfile() > 0L)
|
||||
return true;
|
||||
forceJspPage(super.getLoginPage(null, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected long getLoginUserGrant(HttpServletRequest req, String l_permesso) {
|
||||
return super.getLoginUserGrant(req, l_permesso);
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return "Registra.abl";
|
||||
}
|
||||
|
||||
protected Users getUser(HttpServletRequest req) {
|
||||
ApplParmFull apFull = getApFull();
|
||||
return new it.acxent.anag.Users(apFull);
|
||||
}
|
||||
|
||||
protected boolean useAlwaysSendRedirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getPathImgArticoli() {
|
||||
return getDocBase() + "/" + getDocBase();
|
||||
}
|
||||
|
||||
public long getHomeType() {
|
||||
return getParm("HOME_TYPE").getNumeroLong();
|
||||
}
|
||||
|
||||
protected int getPageRow(HttpServletRequest req) {
|
||||
int pageRow = getParm("PAGE_ROW").getNumeroInt();
|
||||
return (pageRow == 0) ? 4 : pageRow;
|
||||
}
|
||||
|
||||
public NumberFormat getNf0(HttpServletRequest req) {
|
||||
if (nf0 == null) {
|
||||
nf0 = NumberFormat.getInstance(getLocale(req));
|
||||
nf0.setMaximumFractionDigits(0);
|
||||
nf0.setMinimumFractionDigits(0);
|
||||
}
|
||||
return nf0;
|
||||
}
|
||||
|
||||
protected double getDeliveryCost(HttpServletRequest req) {
|
||||
return getParm(Cart.P_DELIVERY_COST).getNumeroDouble();
|
||||
}
|
||||
|
||||
protected double getMoreCost(HttpServletRequest req) {
|
||||
return getParm(Cart.P_MORE_COST).getNumeroDouble();
|
||||
}
|
||||
|
||||
protected double getDeliveryWarnCost(HttpServletRequest req) {
|
||||
return getParm(Cart.P_DELIVERY_WARN_COST).getNumeroDouble();
|
||||
}
|
||||
|
||||
protected long getFlgProntaConsegna(HttpServletRequest req) {
|
||||
if (req.getSession().getAttribute("flgProntaConsegna") == null || ((String)
|
||||
req.getSession().getAttribute("flgProntaConsegna")).isEmpty())
|
||||
return 0L;
|
||||
try {
|
||||
return Long.parseLong((String)req.getSession().getAttribute("flgProntaConsegna"));
|
||||
} catch (Exception e) {
|
||||
handleDebug(e, 2);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
package it.acxent.cc.servlet.admin;
|
||||
|
||||
import it.acxent.art.Articolo;
|
||||
import it.acxent.art.ArticoloCR;
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.cc.CCCronSendGoogleXml;
|
||||
import it.acxent.cc.CCImport;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ArticoloSvlt extends it.acxent.art.servlet.ArticoloSvlt {
|
||||
private static final long serialVersionUID = -2291450542550759704L;
|
||||
|
||||
public void _sendGoogleXml(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCCronSendGoogleXml sgx = new CCCronSendGoogleXml();
|
||||
ResParm rp = sgx.crontabJob(apFull);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importListinoIngramMicro(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
ResParm rp = bean.startImportIngramMicro(apFull, 0L, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importDispoIngramMicro(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
ResParm rp = bean.startImportIngramMicro(apFull, 1L, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliDatamaticMail(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
ResParm rp = bean.startImportDatamaticMail(apFull, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliEsprinet(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
String fileCsv = getPathTmpFull() + getPathTmpFull();
|
||||
ResParm rp = bean.startImportEsprinet(apFull, fileCsv, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliBrevi(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
String fileCsv = getPathTmpFull() + getPathTmpFull();
|
||||
ResParm rp = bean.startImportBrevi(apFull, fileCsv, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
Attivita attivita = Attivita.getDefaultInstance(getApFull(req));
|
||||
super.fillComboAfterDetail(l_bean, req, res);
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
super.fillComboAfterSearch(CR, req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliLogicom(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
String fileCsv = getPathTmpFull() + getPathTmpFull();
|
||||
ResParm rp = bean.startImportLogicom(apFull, fileCsv, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliDatamatic(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
String fileCsv = getPathTmpFull() + getPathTmpFull();
|
||||
ResParm rp = bean.startImportDatamatic(apFull, fileCsv, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliLogicomMail(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
ResParm rp = bean.startImportLogicomMail(apFull, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliFlexit(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
String fileCsv = getPathTmpFull() + getPathTmpFull();
|
||||
ResParm rp = bean.startImportFlexit(apFull, fileCsv, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliFlexitMail(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
ResParm rp = bean.startImportFlexitMail(apFull, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importRunner(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
String s_flgTipoImport = getRequestParameter(req, "flgTipoImportRunner");
|
||||
String[] s_flgTipoImportA = s_flgTipoImport.split(",");
|
||||
long[] result = new long[s_flgTipoImportA.length];
|
||||
for (int i = 0; i < s_flgTipoImportA.length; i++)
|
||||
result[i] = Long.parseLong(s_flgTipoImportA[i]);
|
||||
ResParm rp = bean.startImportRunner(apFull, result, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importSiaeIngramMicro(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
ResParm rp = bean.startImportIngramMicro(apFull, 2L, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliCgross(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
ResParm rp = bean.startImportCgross(apFull, null, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importArticoliCgrossWeb(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
String fileZip = getPathTmpFull() + getPathTmpFull();
|
||||
ResParm rp = bean.startImportCgross(apFull, fileZip, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _importBestit(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CCImport bean = new CCImport();
|
||||
String s_flgTipoImport = getRequestParameter(req, "flgTipoImportBestit");
|
||||
String[] s_flgTipoImportA = s_flgTipoImport.split(",");
|
||||
long[] result = new long[s_flgTipoImportA.length];
|
||||
for (int i = 0; i < s_flgTipoImportA.length; i++)
|
||||
result[i] = Long.parseLong(s_flgTipoImportA[i]);
|
||||
ResParm rp = bean.startImportBestit(apFull, result, true);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _creaSitemapsStandard(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Articolo art = new Articolo(apFull);
|
||||
ArticoloCR ACR = new ArticoloCR(apFull);
|
||||
ACR.setFlgReadyForWeb(0L);
|
||||
ACR.setFlgEscludiWeb(-1L);
|
||||
ACR.setFlgQta(1L);
|
||||
ACR.setQtaDa(1L);
|
||||
ACR.setQtaA(9999L);
|
||||
ResParm rp = art.startThreadCreaSitemaps(getApFull(), ACR);
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,306 @@
|
|||
package it.acxent.cc.servlet.admin;
|
||||
|
||||
import it.acxent.anag.Listino;
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.cc.AttivitaCR;
|
||||
import it.acxent.cc.TipoAttivita;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.mail.MailMessage;
|
||||
import it.acxent.servlet.AblServletSvlt;
|
||||
import it.acxent.servlet.AddImgSvlt;
|
||||
import java.io.File;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/cc/Attivita.abl"})
|
||||
public class AttivitaSvlt extends AblServletSvlt implements AddImgSvlt {
|
||||
private static final long serialVersionUID = 4963856767196841700L;
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
req.setAttribute("listaTipoAttivita", new TipoAttivita(apFull).findAll());
|
||||
req.setAttribute("listaListino", new Listino(apFull).findNoListinoBase());
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
req.setAttribute("listaTipoAttivita", new TipoAttivita(apFull).findAll());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Attivita(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new AttivitaCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
req.setAttribute("listaTipoAttivita", new TipoAttivita(apFull).findAll());
|
||||
}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isLoadImageServlet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
req.getSession().removeAttribute("attivita");
|
||||
Attivita.resetDefaultInstance();
|
||||
return super.afterSave(beanA, req, res);
|
||||
}
|
||||
|
||||
public void _mdd(HttpServletRequest req, HttpServletResponse res) {
|
||||
Attivita attivita = Attivita.getDefaultInstance(getApFull(req));
|
||||
req.setAttribute("id_attivita", Long.valueOf(attivita.getId_attivita()));
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _caricaPrivacy(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
|
||||
Attivita bean = new Attivita(apFull);
|
||||
bean.findByPrimaryKey(l_id_attivita);
|
||||
fillObject(req, bean);
|
||||
String l_fileName = getDocBase() + "admin/cc/_template/privacy-" + getDocBase() + ".html";
|
||||
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
|
||||
MailMessage mf = new MailMessage(apFull, l_fileName);
|
||||
mf.setString("ragioneSociale", bean.getNomeAttivita());
|
||||
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
|
||||
mf.setString("cf", bean.getCodFisc());
|
||||
mf.setString("responsabileTrattamento", bean.getContatto());
|
||||
bean.setDescTxtLang("privacy", bean.getCurrentLang(), mf.getMessage());
|
||||
bean.save();
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _caricaCookiePolicy(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
|
||||
Attivita bean = new Attivita(apFull);
|
||||
bean.findByPrimaryKey(l_id_attivita);
|
||||
fillObject(req, bean);
|
||||
String l_fileName = getDocBase() + "admin/cc/_template/cookiePolicy-" + getDocBase() + ".html";
|
||||
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
|
||||
MailMessage mf = new MailMessage(apFull, l_fileName);
|
||||
mf.setString("ragioneSociale", bean.getNomeAttivita());
|
||||
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
|
||||
mf.setString("cf", bean.getCodFisc());
|
||||
mf.setString("pec", bean.getPec());
|
||||
mf.setString("email", bean.getEmailAttivita());
|
||||
mf.setString("sito", req.getHeader("Host"));
|
||||
mf.setString("pIva", bean.getPIva());
|
||||
mf.setString("indirizzoRestituzione", bean.getIndirizzoCompletoAttivita());
|
||||
mf.setString("responsabileTrattamento", bean.getContatto());
|
||||
bean.setDescTxtLang("cookiePolicyText", bean.getCurrentLang(), mf.getMessage());
|
||||
bean.save();
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
protected ResParm beforeSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
Attivita bean = (Attivita)beanA;
|
||||
if (bean.getWwwAddress().isEmpty()) {
|
||||
String serverName;
|
||||
if (req.getHeader("x-forwarded-proto") == null) {
|
||||
serverName = req.getScheme() + "://" + req.getScheme() + req.getServerName() + "/";
|
||||
} else {
|
||||
serverName = req.getHeader("x-forwarded-proto") + "://" + req.getHeader("x-forwarded-proto") + req.getServerName() + "/";
|
||||
}
|
||||
bean.setWwwAddress(serverName);
|
||||
}
|
||||
return super.beforeSave(beanA, req, res);
|
||||
}
|
||||
|
||||
public void _caricaFooter(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
|
||||
Attivita bean = new Attivita(apFull);
|
||||
bean.findByPrimaryKey(l_id_attivita);
|
||||
fillObject(req, bean);
|
||||
String l_fileName = getDocBase() + "admin/cc/_template/footer-" + getDocBase() + ".html";
|
||||
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
|
||||
MailMessage mf = new MailMessage(apFull, l_fileName);
|
||||
mf.setString("ragioneSociale", bean.getNomeAttivita());
|
||||
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
|
||||
mf.setString("cf", bean.getCodFisc());
|
||||
mf.setString("telefono", bean.getTelefonoAttivita());
|
||||
mf.setString("email", bean.getEmailAttivita());
|
||||
mf.setString("pIva", bean.getPIva());
|
||||
mf.setString("sdi", bean.getCodiceIdentificativoFE());
|
||||
mf.setString("pec", bean.getPec());
|
||||
bean.setDescTxtLang("footerText", bean.getCurrentLang(), mf.getMessage());
|
||||
bean.save();
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _caricaTermsConditions(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
|
||||
Attivita bean = new Attivita(apFull);
|
||||
bean.findByPrimaryKey(l_id_attivita);
|
||||
fillObject(req, bean);
|
||||
String l_fileName = getDocBase() + "admin/cc/_template/termsConditions-" + getDocBase() + ".html";
|
||||
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
|
||||
MailMessage mf = new MailMessage(apFull, l_fileName);
|
||||
mf.setString("ragioneSociale", bean.getNomeAttivita());
|
||||
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
|
||||
mf.setString("cf", bean.getCodFisc());
|
||||
mf.setString("email", bean.getEmailAttivita());
|
||||
mf.setString("sito", req.getHeader("Host"));
|
||||
mf.setString("pIva", bean.getPIva());
|
||||
mf.setString("indirizzoRestituzione", bean.getIndirizzoCompletoAttivita());
|
||||
mf.setString("responsabileTrattamento", bean.getContatto());
|
||||
bean.setDescTxtLang("termConditions", bean.getCurrentLang(), mf.getMessage());
|
||||
bean.save();
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _sendNotificheWishlist(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
|
||||
Attivita bean = new Attivita(apFull);
|
||||
bean.findByPrimaryKey(l_id_attivita);
|
||||
ResParm rp = bean.startThreadNotifiche();
|
||||
System.out.println(rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _ebayCreaMerchantLocationKey(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Attivita bean = new Attivita(apFull);
|
||||
long l_id = getRequestLongParameter(req, "id_attivita");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_attivita() > 0L) {
|
||||
fillObject(req, bean);
|
||||
ResParm rp = bean.save();
|
||||
if (rp.getStatus()) {
|
||||
rp = bean.ebayCreaMerchantLocationKey();
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, rp.getErrMsg());
|
||||
}
|
||||
} else {
|
||||
sendMessage(req, rp.getErrMsg());
|
||||
}
|
||||
showBean(req, res);
|
||||
} else {
|
||||
sendMessage(req, "Errore! Attivita non trovato");
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _ebayReturnPolicyId(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Attivita bean = new Attivita(apFull);
|
||||
long l_id = getRequestLongParameter(req, "id_attivita");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_attivita() > 0L) {
|
||||
ResParm rp = bean.ebayUpdateReturnPolicyId();
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, rp.getErrMsg());
|
||||
}
|
||||
showBean(req, res);
|
||||
} else {
|
||||
sendMessage(req, "Errore! Attivita non trovato");
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _amzUpdateTokens(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Attivita bean = new Attivita(apFull);
|
||||
long l_id = getRequestLongParameter(req, "id_attivita");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_attivita() > 0L) {
|
||||
ResParm rp = bean.amzUpdateTokens(false);
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, rp.getErrMsg());
|
||||
}
|
||||
showBean(req, res);
|
||||
} else {
|
||||
sendMessage(req, "Errore! Attivita non trovato");
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _ebayFulfillmentPolicyId(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Attivita bean = new Attivita(apFull);
|
||||
long l_id = getRequestLongParameter(req, "id_attivita");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_attivita() > 0L) {
|
||||
ResParm rp = bean.ebayUpdateFulfillmentPolicyId();
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, rp.getErrMsg());
|
||||
}
|
||||
showBean(req, res);
|
||||
} else {
|
||||
sendMessage(req, "Errore! Attivita non trovato");
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _caricaDirittoDiRecesso(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
|
||||
Attivita bean = new Attivita(apFull);
|
||||
bean.findByPrimaryKey(l_id_attivita);
|
||||
fillObject(req, bean);
|
||||
String l_fileName = getDocBase() + "admin/cc/_template/dirittoDiRecesso-" + getDocBase() + ".html";
|
||||
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
|
||||
MailMessage mf = new MailMessage(apFull, l_fileName);
|
||||
mf.setString("ragioneSociale", bean.getNomeAttivita());
|
||||
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
|
||||
mf.setString("cf", bean.getCodFisc());
|
||||
mf.setString("pec", bean.getPec());
|
||||
mf.setString("email", bean.getEmailAttivita());
|
||||
mf.setString("sito", req.getHeader("Host"));
|
||||
mf.setString("pIva", bean.getPIva());
|
||||
mf.setString("indirizzoRestituzione", bean.getIndirizzoCompletoAttivita());
|
||||
mf.setString("responsabileTrattamento", bean.getContatto());
|
||||
bean.setDescTxtLang("dirittoDiRecesso", bean.getCurrentLang(), mf.getMessage());
|
||||
bean.save();
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _ebayPaymentPolicyId(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Attivita bean = new Attivita(apFull);
|
||||
long l_id = getRequestLongParameter(req, "id_attivita");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_attivita() > 0L) {
|
||||
ResParm rp = bean.ebayUpdatePaymentPolicyId();
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, rp.getErrMsg());
|
||||
}
|
||||
showBean(req, res);
|
||||
} else {
|
||||
sendMessage(req, "Errore! Attivita non trovato");
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package it.acxent.cc.servlet.admin;
|
||||
|
||||
import it.acxent.cc.TipoAttivita;
|
||||
import it.acxent.cc.TipoAttivitaCR;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.servlet.AblServletSvlt;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/cc/TipoAttivita.abl"})
|
||||
public class TipoAttivitaSvlt extends AblServletSvlt {
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new TipoAttivita(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new TipoAttivitaCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
package it.acxent.cc.servlet.admin;
|
||||
|
||||
import it.acxent.cc.WwwAutomator;
|
||||
import it.acxent.cc.WwwAutomatorCR;
|
||||
import it.acxent.cc.servlet._CCvlt;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/cc/WwwAutomator.abl"})
|
||||
public class WwwAutomatorSvlt extends _CCvlt {
|
||||
private static final long serialVersionUID = 5418623699135974920L;
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new WwwAutomator(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new WwwAutomatorCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _duplicaAutomator(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = getRequestLongParameter(req, "id_wwwAutomator");
|
||||
WwwAutomator bean = new WwwAutomator(apFull);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_wwwAutomator() > 0L) {
|
||||
bean.setId_wwwAutomator(0L);
|
||||
bean.setDBState(0);
|
||||
bean.setUltimaEsecuzione("");
|
||||
req.setAttribute("bean", bean);
|
||||
forceMessage(req, "Attenzione! Il Record è stato Duplicato!!");
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _eseguiAutomatorFullCR(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
WwwAutomator bean = new WwwAutomator(apFull);
|
||||
WwwAutomatorCR CR = new WwwAutomatorCR();
|
||||
fillObject(req, CR);
|
||||
CR.setFlgAbilita(1L);
|
||||
bean.startAutomator(getApFull(), CR, false);
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _spostaGiu(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = getRequestLongParameter(req, "id_wwwAutomatorSposta");
|
||||
WwwAutomator bean = new WwwAutomator(apFull);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_wwwAutomator() > 0L) {
|
||||
ResParm rp = bean.spostaGiu();
|
||||
sendMessage(req, rp.getMsg());
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _spostaSu(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = getRequestLongParameter(req, "id_wwwAutomatorSposta");
|
||||
WwwAutomator bean = new WwwAutomator(apFull);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_wwwAutomator() > 0L) {
|
||||
ResParm rp = bean.spostaSu();
|
||||
sendMessage(req, rp.getMsg());
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _eseguiAutomatorCR(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = getRequestLongParameter(req, "id_wwwAutomator");
|
||||
WwwAutomator bean = new WwwAutomator(apFull);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_wwwAutomator() > 0L) {
|
||||
ResParm rp = bean.eseguiAutomator();
|
||||
sendMessage(req, rp.getMsg());
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _eseguiAutomator(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id = getRequestLongParameter(req, "id_wwwAutomator");
|
||||
WwwAutomator bean = new WwwAutomator(apFull);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_wwwAutomator() > 0L) {
|
||||
ResParm rp = bean.eseguiAutomator();
|
||||
sendMessage(req, rp.getMsg());
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _ripristinoOrdine(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
WwwAutomator bean = new WwwAutomator(apFull);
|
||||
bean.ripristinoOrdine();
|
||||
sendMessage(req, "Ordine tipo + ordine ripristinato");
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package it.acxent.cc.servlet;
|
||||
Loading…
Add table
Add a link
Reference in a new issue