first commit

This commit is contained in:
MaddoScientisto 2026-03-14 20:04:39 +01:00
commit 4d332ef662
27586 changed files with 3281783 additions and 0 deletions

View file

@ -0,0 +1,253 @@
package com.ablia.www;
import com.ablia.anag.Users;
import com.ablia.db.ApplParmFull;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Locale;
public class Promozione extends _WwwAdapter implements Serializable {
public static long PROMOZIONE_VALIDA = 0L;
public static long PROMOZIONE_SCADUTA = 1L;
public static long PROMOZIONE_NON_VALIDA = 3L;
public static long PROMOZIONE_UTENTE_NULL = 2L;
private long flgUtilizzoPerUtente;
private String codicePromozione;
private Date dataInizio;
private Date dataFine;
private long percSconto;
private String descrizione;
private Date dataUtilizzoPromozione;
private long numUtilizziMax;
private long numUtilizzi;
private long id_promozione;
public Promozione(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public Promozione() {}
public void setId_promozione(long newId_promozione) {
this.id_promozione = newId_promozione;
}
public void setDataInizio(Date newDataInizio) {
this.dataInizio = newDataInizio;
}
public void setDataFine(Date newDataFine) {
this.dataFine = newDataFine;
}
public void setPercSconto(long newPercSconto) {
this.percSconto = newPercSconto;
}
public long getId_promozione() {
return this.id_promozione;
}
public Date getDataInizio() {
return this.dataInizio;
}
public Date getDataFine() {
return this.dataFine;
}
public long getPercSconto() {
return this.percSconto;
}
public long isValid(Users l_users) {
if (getId_promozione() == 0L)
return PROMOZIONE_NON_VALIDA;
if (getFlgUtilizzoPerUtente() == 0L) {
if (getNumUtilizziMax() > 0L && getNumUtilizzi() >= getNumUtilizziMax())
return PROMOZIONE_SCADUTA;
return isDateValid() ? PROMOZIONE_VALIDA : PROMOZIONE_SCADUTA;
}
if (getNumUtilizziMax() == 0L)
return isDateValid() ? PROMOZIONE_VALIDA : PROMOZIONE_SCADUTA;
if (isDateValid()) {
if (getNumUtilizziMax() == 0L)
return PROMOZIONE_VALIDA;
if (l_users == null || l_users.getId_users() == 0L)
return PROMOZIONE_UTENTE_NULL;
PromozioneUser po = new PromozioneUser(getApFull());
long numUtilizziUtente = po.getNumutilizziByUserPromozione(l_users.getId_users(), getId_promozione());
if (numUtilizziUtente >= getNumUtilizziMax())
return PROMOZIONE_SCADUTA;
return PROMOZIONE_VALIDA;
}
return PROMOZIONE_SCADUTA;
}
protected void deleteCascade() {}
public Vectumerator findByCR(PromozioneCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from PROMOZIONE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByCodicePromozione(String l_codicePromozione) {
String s_Sql_Find = "select DISTINCT A.* from PROMOZIONE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.codicePromozione='" + l_codicePromozione + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public String getCodicePromozione() {
return (this.codicePromozione == null) ? "" : this.codicePromozione;
}
public void setCodicePromozione(String codicePromozione) {
this.codicePromozione = codicePromozione;
}
public boolean useDescLangTables() {
return true;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public ResParm save() {
setDescrizione(getDescrizione(Locale.ITALIAN.getLanguage()));
return super.save();
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public static final synchronized ResParm addUtilizzo(Promozione bean, long l_id_user, long l_id_documento) {
if (bean.getId_promozione() > 0L) {
bean.setNumUtilizzi(bean.getNumUtilizzi() + 1L);
bean.setDataUtilizzoPromozione(getToday());
ResParm rp = bean.save();
if (rp.getStatus()) {
PromozioneUser pu = new PromozioneUser(bean.getApFull());
pu.setId_users(l_id_user);
pu.setId_documento(l_id_documento);
pu.setId_promozione(bean.getId_promozione());
rp = pu.save();
}
if (rp.getStatus())
return new ResParm(true, "Promozione aggiornata!");
return rp;
}
return new ResParm(false, "Promozione Non Valida");
}
public void setDataUtilizzoPromozione(Date dataUtilizzoPromozione) {
this.dataUtilizzoPromozione = dataUtilizzoPromozione;
}
public long getNumUtilizziMax() {
return this.numUtilizziMax;
}
public void setNumUtilizziMax(long numUtilizziMax) {
this.numUtilizziMax = numUtilizziMax;
}
public long getNumUtilizzi() {
return this.numUtilizzi;
}
public void setNumUtilizzi(long numUtilizzi) {
this.numUtilizzi = numUtilizzi;
}
public long getFlgUtilizzoPerUtente() {
return this.flgUtilizzoPerUtente;
}
public void setFlgUtilizzoPerUtente(long flgUtilizzoPerUtente) {
this.flgUtilizzoPerUtente = flgUtilizzoPerUtente;
}
public Date getDataUtilizzoPromozione() {
return this.dataUtilizzoPromozione;
}
public String getDescrizioneCompleta() {
if (getId_promozione() == 0L)
return "";
return String.valueOf(getDescrizione()) + " codice: " + getCodicePromozione() + " Sconto: " + getPercSconto() + "%";
}
public String getDescrizioneCompleta(String lang) {
if (getId_promozione() == 0L)
return "";
return String.valueOf(getDescrizione()) + " " + translate("codice", lang) + ": " + getCodicePromozione() + " " + translate("Sconto", lang) + ": " +
getPercSconto() + "%";
}
private boolean isDateValid() {
Date today = getToday();
if (this.dataInizio == null && this.dataFine == null)
return true;
if (this.dataInizio != null && this.dataFine == null) {
if (getDateDiff(this.dataInizio, today) >= 0L)
return true;
return false;
}
if (this.dataInizio == null && this.dataFine != null) {
if (getDateDiff(today, this.dataFine) >= 0L)
return true;
return false;
}
if (getDateDiff(this.dataInizio, today) >= 0L && getDateDiff(today, this.dataFine) >= 0L)
return true;
return false;
}
}

View file

@ -0,0 +1,83 @@
package com.ablia.www;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import java.sql.Date;
public class PromozioneCR extends CRAdapter {
private long id_promozione;
private String descrizione;
private Date dataInizio;
private Date dataFine;
private long percSconto;
private Date dataDa;
private Date dataA;
public PromozioneCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public PromozioneCR() {}
public void setId_promozione(long newId_promozione) {
this.id_promozione = newId_promozione;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setDataInizio(Date newDataInizio) {
this.dataInizio = newDataInizio;
}
public void setDataFine(Date newDataFine) {
this.dataFine = newDataFine;
}
public void setPercSconto(long newPercSconto) {
this.percSconto = newPercSconto;
}
public long getId_promozione() {
return this.id_promozione;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
public Date getDataInizio() {
return this.dataInizio;
}
public Date getDataFine() {
return this.dataFine;
}
public long getPercSconto() {
return this.percSconto;
}
public Date getDataDa() {
return this.dataDa;
}
public void setDataDa(Date dataDa) {
this.dataDa = dataDa;
}
public Date getDataA() {
return this.dataA;
}
public void setDataA(Date dataA) {
this.dataA = dataA;
}
}

View file

@ -0,0 +1,160 @@
package com.ablia.www;
import com.ablia.anag.Users;
import com.ablia.contab.Documento;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class PromozioneUser extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1570012255698L;
private long id_promozioneUser;
private long id_promozione;
private long id_users;
private long id_documento;
private Promozione promozione;
private Users users;
private Documento documento;
public PromozioneUser(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public PromozioneUser() {}
public void setId_promozioneUser(long newId_promozioneUser) {
this.id_promozioneUser = newId_promozioneUser;
}
public void setId_promozione(long newId_promozione) {
this.id_promozione = newId_promozione;
setPromozione(null);
}
public void setId_users(long newId_users) {
this.id_users = newId_users;
setUsers(null);
}
public void setId_documento(long newId_documento) {
this.id_documento = newId_documento;
setDocumento(null);
}
public long getId_promozioneUser() {
return this.id_promozioneUser;
}
public long getId_promozione() {
return this.id_promozione;
}
public long getId_users() {
return this.id_users;
}
public long getId_documento() {
return this.id_documento;
}
public void setPromozione(Promozione newPromozione) {
this.promozione = newPromozione;
}
public Promozione getPromozione() {
this.promozione = (Promozione)getSecondaryObject(this.promozione, Promozione.class, getId_promozione());
return this.promozione;
}
public void setUsers(Users newUsers) {
this.users = newUsers;
}
public Users getUsers() {
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users());
return this.users;
}
public void setDocumento(Documento newDocumento) {
this.documento = newDocumento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento());
return this.documento;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<PromozioneUser> findByCR(PromozioneUserCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from PROMOZIONE_USER AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator<PromozioneUser> findByPromozione(long l_id_promozione) {
String s_Sql_Find = "select DISTINCT A.* from PROMOZIONE_USER AS A inner join DOCUMENTO AS B ON A.id_documento=B.id_documento";
String s_Sql_Order = " order by B.dataDocumento , B.progDocumento desc ";
WcString wc = new WcString();
wc.addWc("A.id_promozione=" + l_id_promozione);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public long getNumutilizziByUserPromozione(long l_id_users, long l_id_promozione) {
String s_Sql_Find = "select COUNT(*) AS _count from PROMOZIONE_USER AS A ";
WcString wc = new WcString();
wc.addWc("A.id_users=" + l_id_users);
wc.addWc("A.id_promozione=" + l_id_promozione);
try {
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc);
return getCount(stmt, "_count");
} catch (Exception e) {
handleDebug(e, 0);
return 0L;
}
}
}

View file

@ -0,0 +1,97 @@
package com.ablia.www;
import com.ablia.anag.Users;
import com.ablia.contab.Documento;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
public class PromozioneUserCR extends CRAdapter {
private long id_promozioneUser;
private long id_promozione;
private long id_users;
private long id_documento;
private Promozione promozione;
private Users users;
private Documento documento;
public PromozioneUserCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public PromozioneUserCR() {}
public void setId_promozioneUser(long newId_promozioneUser) {
this.id_promozioneUser = newId_promozioneUser;
}
public void setId_promozione(long newId_promozione) {
this.id_promozione = newId_promozione;
setPromozione(null);
}
public void setId_users(long newId_users) {
this.id_users = newId_users;
setUsers(null);
}
public void setId_documento(long newId_documento) {
this.id_documento = newId_documento;
setDocumento(null);
}
public long getId_promozioneUser() {
return this.id_promozioneUser;
}
public long getId_promozione() {
return this.id_promozione;
}
public long getId_users() {
return this.id_users;
}
public long getId_documento() {
return this.id_documento;
}
public void setPromozione(Promozione newPromozione) {
this.promozione = newPromozione;
}
public Promozione getPromozione() {
this.promozione = (Promozione)getSecondaryObject(
this.promozione,
Promozione.class, getId_promozione());
return this.promozione;
}
public void setUsers(Users newUsers) {
this.users = newUsers;
}
public Users getUsers() {
this.users = (Users)getSecondaryObject(
(DBAdapter)this.users,
Users.class, getId_users());
return this.users;
}
public void setDocumento(Documento newDocumento) {
this.documento = newDocumento;
}
public Documento getDocumento() {
this.documento = (Documento)getSecondaryObject(
this.documento,
Documento.class, getId_documento());
return this.documento;
}
}

View file

@ -0,0 +1,58 @@
package com.ablia.www;
import com.ablia.anag._AnagAdapter;
import com.ablia.db.ApplParmFull;
public class _WwwAdapter extends _AnagAdapter {
public static final long PAG_BONIFICO = 1L;
public static final long PAG_CC = 0L;
public static final long PAG_CONTANTI = 4L;
public static final long PAG_CONTRASSEGNO = 3L;
public static final long PAG_PAYPAL = 2L;
public static final long PAG_POSTEPAY = 5L;
public static final long PAG_RITIRO_IN_NEGOZIO = 7L;
public static final long PAG_VAGLIA = 6L;
public static final String P_MSG_TIPO_PAG_BONIFICO = "MSG_TP_BONIFICO";
public static final String P_MSG_TIPO_PAG_BONIFICO_NO_PROC = "MSG_TP_BONIFICO_NO_PROC";
public static final String P_MSG_TIPO_PAG_CARTA_DI_CREDITO = "MSG_TP_CARTA_DI_CREDITO";
public static final String P_MSG_TIPO_PAG_CARTA_DI_CREDITO_NO_PROC = "MSG_TP_CARTA_DI_CREDITO_NO_PRO";
public static final String P_MSG_TIPO_PAG_CONTRASSEGNO = "MSG_TP_CONTRASSEGNO";
public static final String P_MSG_TIPO_PAG_POSTAGIRO = "MSG_TP_POSTAGIRO";
public static final String P_MSG_TIPO_PAG_POSTAGIRO_NO_PROC = "MSG_TP_POSTAGIRO_NO_PROC";
public static final String P_MSG_TIPO_PAG_POSTEPAY = "MSG_TIPO_PAG_POSTEPAY";
public static final String P_MSG_TIPO_PAG_POSTEPAY_NO_PROC = "MSG_TIPO_PAG_POSTEPAY_NO_PROC";
public static final String P_MSG_TIPO_PAG_SALDO_NEGOZIO = "MSG_TP_NEGOZIO";
public static final String P_MSG_TIPO_PAG_SALDO_NEGOZIO_NO_PROC = "MSG_TP_NEGOZIO_NO_PROC";
public static final long STATO_PAG_NON_PAGATO = 0L;
public static final long STATO_PAG_PAGATO = 2L;
public static final long STATO_PAG_TRANS_OK = 1L;
public _WwwAdapter() {}
public _WwwAdapter(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
protected void deleteCascade() {}
}

View file

@ -0,0 +1,371 @@
package com.ablia.www.servlet;
import com.ablia.anag.Cliente;
import com.ablia.anag.Clifor;
import com.ablia.anag.DestinazioneDiversa;
import com.ablia.anag.TipoPagamento;
import com.ablia.art.Articolo;
import com.ablia.art.ArticoloVariante;
import com.ablia.cart.AcCartObject;
import com.ablia.cart.Cart;
import com.ablia.cart.CartItem;
import com.ablia.cart.CartStatus;
import com.ablia.common.Users;
import com.ablia.contab.Documento;
import com.ablia.contab.RigaDocumento;
import com.ablia.db.ResParm;
import com.ablia.servlet.AcCartSvlt;
import com.ablia.util.CodiceFiscale;
import com.ablia.util.DoubleOperator;
import com.ablia.util.Vectumerator;
import com.ablia.www.Promozione;
import java.sql.Date;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CartSvlt extends AcCartSvlt {
public AcCartObject getCartObject(HttpServletRequest req) throws Exception {
String l_id = getRequestParameter(req, "id");
long l_id_articolo = 0L, l_id_articoloVariante = 0L;
if (!l_id.isEmpty()) {
if (l_id.indexOf("av_") >= 0) {
l_id_articoloVariante = Long.parseLong(l_id.substring(3));
req.setAttribute("id_articoloVariante", Long.valueOf(l_id_articoloVariante));
} else {
l_id_articolo = Long.parseLong(l_id);
req.setAttribute("id_articolo", Long.valueOf(l_id_articolo));
}
} else {
l_id_articolo = getRequestLongParameter(req, "id_articolo");
l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante");
}
int l_quantity = (int)getRequestLongParameter(req, "qt");
if (l_quantity == 0)
l_quantity = 1;
if (l_id_articoloVariante > 0L) {
ArticoloVariante av = new ArticoloVariante(getApFull(req));
av.findByPrimaryKey(l_id_articoloVariante);
req.setAttribute("bean", av);
AcCartObject acCartObject = new AcCartObject(ArticoloVariante.class, av.getItemId(), (double)l_quantity);
return acCartObject;
}
Articolo bean = new Articolo(getApFull(req));
bean.findByPrimaryKey(l_id_articolo);
req.setAttribute("bean", bean);
AcCartObject aco = new AcCartObject(Articolo.class, bean.getItemId(), (double)l_quantity);
return aco;
}
protected double getDeliveryCost(HttpServletRequest req, Cart cart) {
return getParm(Cart.P_DELIVERY_COST).getNumeroDouble();
}
protected double getMoreCost(HttpServletRequest req) {
return getParm(Cart.P_MORE_COST).getNumeroDouble();
}
protected Users getUser(HttpServletRequest req) {
return new com.ablia.anag.Users(getApFull(req));
}
protected ResParm recordOrder(HttpServletRequest req, HttpServletResponse res) {
ResParm rp = new ResParm(true);
synchronized (this) {
try {
System.out.println("record ORDINE ----------------------------");
Cart cart = getCart(req);
com.ablia.anag.Users utente = (com.ablia.anag.Users)getLoginUser(req);
long l_id_tipoOrdine = getParm("ID_DOC_ORDINE_WWW").getNumeroLong();
Documento ordine = new Documento(getApFull(req));
ordine.setId_tipoDocumento(l_id_tipoOrdine);
ordine.setFlgStato(1L);
ordine.setId_clifor(utente.getId_clifor());
ordine.setDataDocumento(new Date(new java.util.Date().getTime()));
ordine.setNominativoDocumento(utente.getDescrizione());
ordine.setFlgRitiroNegozio(cart.getFlgPickup());
if (cart.getMoreCost() > 0.0D) {
DoubleOperator temp = new DoubleOperator(cart.getMoreCost());
temp.add(cart.getDeliveryCost());
ordine.setSpeseTrasporto(temp.getResult());
} else {
ordine.setSpeseTrasporto(cart.getDeliveryCost());
}
if (req.getParameter("note") != null && !req.getParameter("note").equals(""))
ordine.setNote(req.getParameter("note"));
ordine.setFlgStatoOrdineWww(0L);
ordine.setFlgStatoPrenotazione(0L);
ordine.setFlgPagata(0L);
long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento");
ordine.setId_tipoPagamento(l_id_tipoPagamento);
if (getParm(Cart.P_PROCEDI_PAGAMENTO).getNumeroLong() == 1L)
ordine.setFlgProcediPagamento(1L);
rp = ordine.save();
Enumeration<CartItem> enu = cart.getItems();
String lang = getLang(req);
while (enu.hasMoreElements()) {
CartItem ci = enu.nextElement();
if (ci.getQuantity() > 0.0D) {
RigaDocumento rigaOrdine = new RigaDocumento(getApFull(req));
if (ci.getDbItem() instanceof ArticoloVariante) {
ArticoloVariante av = (ArticoloVariante)ci.getDbItem();
rigaOrdine.setId_articolo(av.getId_articolo());
rigaOrdine.setId_articoloVariante(av.getId_articoloVariante());
rigaOrdine.setQuantita((double)(int)ci.getQuantity());
rigaOrdine.setQuantitaUdm((double)(int)ci.getQuantity());
rigaOrdine.setImponibile(av.getPrezzoArticolo(ordine.getClifor()).getPrezzoBase());
rigaOrdine.setSconto(av.getPrezzoArticolo(ordine.getClifor()).getPercSconto());
rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticoloVariante().getDescrizioneCompleta());
rigaOrdine.setId_iva(av.getArticolo().getId_iva());
} else {
Articolo articolo = (Articolo)ci.getDbItem();
rigaOrdine.setId_articolo(articolo.getId_articolo());
rigaOrdine.setQuantita((double)(int)ci.getQuantity());
rigaOrdine.setImponibile(articolo.getPrezzoArticolo(ordine.getClifor()).getPrezzoBase());
rigaOrdine.setSconto(articolo.getPrezzoArticolo(ordine.getClifor()).getPercSconto());
rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta());
rigaOrdine.setId_iva(articolo.getId_iva());
}
rp = Documento.addRigaDocumento(ordine, rigaOrdine);
}
}
ordine.setFlgStato(1L);
ordine.save();
rp = ordine.sendOrderMailMessage("it", true, true, false);
System.out.println("fine record ORDINE ############");
req.setAttribute(PROP_ORDER, ordine);
int ordineInverso = (ordine.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
req.setAttribute("righeDocumento", ordine.findRigheDocumento(0, 0, ordineInverso));
TipoPagamento tp = new TipoPagamento(getApFull(req));
Vectumerator<TipoPagamento> vec = tp.findPagamentiWww(ordine.getFlgRitiroNegozio());
req.setAttribute("listaTipoPagamento", vec);
forceJspPageRelative("documento.jsp", req);
} catch (Exception e) {
handleDebug(e);
sendMessage(req, "CheckOut: record order error: " + e.getMessage());
}
}
return rp;
}
protected ResParm sendCheckOutMessage(HttpServletRequest req, HttpServletResponse res) {
Documento ordine = (Documento)req.getAttribute(PROP_ORDER);
ResParm rp = new ResParm(true);
if (ordine.getTipoPagamento().getFlgTipoPagamento() == 2L ||
ordine.getTipoPagamento().getFlgTipoPagamento() == 3L)
rp = ordine.sendOrderMailMessage(getLang(req), true, true, false);
return rp;
}
protected String getJspOrderPage(HttpServletRequest req) {
return "ordine.jsp";
}
protected boolean useControlCodeAccess() {
return false;
}
protected void afterCheckOut(HttpServletRequest req, HttpServletResponse res) {
String l_lang = getLang(req);
String l_codicePromozione = getRequestParameter(req, "codicePromozione");
Cart cart = getCart(req);
if (!l_codicePromozione.isEmpty()) {
CartStatus cs = (CartStatus)req.getAttribute(ATTR_CART_STATUS);
Promozione promozione = new Promozione(getApFull(req));
promozione.findByCodicePromozione(l_codicePromozione);
if (promozione.getDBState() == 0) {
sendMessage(req, "Codice Promozione non valido.");
} else {
com.ablia.anag.Users utente = (com.ablia.anag.Users)getLoginUser(req);
long resPromo = promozione.isValid(utente);
if (resPromo == Promozione.PROMOZIONE_VALIDA) {
cart.setDiscountPerc(promozione.getPercSconto());
cart.setDescDiscountPerc(promozione.getDescrizione(l_lang));
cart.setDescDiscount(promozione.getCodicePromozione());
setCart(req, cart);
} else if (resPromo == Promozione.PROMOZIONE_SCADUTA) {
sendMessage(req, "Codice Promozione scaduta.");
} else if (resPromo == Promozione.PROMOZIONE_NON_VALIDA) {
sendMessage(req, "Codice Promozione Non Valida.");
} else if (resPromo == Promozione.PROMOZIONE_UTENTE_NULL) {
sendMessage(req, "Codice Promozione per Utente. Devi fare il login per poterla utilizzare.");
}
}
}
req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req)).findPagamentiWww(cart.getFlgPickup()));
long flgPayment = getRequestLongParameter(req, "id_tipoPagamento");
cart.setFlgPayment(flgPayment);
if (flgPayment == 15L) {
cart.setMoreCost(getMoreCost(req));
cart.setDescMoreCost("Contrassegno");
} else {
cart.setMoreCost(0.0D);
cart.setDescMoreCost("");
}
if (cart.getFlgPickup() == 1L) {
cart.setDeliveryCost(0.0D);
} else {
cart.setDeliveryCost(getDeliveryCost(req, cart));
}
setCart(req, cart);
super.afterCheckOut(req, res);
}
protected void afterModifyItems(HttpServletRequest req, HttpServletResponse res) {
String l_lang = getLang(req);
String l_codicePromozione = getRequestParameter(req, "codicePromozione");
if (!l_codicePromozione.isEmpty()) {
Cart cart = getCart(req);
CartStatus cs = (CartStatus)req.getAttribute(ATTR_CART_STATUS);
Promozione promozione = new Promozione(getApFull(req));
promozione.findByCodicePromozione(l_codicePromozione);
if (promozione.getDBState() == 0) {
sendMessage(req, "Codice Promozione non valido.");
} else {
com.ablia.anag.Users utente = (com.ablia.anag.Users)getLoginUser(req);
long resPromo = promozione.isValid(utente);
if (resPromo == Promozione.PROMOZIONE_VALIDA) {
cart.setDiscountPerc(promozione.getPercSconto());
cart.setDescDiscountPerc(promozione.getDescrizione(l_lang));
cart.setDescDiscount(promozione.getCodicePromozione());
setCart(req, cart);
} else if (resPromo == Promozione.PROMOZIONE_SCADUTA) {
sendMessage(req, "Codice Promozione scaduta.");
} else if (resPromo == Promozione.PROMOZIONE_NON_VALIDA) {
sendMessage(req, "Codice Promozione Non Valida.");
} else if (resPromo == Promozione.PROMOZIONE_UTENTE_NULL) {
sendMessage(req, "Codice Promozione per Utente. Devi fare il login per poterla utilizzare.");
}
}
}
super.afterModifyItems(req, res);
}
protected String getJspHomePage(HttpServletRequest req) {
return "documentoCR.jsp";
}
protected boolean checkAvailability(HttpServletRequest req) {
return true;
}
protected ResParm sendLostPasswordMessage(HttpServletRequest req, HttpServletResponse res) {
com.ablia.anag.Users user = new com.ablia.anag.Users(getApFull(req));
String lostEmail = getRequestParameter(req, AcCartSvlt.ATTR_LOSTPWDEMAIL);
if (lostEmail.isEmpty())
return new ResParm(false, "Email errata");
return user.sendLostPasswordMailMessage(lostEmail);
}
protected ResParm saveUser(HttpServletRequest req, HttpServletResponse res) {
ResParm rp = new ResParm(true);
com.ablia.anag.Users bean = new com.ablia.anag.Users(getApFull(req));
fillObject(req, bean);
Cliente cli = new Cliente(getApFull(req));
fillObject(req, cli);
DestinazioneDiversa dd = new DestinazioneDiversa(getApFull(req));
fillObject(req, dd);
cli.setCurrentDD(dd);
bean.setClifor(cli);
String msg = "Impossibile Registrare un nuovo utente:";
if (bean.isLogonDuplicated()) {
msg = String.valueOf(msg) + " Login già presente in archivio";
rp.setStatus(false);
rp.setMsg(msg);
return rp;
}
if (bean.isEmailDuplicated()) {
com.ablia.anag.Users userMl = new com.ablia.anag.Users(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()));
rp = saveUserAndClifor(req, res);
} else {
msg = String.valueOf(msg) + " Email già presente in archivio";
forceMessage(req, msg);
req.setAttribute("bean", bean);
callJsp(req, res);
}
} else {
if (cli.isCodFiscDuplicated()) {
msg = String.valueOf(msg) + " Codice Fiscale già presente in archivio";
rp.setStatus(false);
rp.setMsg(msg);
return rp;
}
if (cli.isPIvaDuplicated()) {
msg = String.valueOf(msg) + " Partita Iva già presente in archivio";
rp.setStatus(false);
rp.setMsg(msg);
return rp;
}
if (!cli.getCodFisc().isEmpty() && !CodiceFiscale.controlloFormale(cli.getCodFisc())) {
msg = String.valueOf(msg) + " Il codice fiscale non è valido:";
rp.setStatus(false);
rp.setMsg(msg);
return rp;
}
if (!cli.getPIva().isEmpty() && cli.getPIva().length() != 11) {
msg = String.valueOf(msg) + " Partita iva non valida:";
rp.setStatus(false);
rp.setMsg(msg);
return rp;
}
req.setAttribute("flgValido", "S");
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
rp = saveUserAndClifor(req, res);
}
return rp;
}
protected ResParm saveUserAndClifor(HttpServletRequest req, HttpServletResponse res) {
ResParm rp = new ResParm(true);
com.ablia.anag.Users user = new com.ablia.anag.Users(getApFull(req));
long l_id_users = getRequestLongParameter(req, "id_users");
user.findByPrimaryKey(l_id_users);
fillObject(req, user);
Clifor cliente = user.getClifor();
fillObject(req, cliente);
String nominativo = getRequestParameter(req, "nominativo");
if (!nominativo.isEmpty()) {
cliente.setFlgAzienda(1L);
cliente.setCognome(nominativo);
cliente.setNome("");
}
cliente.setFlgTipo("C");
rp = cliente.save();
if (rp.getStatus()) {
DestinazioneDiversa dd = cliente.getCurrentDD();
fillObject(req, dd);
if (dd.getIndirizzoDD().isEmpty()) {
if (dd.getId_destinazioneDiversa() != 0L)
rp.append(dd.delete());
} else {
dd.setId_clifor(cliente.getId_clifor());
dd.setFlgDDDefault(1L);
dd.setDescrizioneDD("Sped. WWW");
rp.append(dd.save());
}
}
if (rp.getStatus()) {
user.setId_clifor(cliente.getId_clifor());
if (user.getId_userProfile() == 0L)
user.setId_userProfile(10L);
user.setFlgValido("S");
rp.append(user.save());
}
if (!rp.getStatus()) {
sendMessage(req, "Impossibile salvare: " + rp.getMsg());
rp.setStatus(false);
rp.setMsg("Impossibile salvare: " + rp.getMsg());
return rp;
}
return rp;
}
protected ResParm recordOrderNoReg(HttpServletRequest req, HttpServletResponse res) {
return null;
}
}

View file

@ -0,0 +1,258 @@
package com.ablia.www.servlet;
import com.ablia.art.Articolo;
import com.ablia.art.ArticoloCR;
import com.ablia.art.ArticoloVariante;
import com.ablia.art.ArticoloVarianteCR;
import com.ablia.art.Lista;
import com.ablia.art.Tipo;
import com.ablia.art.TipoAccessorio;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.tarop.OpzioneArticolo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CatalogoSvlt extends _WwwSvlt {
private static final long serialVersionUID = 8470016548703062874L;
private Tipo tipo;
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
ArticoloCR CR = new ArticoloCR(getApFull(req));
fillObject(req, CR);
CR.setFlgDisponibile(1L);
req.setAttribute("listaPadri", getTipo(req).findPadri());
if (getTipo(req).getFlgUsaVarianti() == 1L) {
CR.setFlgUsaDisponibilita(1L);
ArticoloVariante bean = (ArticoloVariante)l_bean;
req.setAttribute("listaArticoliVariante", bean.getArticolo().findArticoliVarianti(0L, 0L));
CR.setId_tipoSel(bean.getArticolo().getId_tipo());
long l_id_tipoAccessorio = getRequestLongParameter(req, "id_tipoAccessorio");
long l_id_tipo = getRequestLongParameter(req, "id_tipo");
req.setAttribute("listaAccessori", bean.getArticolo().getAccessori(l_id_tipoAccessorio, l_id_tipo, 0L));
req.setAttribute("listaTipiAccessorio", new TipoAccessorio(getApFull(req)).findAll());
Tipo tipo = new Tipo(getApFull(req));
tipo.findByPrimaryKey(196L);
req.setAttribute("listaTipiAcc", tipo.findFigli(0, 0));
req.setAttribute("listaCaratteristicheArticolo", bean.getArticolo().getCaratteristicheArticolo());
req.setAttribute("listaOpzioniArticolo", new OpzioneArticolo(getApFull(req)).findById_articolo(bean.getId_articolo()));
} else {
Articolo bean = (Articolo)l_bean;
CR.setId_tipoSel(bean.getId_tipo());
req.setAttribute("listaCaratteristicheArticolo", bean.getCaratteristicheArticolo());
req.setAttribute("listaOpzioniArticolo", new OpzioneArticolo(getApFull(req)).findById_articolo(bean.getId_articolo()));
long l_id_tipoAccessorio = getRequestLongParameter(req, "id_tipoAccessorio");
long l_id_tipo = getRequestLongParameter(req, "id_tipo");
req.setAttribute("listaAccessori", bean.getAccessori(l_id_tipoAccessorio, l_id_tipo, 0L));
}
req.setAttribute("CR", CR);
if (getAct(req).equals("zoom")) {
String imgNumber = getRequestParameter(req, "imgNumber");
req.setAttribute("imgNumber", imgNumber);
}
if (req.getAttribute("msg").equals("Lettura effettuata") || req.getAttribute("msg").equals("Read Ok"))
req.setAttribute("msg", "");
}
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {
ArticoloCR CR = (ArticoloCR)CRA;
req.setAttribute("listaPadri", CR.getTipo().findPadri());
Lista lista = new Lista(getApFull(req));
req.setAttribute("listaCaratteristica1", lista.findLista(11L, 0, 0));
req.setAttribute("listaCaratteristica2", lista.findLista(4L, 0, 0));
req.setAttribute("listaCaratteristica3", lista.findLista(6L, 0, 0));
req.setAttribute("listaCaratteristica4", lista.findLista(2L, 0, 0));
}
protected DBAdapter getBean(HttpServletRequest req) {
if (getTipo(req) == null)
return new Articolo(getApFull(req));
if (getTipo(req).getFlgUsaVarianti() == 1L) {
if (getCmd(req).equalsIgnoreCase("md") && !getAct(req).equals("articolo"))
return new ArticoloVariante(getApFull(req));
return new Articolo(getApFull(req));
}
return new Articolo(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
if (getTipo(req) == null)
return new ArticoloCR(getApFull(req));
if (getTipo(req).getFlgUsaVarianti() == 1L) {
if (getCmd(req).equalsIgnoreCase("md"))
return new ArticoloVarianteCR(getApFull(req));
return new ArticoloCR(getApFull(req));
}
return new ArticoloCR(getApFull(req));
}
protected int getPageRow(HttpServletRequest req) {
int pageRow = getParm("PAGE_ROW").getNumeroInt();
return (pageRow == 0) ? 4 : pageRow;
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("catalogo")) {
setJspPage("/catalogo.jsp", req);
callJsp(req, res);
} else {
search(req, res);
}
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
ResParm rp = new ResParm(true);
req.setAttribute("flgEscludiWeb", "0");
req.setAttribute("flgDisponibile", "0");
if (getRequestLongParameter(req, "flgOrderBy") < 2L)
req.setAttribute("flgOrderBy", String.valueOf(2L));
return rp;
}
protected String getBeanPageName(HttpServletRequest req) {
String jspPage;
if (getTipo(req) == null) {
jspPage = super.getBeanPageName(req);
} else if (getTipo(req).getFlgUsaVarianti() == 1L) {
jspPage = super.getBeanPageName(req);
if (getAct(req).equals("zoom")) {
ArticoloVariante bean = (ArticoloVariante)req.getAttribute("bean");
String targetDir = String.valueOf(getDocBase()) + bean.getArticolo().getPathAttach();
if (bean.isFileExist(String.valueOf(targetDir) + bean.getImgFileName(5))) {
jspPage = String.valueOf(jspPage) + "Zoom6";
} else {
jspPage = String.valueOf(jspPage) + "Zoom";
}
}
} else {
if (getCmd(req).equals("search")) {
jspPage = "articolo";
} else {
jspPage = "articolo";
}
if (getAct(req).equals("zoom"))
jspPage = String.valueOf(jspPage) + "Zoom";
}
return jspPage;
}
protected void viewAllArticoliVariante(HttpServletRequest req, HttpServletResponse res) {
try {
ArticoloVarianteCR CR = new ArticoloVarianteCR(getApFull(req));
ArticoloCR CRA = new ArticoloCR(getApFull(req));
fillObject(req, CR);
fillObject(req, CRA);
if (CR.getId_tipoSel() == 0L)
CR.setId_tipoSel(CRA.getId_tipoMenu());
CR.setFlgNascondi(0L);
CR.setFlgDisponibile(1L);
CR.setFlgOrdinaArticolo(1L);
req.setAttribute("CR", CRA);
req.setAttribute("list", new ArticoloVariante(getApFull(req)).findByCR(CR, 0, 0));
setJspPageRelative("articoloVarianteVACR.jsp", req);
callJsp(req, res);
} catch (Exception e) {
handleDebug(e);
}
}
protected void viewAllArticoliAccessori(HttpServletRequest req, HttpServletResponse res) {
try {
ArticoloCR CR = new ArticoloCR(getApFull(req));
fillObject(req, CR);
CR.setFlgNascondi(0L);
CR.setFlgDisponibile(1L);
CR.setFlgOrdinaArticolo(1L);
if (CR.getId_tipoSel() == 0L)
CR.setId_tipoSel(CR.getId_tipoMenu());
req.setAttribute("CR", CR);
req.setAttribute("list", new Articolo(getApFull(req)).findByCR(CR, 0, 0));
setJspPageRelative("articoloAccVACR.jsp", req);
callJsp(req, res);
} catch (Exception e) {
handleDebug(e);
}
}
protected Tipo getTipo(HttpServletRequest req) {
if (this.tipo == null) {
long l_id_tipo = getRequestLongParameter(req, "id_tipo");
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
if (l_id_articolo > 0L) {
Articolo bean = new Articolo(getApFull(req));
bean.findByPrimaryKey(l_id_articolo);
this.tipo = bean.getTipo();
} else if (l_id_tipo > 0L) {
this.tipo = new Tipo(getApFull(req));
this.tipo.findByPrimaryKey(l_id_tipo);
} else {
this.tipo = new Tipo(getApFull(req));
}
}
return this.tipo;
}
private void setTipo(Tipo tipo) {
this.tipo = tipo;
}
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
setTipo(null);
super.processRequest(req, res);
}
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
if (getAct(req).equals("articolo")) {
super.showBean(req, res);
} else {
long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante");
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
Articolo articolo = new Articolo(getApFull(req));
if (l_id_articolo == 0L && l_id_articoloVariante > 0L) {
ArticoloVariante av = new ArticoloVariante(getApFull(req));
av.findByPrimaryKey(l_id_articoloVariante);
req.setAttribute("id_articolo", Long.valueOf(av.getId_articolo()));
}
if (l_id_articoloVariante == 0L && getTipo(req) != null && getTipo(req).getFlgUsaVarianti() == 1L) {
articolo.findByPrimaryKey(l_id_articolo);
if (articolo.getArticoloVarianteBase() == null) {
req.setAttribute("md", "search");
req.setAttribute("CR", new ArticoloCR());
setJspPage("/articoloNonTrovato.jsp", req);
callJsp(req, res);
} else {
req.setAttribute("id_articoloVariante", Long.valueOf(articolo.getArticoloVarianteBase().getId_articoloVariante()));
super.showBean(req, res);
}
} else {
req.removeAttribute("bean");
super.showBean(req, res);
}
}
}
protected void ajaxActions(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("aj_accessori")) {
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
long l_id_tipoAccessorio = getRequestLongParameter(req, "id_tipoAccessorio");
long l_id_tipo = getRequestLongParameter(req, "id_tipo");
Articolo bean = new Articolo(getApFull(req));
bean.findByPrimaryKey(l_id_articolo);
ArticoloCR CR = new ArticoloCR(getApFull(req));
fillObject(req, CR);
req.setAttribute("bean", bean);
req.setAttribute("CR", CR);
req.setAttribute("listaAccessori", bean.getAccessori(l_id_tipoAccessorio, l_id_tipo, 0L));
setJspPageRelative("aj_accessori.jsp", req);
callJsp(req, res);
} else {
super.ajaxActions(req, res);
}
}
protected void superShowBean(HttpServletRequest req, HttpServletResponse res) {
super.showBean(req, res);
}
}

View file

@ -0,0 +1,56 @@
package com.ablia.www.servlet;
import com.ablia.common.Users;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Deprecated
public class LogonSvlt extends com.ablia.servlet.LogonSvlt {
protected boolean checkLoginProfile(HttpServletRequest req) {
try {
if (getLoginUser(req) == null) {
forceJspPage(getLoginPage(req, null), req);
return true;
}
if (getLoginUser(req).getFlgValido().equals("N")) {
forceJspPage(getLoginPage(req, null), req);
req.getSession().removeAttribute("loginUser_id");
req.getSession().removeAttribute("utenteLogon");
return false;
}
if (getLoginUser(req).getId_userProfile() > 0L) {
forceJspPage(getLoginPage(req, null), req);
return true;
}
forceJspPage(getLoginPage(req, null), req);
req.getSession().removeAttribute("loginUser_id");
req.getSession().removeAttribute("utenteLogon");
return true;
} catch (Exception e) {
handleDebug(e);
return false;
}
}
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
return getRequestParameter(req, "thePage");
}
protected Users getUser(HttpServletRequest req) {
return new com.ablia.anag.Users(getApFull(req));
}
protected void loginOK(HttpServletRequest req, HttpServletResponse res) throws Exception {
String url = "com.ablia.servlet.AcCartSvlt";
Properties parm = new Properties();
parm.setProperty("cmd", "updateCart");
startRemoteCmd(getApFull(req), parm, url);
super.loginOK(req, res);
req.setAttribute("msg", "");
}
protected boolean useControlCodeAccess() {
return false;
}
}

View file

@ -0,0 +1,224 @@
package com.ablia.www.servlet;
import com.ablia.anag.TipoPagamento;
import com.ablia.anag.Users;
import com.ablia.common.Access;
import com.ablia.contab.Documento;
import com.ablia.contab.DocumentoCR;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.util.AbMessages;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class OrdineSvlt extends _WwwSvlt {
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
Documento bean = (Documento)l_bean;
req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req)).findPagamentiWww(bean.getFlgRitiroNegozio()));
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 = "";
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) {
Documento bean = null;
ResParm rp = new ResParm(true, "");
long l_id = getRequestLongParameter(req, "id_documento");
bean = new Documento(getApFull(req));
try {
bean.findByPrimaryKey(l_id);
rp = bean.sendOrderMailMessage(getLang(req), true, true, false);
sendMessage(req, rp.getMsg());
} catch (Exception e) {
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
}
showBean(req, res);
}
protected String getCRAttribute(HttpServletRequest req) {
return "CROrd";
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
DocumentoCR CR = new DocumentoCR(getApFull(req));
fillObject(req, CR);
if (getLoginUserId(req) != null && getLoginUserId(req) > 0L) {
Users user = (Users)getLoginUser(req);
if (user.getId_clifor() == 0L) {
req.setAttribute("id_clifor", "-1");
} else {
req.setAttribute("id_clifor", String.valueOf(user.getId_clifor()));
}
req.setAttribute("id_tipoDocumento", Long.valueOf(getParm("ID_DOC_ORDINE_WWW").getNumeroLong()));
if (CR.getFlgStatoPrenotazione() < 0L)
req.setAttribute("flgStatoPrenotazione", "0");
req.setAttribute("id_users", "0");
}
return new ResParm(true);
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
String cmd = getCmd(req);
if (cmd.equals("payBon")) {
payBonifico(req, res);
} else if (cmd.equals("payCc")) {
payCc(req, res);
} else if (cmd.equals("refreshPayment")) {
refreshPayment(req, res);
} else if (cmd.equals("cancelOrder")) {
cancelOrder(req, res);
} else if (cmd.equals("sendMailOrder")) {
sendMailOrder(req, res);
} else {
search(req, res);
}
}
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id_user = getLoginUserId(req);
Users user = new Users(apFull);
user.findByPrimaryKey(l_id_user);
long l_id_documento = getRequestLongParameter(req, "id_documento");
Documento bean = new Documento(apFull);
bean.findByPrimaryKey(l_id_documento);
if (user.getId_users() > 0L && bean.getDBState() == 1 && user.getId_clifor() != bean.getId_clifor()) {
sendMessage(req, "Errore! Ordine Errato!!");
req.setAttribute("id_documento", "0");
search(req, res);
} else {
if (bean.getDBState() == 1 && bean.getId_tipoPagamento() == 4L &&
bean.getFlgProcediPagamento() == 1L && bean.getDescTransaction().isEmpty())
bean.agiornaNuovoId_documentoXpay();
super.showBean(req, res);
}
}
public void _vediOrdineCrypt(HttpServletRequest req, HttpServletResponse res) {
String idCryptParm = "idcrypt";
String l_id_ordineCript = getRequestParameter(req, idCryptParm);
if (l_id_ordineCript.isEmpty() && req.getSession().getAttribute(idCryptParm) != null)
l_id_ordineCript = (String)req.getSession().getAttribute(idCryptParm);
if (!l_id_ordineCript.isEmpty()) {
long l_id_ordine = -1L;
try {
l_id_ordine = Long.parseLong(DBAdapter.deCrypt(l_id_ordineCript));
} catch (Exception e) {}
if (l_id_ordine > 0L) {
if (getLoginUserId(req) == 0L) {
req.getSession().setAttribute(idCryptParm, l_id_ordineCript);
} else {
req.getSession().removeAttribute(idCryptParm);
}
req.setAttribute("id_documento", String.valueOf(l_id_ordine));
req.setAttribute("cmd", "md");
showBean(req, res);
} else {
search(req, res);
}
}
}
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 String.valueOf(temp) + access.getSuffissoE() + "E";
return String.valueOf(temp) + "E";
}
return temp;
}
}

View file

@ -0,0 +1,76 @@
package com.ablia.www.servlet;
import com.ablia.contab.Documento;
import com.ablia.contab.DocumentoCR;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.util.AbMessages;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ResoSvlt extends _WwwSvlt {
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();
}
}

View file

@ -0,0 +1,55 @@
package com.ablia.www.servlet;
import com.ablia.bank.servlet.xpay.GetXpayResponseSvlt;
import com.ablia.bank.xpay.XpayResp;
import com.ablia.contab.Documento;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RicevutaXpaySvlt extends GetXpayResponseSvlt {
private static final long serialVersionUID = 8927367451552445757L;
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, XpayResp xpRes) {
String l_id_documentoXpay;
if (xpRes.getCodTrans() != null && !xpRes.getCodTrans().isEmpty()) {
l_id_documentoXpay = xpRes.getCodTrans();
} else {
l_id_documentoXpay = (String)req.getSession().getAttribute("id_documentoXpay");
}
Documento bean = new Documento(getApFull(req));
bean.findByDocumentoXpay(l_id_documentoXpay);
req.setAttribute("bean", bean);
}
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, XpayResp xpRes) {
if (xpRes != null && xpRes.getEsito().equals("OK")) {
String l_id_documentoXpay = xpRes.getCodTrans();
Documento bean = new Documento(getApFull(req));
bean.findByDocumentoXpay(l_id_documentoXpay);
bean.setDataTransaction(DBAdapter.getToday());
bean.setDataPagamento(DBAdapter.getToday());
bean.setDescTransaction(xpRes.getCodAut());
ResParm rp = bean.save();
rp.append(bean.sendOrderMailMessage(getLang(req), true, true, false));
req.setAttribute("id_documento", String.valueOf(bean.getId_documento()));
req.setAttribute("bean", bean);
if (rp.getStatus()) {
forceMessage(req, "L'ordine è stato pagato regolarmente.");
} else {
forceMessage(req,
"Errore! L'ordine risulta pagato ma è stato impossibile aggiornare lo stato. Contattare l'amministratore del sito.");
}
}
}
protected void resetId_documentoXpay(HttpServletRequest req, HttpServletResponse res, XpayResp xpRes) {
if (xpRes != null) {
String l_id_documentoXpay = xpRes.getCodTrans();
Documento bean = new Documento(getApFull(req));
bean.findByDocumentoXpay(l_id_documentoXpay);
bean.agiornaNuovoId_documentoXpay();
}
}
}

View file

@ -0,0 +1,10 @@
package com.ablia.www.servlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ShowOrdineSvlt extends OrdineSvlt {
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
_vediOrdineCrypt(req, res);
}
}

View file

@ -0,0 +1,377 @@
package com.ablia.www.servlet;
import com.ablia.anag.Cliente;
import com.ablia.anag.Clifor;
import com.ablia.anag.DestinazioneDiversa;
import com.ablia.anag.Nazione;
import com.ablia.anag.NazioneCR;
import com.ablia.anag.Users;
import com.ablia.anag.UsersCR;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.util.CodiceFiscale;
import com.ablia.util.Vectumerator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class UsersSvlt extends _WwwSvlt {
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
NazioneCR nCR = new NazioneCR();
nCR.setLang(getLang(req));
req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req)));
if (req.getAttribute("msg").equals("Lettura effettuata"))
req.setAttribute("msg", "");
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new Users(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new UsersCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
NazioneCR nCR = new NazioneCR();
nCR.setLang(getLang(req));
req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req)));
sendMessage(req, "");
Users bean = new Users(getApFull(req));
bean.setFlgMl(1L);
bean.setId_userProfile(bean.getIdUserProfileWww());
bean.setCallingJsp(getRequestParameter(req, "callingJsp"));
req.setAttribute("bean", bean);
}
protected boolean isSecureServlet(HttpServletRequest req) {
return false;
}
protected String getBeanPageName(HttpServletRequest req) {
return super.getBeanPageName(req);
}
protected String getCmd(HttpServletRequest req) {
if (super.getCmd(req).isEmpty())
return "ni";
return super.getCmd(req);
}
protected String newDispathcerAfterShowBean(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Users bean = (Users)beanA;
bean.setCallingJsp(getRequestParameter(req, "callingJsp"));
req.setAttribute("bean", bean);
return "";
}
private boolean mailConfermaCambiamentoDati(HttpServletRequest req, Users bean) {
return bean.sendUserDataMailMessage().getStatus();
}
protected String getRegistrazioneMailMessage() {
return getParm("MAIL_REG").getTesto();
}
protected void sqlActions(HttpServletRequest req, HttpServletResponse res) {
Users bean = new Users(getApFull(req));
fillObject(req, bean);
Cliente cli = new Cliente(getApFull(req));
fillObject(req, cli);
DestinazioneDiversa dd = new DestinazioneDiversa(getApFull(req));
fillObject(req, dd);
cli.setCurrentDD(dd);
bean.setClifor(cli);
String msg = "Impossibile Registrare un nuovo utente:";
if (bean.isLogonDuplicated()) {
msg = String.valueOf(msg) + " Login già presente in archivio";
forceMessage(req, msg);
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
fillComboAfterDetail((DBAdapter)bean, req, res);
req.setAttribute("bean", bean);
callJsp(req, res);
} else if (bean.isEmailDuplicated()) {
Users userMl = new Users(getApFull(req));
userMl.findUsersByEmail(bean.getEMail());
if (userMl.getId_userProfile() == bean.getIdUserProfileMailingList()) {
req.setAttribute("id_users", String.valueOf(userMl.getId_users()));
req.setAttribute("flgValido", "S");
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
saveUserAndClifor(req, res);
} else {
msg = String.valueOf(msg) + " Email già presente in archivio";
forceMessage(req, msg);
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
fillComboAfterDetail((DBAdapter)bean, req, res);
req.setAttribute("bean", bean);
callJsp(req, res);
}
} else if (cli.isCodFiscDuplicated()) {
msg = String.valueOf(msg) + " Codice Fiscale già presente in archivio";
forceMessage(req, msg);
fillComboAfterDetail((DBAdapter)bean, req, res);
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
req.setAttribute("bean", bean);
callJsp(req, res);
} else if (cli.isPIvaDuplicated()) {
msg = String.valueOf(msg) + " Partita Iva già presente in archivio";
forceMessage(req, msg);
fillComboAfterDetail((DBAdapter)bean, req, res);
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
req.setAttribute("bean", bean);
callJsp(req, res);
} else if (!cli.getCodFisc().isEmpty() && !CodiceFiscale.controlloFormale(cli.getCodFisc())) {
msg = String.valueOf(msg) + " Il codice fiscale non è valido:";
forceMessage(req, msg);
fillComboAfterDetail((DBAdapter)bean, req, res);
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
bean.setClifor(cli);
req.setAttribute("bean", bean);
callJsp(req, res);
} else if (!cli.getPIva().isEmpty() && cli.getPIva().length() != 11) {
msg = String.valueOf(msg) + " Partita iva non valida:";
forceMessage(req, msg);
fillComboAfterDetail((DBAdapter)bean, req, res);
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
bean.setClifor(cli);
req.setAttribute("bean", bean);
callJsp(req, res);
} else {
req.setAttribute("flgValido", "S");
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
saveUserAndClifor(req, res);
}
}
protected void recordMailingList(HttpServletRequest req, HttpServletResponse res) {
Users bean = new Users(getApFull(req));
fillObject(req, bean);
ResParm rp = new ResParm();
String msg = "Impossibile Registrare utente ML:";
if (bean.isEmailDuplicated()) {
msg = String.valueOf(msg) + " Email già presente in archivio - " + bean.getEMail();
rp.setStatus(false);
rp.setMsg(msg);
if (bean.isEmailDuplicatedNoMl()) {
rp.setErrorCode(1L);
} else {
rp.setErrorCode(2L);
}
req.setAttribute("RP", rp);
forceJspPageRelative("mailingListUser.jsp", req);
callJsp(req, res);
} else {
bean.setFlgValido("N");
bean.setFlgMl(1L);
bean.setId_userProfile(bean.getIdUserProfileMailingList());
bean.setLangMl(getRequestParameter(req, "langMl"));
bean.setLogin("ML_" + bean.getEMail());
bean.setCognome("MLC_" + bean.getEMail());
bean.setNome("MLN_" + bean.getEMail());
if (bean.getLogin().length() > 30)
bean.setLogin(bean.getLogin().substring(0, 30));
if (bean.getCognome().length() > 30)
bean.setCognome(bean.getCognome().substring(0, 30));
if (bean.getNome().length() > 30)
bean.setNome(bean.getNome().substring(0, 30));
rp = bean.save();
if (rp.getStatus())
bean.sendMLMailMessageOLD(String.valueOf(req.getRemoteHost()) + " " + req.getRemoteAddr());
forceJspPageRelative("mailingListUser.jsp", req);
callJsp(req, res);
}
}
protected void checkCc(HttpServletRequest req, HttpServletResponse res) {
Users bean = new Users(getApFull(req));
fillObject(req, bean);
ResParm rp = new ResParm();
String msg = "Impossibile Registrare utente ML:";
if (bean.isEmailDuplicated()) {
msg = String.valueOf(msg) + " Email già presente in archivio - " + bean.getEMail();
rp.setStatus(false);
rp.setMsg(msg);
if (bean.isEmailDuplicatedNoMl()) {
rp.setErrorCode(1L);
} else {
rp.setErrorCode(2L);
}
req.setAttribute("RP", rp);
forceJspPageRelative("mailingListUser.jsp", req);
callJsp(req, res);
} else {
bean.setFlgValido("N");
bean.setFlgMl(1L);
bean.setId_userProfile(bean.getIdUserProfileMailingList());
bean.setLogin("ML_" + bean.getEMail());
bean.setCognome("MLC_" + bean.getEMail());
bean.setNome("MLN_" + bean.getEMail());
rp = bean.save();
if (rp.getStatus())
bean.sendMLMailMessageOLD(String.valueOf(req.getRemoteHost()) + " " + req.getRemoteAddr());
forceJspPageRelative("mailingListUser.jsp", req);
callJsp(req, res);
}
}
protected com.ablia.common.Users getUser(HttpServletRequest req) {
return new Users(getApFull(req));
}
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
String msg;
Users bean = (Users)beanA;
long l_id_user = getRequestLongParameter(req, "id_users");
if (bean.getDBState() == 1) {
msg = "Salvataggio effettuato";
req.getSession().setAttribute("utenteLogon", bean);
req.getSession().setAttribute("loginUser_id", new Long(bean.getId_users()));
if (l_id_user == 0L) {
if (!mailConfermaCambiamentoDati(req, bean)) {
msg = String.valueOf(msg) + " Attenzione!! Impossibile mandare email di conferma.";
bean.setFlgEmailOk(0L);
} else {
msg = String.valueOf(msg) + " Inviata mail di conferma.";
bean.setFlgEmailOk(1L);
}
} else {
bean.setFlgEmailOk(1L);
}
setJspPageRelative(String.valueOf(getBeanPageName(req)) + "Reg.jsp", req);
} else {
msg = "ERRORE!. Non è stato possibile salvare. Contattare l'amministratore o immettere login diverso";
}
forceMessage(req, msg);
return new ResParm(true);
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("ML")) {
recordMailingList(req, res);
} else if (getCmd(req).equals("checkCC")) {
recordMailingList(req, res);
} else if (getCmd(req).equals("checkUCF")) {
checkUserCF(req, res);
} else {
super.otherCommands(req, res);
}
}
protected void saveUserAndClifor(HttpServletRequest req, HttpServletResponse res) {
Users user = new Users(getApFull(req));
long l_id_users = getRequestLongParameter(req, "id_users");
user.findByPrimaryKey(l_id_users);
fillObject(req, user);
Clifor cliente = user.getClifor();
fillObject(req, cliente);
String nominativo = getRequestParameter(req, "nominativo");
if (!nominativo.isEmpty()) {
cliente.setFlgAzienda(1L);
cliente.setCognome(nominativo);
cliente.setNome("");
}
cliente.setFlgTipo("C");
ResParm rp = cliente.save();
if (rp.getStatus()) {
DestinazioneDiversa dd = cliente.getCurrentDD();
fillObject(req, dd);
if (dd.getIndirizzoDD().isEmpty()) {
if (dd.getId_destinazioneDiversa() != 0L)
rp.append(dd.delete());
} else {
dd.setId_clifor(cliente.getId_clifor());
dd.setFlgDDDefault(1L);
dd.setDescrizioneDD("Sped. WWW");
rp.append(dd.save());
}
}
if (rp.getStatus()) {
user.setId_clifor(cliente.getId_clifor());
if (user.getId_userProfile() == 0L)
user.setId_userProfile(user.getIdUserProfileWww());
user.setFlgValido("S");
rp.append(user.save());
}
if (rp.getStatus()) {
afterSave((DBAdapter)user, req, res);
sendMessage(req, "Record salvato correttamente");
setJspPage("/usersReg.jsp", req);
} else {
sendMessage(req, "Impossibile salvare: " + rp.getMsg());
setJspPage("/users.jsp", req);
req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req)));
}
req.setAttribute("bean", user);
callJsp(req, res);
}
protected void checkUserCF(HttpServletRequest req, HttpServletResponse res) {
String l_cf = getRequestParameter(req, "codFiscR");
ResParm rp = new ResParm(true);
if (l_cf.isEmpty()) {
rp.setStatus(false);
rp.setMsg("Codice Fiscale errato!");
} else {
Clifor clifor = new Clifor(getApFull(req));
clifor.findByCF(l_cf, "C");
if (clifor.getDBState() == 0) {
rp.setStatus(false);
rp.setMsg("Il Codice Fiscale richiesto non è nei nostri database. ");
} else if (clifor.getDBState() == 1 && clifor.getEMail().isEmpty()) {
rp.setStatus(false);
rp.setMsg("Il Codice Fiscale è nei nostri database ma l'indirizzo email non è stato comunicato.");
} else {
Users user = new Users(getApFull(req));
Vectumerator vec = user.findByClifor(clifor.getId_clifor(), 1, 1);
if (vec.getTotNumberOfRecords() == 0) {
user.setCognome(clifor.getCognome());
user.setNome(clifor.getNome());
if (clifor.getFlgAzienda() == 1L)
user.setNominativo(clifor.getCognome());
user.setFlgValido("S");
user.setId_userProfile(10L);
user.setId_clifor(clifor.getId_clifor());
user.setEMail(clifor.getEMail());
if (!clifor.getCellulare().isEmpty()) {
user.setTelefono(clifor.getCellulare());
} else {
user.setTelefono(clifor.getTelefono());
}
user.setLogin(user.getEMail());
user.setPwd(String.valueOf(Math.random() * 1000000.0D).substring(0, 6));
rp = user.save();
if (rp.getStatus()) {
rp = user.sendUserDataMailMessage();
if (rp.getStatus())
rp.setMsg("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email " + user.getEMail());
} else {
rp.setStatus(false);
rp.setMsg("Utente creato correttamente ma non è stato possibile inviare l'email di conferma.");
}
} else {
rp.setStatus(false);
rp.setMsg(
"Attenzione! Il codice fiscale è nei nostri database ma esiste già un utente web associato. Richiedi i dati di accesso attraverso il recupero del login tramite indirizzo email.");
}
}
}
if (rp.getStatus()) {
forceJspPage("/usersReg.jsp", req);
} else {
forceJspPage("/usersRegError.jsp", req);
}
sendMessage(req, rp.getMsg());
callJsp(req, res);
}
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
long l_id_usersDoc = getRequestLongParameter(req, "id_usersDoc");
if (l_id_usersDoc > 0L)
req.setAttribute("id_users", Long.valueOf(l_id_usersDoc));
super.showBean(req, res);
}
}

View file

@ -0,0 +1,12 @@
package com.ablia.www.servlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class XpaySvlt extends com.ablia.bank.servlet.xpay.XpaySvlt {
protected void prepareSendRequest(HttpServletRequest req, HttpServletResponse res) {
long l_id_documentoXpay = getRequestLongParameter(req, "id_documentoXpay");
req.getSession().setAttribute("id_documentoXpay",
new Long(l_id_documentoXpay));
}
}

View file

@ -0,0 +1,69 @@
package com.ablia.www.servlet;
import com.ablia.cart.Cart;
import com.ablia.common.Users;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public abstract class _WwwSvlt extends AblServletSvlt {
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 checkProfile(HttpServletRequest req, String l_permesso) {
return 3L;
}
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
return "Registra.abl";
}
protected Users getUser(HttpServletRequest req) {
return new com.ablia.anag.Users(getApFull(req));
}
protected boolean useAlwaysSendRedirect() {
return true;
}
protected boolean isSecureServlet(HttpServletRequest req) {
return false;
}
public String getPathImgArticoli() {
return String.valueOf(getDocBase()) + "/" + getParm("PATH_IMG_ART").getTesto();
}
protected double getDeliveryCost(HttpServletRequest req) {
return getParm(Cart.P_DELIVERY_COST).getNumeroDouble();
}
protected double getDeliveryWarnCost(HttpServletRequest req) {
return getParm(Cart.P_DELIVERY_WARN_COST).getNumeroDouble();
}
protected double getMoreCost(HttpServletRequest req) {
return getParm(Cart.P_MORE_COST).getNumeroDouble();
}
}

View file

@ -0,0 +1,118 @@
package com.ablia.www.servlet.admin;
import com.ablia.anag.Iva;
import com.ablia.anag.TipoPagamento;
import com.ablia.anag.TipoPagamentoCR;
import com.ablia.anag.Vettore;
import com.ablia.contab.Documento;
import com.ablia.contab.RigaDocumento;
import com.ablia.contab.TipoDocumento;
import com.ablia.contab.servlet.DocumentoSvlt;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DocumentoOrdSvlt extends DocumentoSvlt {
protected String getBeanPageName(HttpServletRequest req) {
return "documentoOrd";
}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Documento bean = (Documento)beanA;
super.fillComboAfterDetail(beanA, req, res);
}
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
ResParm rp = new ResParm(true);
return rp;
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("id_tipoDocumento", String.valueOf(getId_docOrdine()));
return new ResParm(true);
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
req.setAttribute("nf4", getNf4());
Documento bean = new Documento(getApFull(req));
bean.setId_tipoDocumento(getId_docOrdineWww());
bean.setFlgStato(1L);
bean.setId_tipoPagamento(1L);
req.setAttribute("bean", bean);
req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req))
.findByCR(new TipoPagamentoCR(), 0, 0));
req.setAttribute("listaVettore", new Vettore(getApFull(req)).findAll());
req.setAttribute("listaTipoDocumento",
new TipoDocumento(getApFull(req)).findAll());
req.setAttribute("listaIva", new Iva(getApFull(req)).findAll());
RigaDocumento bean2 = new RigaDocumento(getApFull(req));
bean2.setId_iva(getParm("CODICE_IVA_STD_VEND").getNumeroLong());
req.setAttribute("bean2", bean2);
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("aggionraSRCR")) {
Documento bean = null;
long l_id = getRequestLongParameter(req, "id_documento");
bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id);
long l_flgStatoRiparazione = getRequestLongParameter(req,
"flgStatoRiparazioneS");
ResParm rp = new ResParm();
if (bean.getDBState() == 0) {
rp.setStatus(false);
rp.setMsg("Errore! Codice documento non valido");
} else {
rp = bean.aggiornaStatoRiparazione(l_flgStatoRiparazione);
}
if (rp.getStatus()) {
sendMessage(req, "Stato Riparazione aggiornato.");
} else {
sendMessage(req, rp.getMsg());
}
search(req, res);
} else if (getCmd(req).equals("inviaAvviso")) {
Documento bean = null;
long l_id = getRequestLongParameter(req, "id_documento");
bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id);
ResParm rp = new ResParm();
if (bean.getDBState() == 0) {
rp.setStatus(false);
rp.setMsg("Errore! Codice documento non valido");
} else {
rp = bean.inviaAvviso();
}
if (rp.getStatus()) {
sendMessage(req, "Avviso inviato correttamente.");
} else {
sendMessage(req, rp.getMsg());
}
search(req, res);
} else {
search(req, res);
}
}
protected void mail(HttpServletRequest req, HttpServletResponse res) {
Documento ordine = (Documento)getBeanByRequest(req, res);
if (getAct(req).equals("reso")) {
ResParm rp = ordine.sendResoMailMessage();
if (!rp.getStatus())
forceMessage(req, rp.getMsg());
} else {
super.mail(req, res);
}
showBean(req, res);
}
protected String actionsAfterShowBean(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Documento bean = (Documento)beanA;
if (getAct2(req).equals("copiaDatiSped")) {
bean.save();
req.setAttribute("bean", bean);
}
return "";
}
}

View file

@ -0,0 +1,38 @@
package com.ablia.www.servlet.admin;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.www.Promozione;
import com.ablia.www.PromozioneCR;
import com.ablia.www.PromozioneUser;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class PromozioneSvlt extends _WwwAdminSvlt {
private static final long serialVersionUID = 1L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Promozione bean = (Promozione)beanA;
req.setAttribute("listaPromozioneUser", new PromozioneUser(apFull).findByPromozione(bean.getId_promozione()));
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new Promozione(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new PromozioneCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected boolean isSimpleServlet(HttpServletRequest req) {
return false;
}
}

View file

@ -0,0 +1,77 @@
package com.ablia.www.servlet.admin;
import com.ablia.common.Users;
import com.ablia.db.ApplParm;
import com.ablia.db.ApplParmFull;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public abstract class _WwwAdminSvlt extends AblServletSvlt {
protected static ApplParmFull ap2;
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) {
if (isSecureServlet(req))
try {
return getLoginUser(req).getGrantType(l_permesso);
} catch (Exception e) {
handleDebug(e);
return 0L;
}
return 4L;
}
protected String getAct3(HttpServletRequest req) {
return getRequestParameter(req, "act3");
}
protected String getCmd3(HttpServletRequest req) {
return getRequestParameter(req, "cmd3");
}
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
return "/admin/menu/menu.jsp";
}
protected Users getUser(HttpServletRequest req) {
return new com.ablia.anag.Users(getApFull(req));
}
protected boolean useAlwaysSendRedirect() {
return true;
}
protected ApplParmFull getAp2() {
if (ap2 == null) {
ApplParmFull apFull = getApFull();
ApplParm apx = new ApplParm(apFull.getParm("DBDRIVER2").getNumeroInt(), apFull.getParm("DBNAME2").getTesto(),
apFull.getParm("USER2").getTesto(), apFull.getParm("PASSWORD2").getTesto());
ap2 = new ApplParmFull(apx);
}
return ap2;
}
}