package it.acxent.cc; import it.acxent.anag.Clifor; import it.acxent.anag.Comune; import it.acxent.anag.DestinazioneDiversa; import it.acxent.anag.Iva; import it.acxent.anag.Listino; import it.acxent.anag.Users; import it.acxent.anag.UsersCR; import it.acxent.anag.Vettore; import it.acxent.api.amz.AmzResult; import it.acxent.api.amz.AmzSellerApi; import it.acxent.api.ebay.EbayAbliaApi; import it.acxent.api.ebay.EbayResult; import it.acxent.art.Wishlist; import it.acxent.cart.Cart; import it.acxent.common.CrontabInterface; import it.acxent.common.Lang; import it.acxent.common.Parm; import it.acxent.common.StatusMsg; import it.acxent.contab.Documento; import it.acxent.contab.DocumentoCR; import it.acxent.contab.RigaDocumento; import it.acxent.db.AddImgInterface; import it.acxent.db.ApplParmFull; import it.acxent.db.DBAdapter; import it.acxent.db.ResParm; import it.acxent.db.StringAdapter; import it.acxent.db.WcString; import it.acxent.mail.MailMessage; import it.acxent.mail.MailProperties; import it.acxent.util.DoubleOperator; import it.acxent.util.ScaleImage; import it.acxent.util.StringTokenizer; import it.acxent.util.Timer; import it.acxent.util.Vectumerator; import java.awt.image.BufferedImage; import java.io.File; import java.io.Serializable; import java.net.URLEncoder; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.text.NumberFormat; import java.util.Calendar; import javax.imageio.ImageIO; import javax.servlet.http.HttpServletRequest; import net.ifok.image.image4j.codec.ico.ICOEncoder; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.json.JSONArray; import org.json.JSONObject; public class Attivita extends DBAdapter implements Serializable, AddImgInterface, CrontabInterface { private static final String CHECK_CART_TEXT = "checkCartText"; private static final String COOKIE_POLICY_TEXT = "cookiePolicyText"; private static final long serialVersionUID = 1587713686660L; public static final String LANG_SE_NON_DISPONIBILE = "en"; public static final String SESS_ATTIVITA = "attivita"; public static final String SESS_VEC_LANG_ATTIVITA = "_listaLangAtt"; public static final String PATH_IMG = "_img/_imgAttivita/"; private static final String DESCRIZIONE_ATTIVITA = "descrizioneAttivita"; private static final String SLOGAN_TRASPORTO = "sloganTrasporto"; private static final String MAIN_TAG_KEYWORD = "mainTagKeyword"; private static final String MAIN_TAG_DESC = "mainTagDesc"; private static final String MAIN_TAG_TITLE = "mainTagTitle"; private static final String MAIN_TAG_H1 = "mainTagH1"; private static final String MAIN_TAG_H2 = "mainTagH2"; private static final String MAIN_TESTO_TITLE = "mainTestoTitle"; private static final String MAIN_TESTO_CENTRALE = "mainTestoCentrale"; private static final String DIRITTO_DI_RECESSO = "dirittoDiRecesso"; private static final String DETAIL_XS_TITLE = "detailXsTitle"; private static final String DETAIL_DX_TITLE = "detailDxTitle"; private static final String RETURN_CONDITIONS = "returnConditions"; private static final String TERM_CONDITIONS = "termConditions"; private static final String PRIVACY = "privacy"; private static final String CART_TEXT = "cartText"; private static final String CART_TITLE = "cartTitle"; private static final String MAIN_SX_TITLE = "mainSxTitle"; private static final String DETAIL_XS_TEXT = "detailXsText"; private static final String DETAIL_NON_VISIBILE = "detailNonVisibile"; private static final String DETAIL_NON_VISIBILE_NO_WEB = "detailNonVisibileNoWeb"; private static final String DETAIL_DX_TEXT = "detailDxText"; private static final String TRIP_ADVISOR_SCRIPT = "tripAdvisorScript"; private static final String FOOTER_TEXT = "footerText"; private static final String MAIN_SX_TEXT = "mainSxText"; private static final String MAIL_FOOTER = "mailFooter"; private static final String DELIVERY_CONSEGNA = "deliveryConsegna"; private static final String DESC_SPESE_SPEDIZIONI = "descSpeseSpedizioni"; private static final String HTML = ".html"; private static final String INDEX = "index-"; public static String NOTIFICHE_MSG = "mailMessage/notificheWishlist.html"; public static final long TIPO_NEWS_TUTTE = -1L; public static final long TIPO_NEWS_NESSUNA = 0L; public static final long TIPO_NEWS_LISTA = 1L; public static final long TIPO_NEWS_GRID = 2L; public static final long TIPO_NEWSLETTER_NO = 0L; public static final long TIPO_NEWSLETTER_INTERNA = 1L; public static final long TIPO_NEWSLETTER_MAILCHIMP = 2L; public static final long GOOGLE_MERCHANT_NO = 0L; public static final long GOOGLE_MERCHANT_FTP = 1L; public static final long GOOGLE_MERCHANT_SFTP = 2L; public static final long TROVAPREZZI_NO = 0L; public static final long TROVAPREZZI_SU_ORDINE = 1L; public static final long TROVAPREZZI_SU_ACQUISTO = 2L; private long id_attivita; private long id_tipoAttivita; private String nomeAttivita; private String nomeAttivitaSeo; private String indirizzoAttivita; private String numeroCivicoAttivita; private long id_comuneAttivita; private String descrizioneComuneAttivita; private String descrizioneProvinciaAttivita; private String capComuneAttivita; private long flgGusti; private Date dataIscrizione; private String codiceAttivita; private String imgTmst; private long flgDefault; private long flgMainSxCategorie; private long flgMainSxVetrinaBestseller; private long flgMainSxVetrinaOfferte; private long flgMainSxUltimiVisualizzati; private long flgMainBanner; private long flgMainVetrina; private long flgMainVetrinaCategorie; private long flgTopTelefono; private long flgTopLingue; private long flgTopMail; private long flgNewsletterType; private String topFontColorHex; private long flgHeadCategorie; private long flgHeadMarche; private long flgHeadNewsType; private String headColoreHex; private long flgDetailReviews; private long flgDetailRelatedProducts; private long flgDetailDxVetrinaBestseller; private long flgDetailDxVetrinaOfferte; private long flgCoupon; private long qtaDisponibilitaBassa; private String accountFacebook; private String accountTwitter; private String accountInstagram; private long flgSocialSide; private long flgFooterSocial; private TipoAttivita tipoAttivita; private Comune comuneAttivita; private String capZonaAttivita; private String telefonoAttivita; private String emailAttivita; private String topLingueAttivita; private String mailFrom; private String mailTitolarePrivacy; private String mailTitle; private long id_vettore; private Vettore vettore; private long flgCheckoutGuest; private String mailCoordinateBancarie; private String wwwAddress; private String topColoreHex; private String backgroundColorHex; private String backgroundColorFooterHex; private String backgroundColorNavHoverHex; private String backgroundCustomFeatureBox; private String headCategorieBorderColorHex; private String mainTextColorHex; private String mainSubtitleBottomBorderHex; private String leftMenuTextColorHex; private String leftMenuSubTextColorHex; private String subtitleHex; private String bodyBackgroundHex; private String footerTextH5Hex; private String footerTextliHex; private String footerTextliAHex; private String paypalClientId; private String paypalClientSecret; private String mailchimpSubscribeForm; private String tagManagerHead; private String tagManagerBody; private double costoContrassegno; private long flgDetailCompara; private long flgDetailWishlist; private long flgDetailShareAddThis; private long flgMainMiniBanner; private long mainUltimiNum; private long flgMainUltimi; private long flgMainUltimaNews; private static Attivita defaultInstance = null; private String indirizzoSede; private String numeroCivicoSede; private long id_comuneSede; private String descrizioneComuneSede; private String descrizioneProvinciaSede; private String capComuneSede; private Comune comuneSede; private double deliveryFreeAbove; private double deliveryCost; private String capZonaSede; private String telefonoSede; private String codFisc; private String pIva; private String pec; private String codiceIdentificativoFE; private String contatto; private long flgAcquistaSoloDisponibile; private long flgCartProcediPagamento; private String googleFtpUser; private String googleFtpPassword; private String googleNomiFileFeed; private long flgGoogleMerchant; private String pGoogleSigninClientId; private long flgGoogleSignin; private String pFacebookSigninClientId; private String pFacebookSigninSecretKey; private long flgFacebookSignin; private double pGooglePrezzoPubblicoMinimoXExport; private long pGoogleQtaMinimaXExport; private long flgTopChatWhatsapp; private long flgTopChatTelegram; private long flgFooterChatWhatsapp; private long flgFooterChatTelegram; private long flgSubito; private String cellulareAttivita; private String chatTelegramUsername; private long flgQuotazione; private String recaptchaV2Key; private long flgEbay; private long id_listinoEbay; private Listino listinoEbay; private String pHEAD_DOC1; private String pHEAD_DOC2; private String cciaa; private String faxAttivita; private String pFROM; private String pBCC; private String pDOC_BCC; private String pCC; private String pSUBJECT; private String ebayFulfillmentPolicyId; private String ebayPaymentPolicyId; private String ebayReturnPolicyId; private String ebayMerchantLocationKey; private String ebayOAuthRefreshToken; private Timestamp ebayOAuthRefreshTokenExpire; private String ebayOAuthUserToken; private Timestamp ebayOAuthUserTokenExpire; private long flgIcecat; private String icecatUsername; private String icecatPassword; private long percentileMaxPerPreventivo; private double pCCArrotondaPrezzoAEuroSopra; private double pCCRicaricoMinimoOfferte; private double pCCArrotondaDecimalePerPrezziBassi; private long flgIvaOneStopShop; private long flgIvaEsteroAziendeEsente; private String googleMerchantRecensioniScript; private String googleMerchantRecensioniScriptBadge; private long flgGoogleMerchantRecensioni; private long flgGoogleMerchantRecensioniBadge; public static boolean threadWL = false; private long flgAmz; private long id_listinoAmz; private Listino listinoAmz; private String amzLwaClientId; private String amzLwaClientSecret; private String amzLwaAuthToken; private String amzLwaAccessToken; private String amzLwaRefreshToken; private Timestamp amzLwaAccessTokenExpireTS = null; private String amzIamRoleARN; private String amzIamAccessKey; private String amzIamSecretKey; private String amzStsAccessKeyId; private String amzStsSecretAccessKey; private String amzStsSessionToken; private Timestamp amzStsSessionTokenTS = null; private String amzMarketplaces; private String amzSellerid; private String amzMerchantShippingGroupFree; private String googleApiKey; private String googleSiteId; private long flgTrovaprezzi; private String trovaprezziTrustedProgramScript; private String trovaprezziTrustedProgramScriptItem; private double checkCartPercScontoMax; private String cookiePolicyTheme; private long flgIdealo; private String idealoTag; private String paypalRateScriptHead; private String paypalRateScriptBodyDett; private String paypalRateScriptBodyCat; private long flgPaypalRate; private String indexNowApiKey; private long indexNowUrlQuota; private Date indexNowDay; private long indexNowDayCount; private String pStripePublicKey; private String pStripePrivateKey; private String pStripeReturnUrl; private double deliveryCostPudo; class ThreadNotificheWL extends Thread { private String fileCsvlarge; private final String TAG_THREAD_MSG = "WISHLIST NOTIFICHE "; public ThreadNotificheWL() { if (!Attivita.isThreadAttivo()) { Attivita.threadWL = true; start(); } } public void run() { boolean debug = false; boolean salvaArticoloNuovo = true; Timer timer = new Timer(); timer.start(); StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "...inizio ..."); Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); System.out.println("##############\nWISHLIST NOTIFICHE \nSTART: " + start.toString()); ResParm rp = new ResParm(true); rp = sendNotificheWishlist(); if (rp.getStatus()); timer.stop(); rp.setMsg("Invio Notifiche concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", rp.getMsg()); try { sleep(10000L); } catch (Exception e) {} StatusMsg.deleteMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE "); Attivita.threadWL = false; System.out.println(rp.getMsg()); } public ResParm sendNotificheWishlist() { StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "Ricerca Utenti ....."); ResParm rp = new ResParm(true); StringBuilder msg = new StringBuilder(); Wishlist wl = new Wishlist(Attivita.this.getApFull()); try { String subject = Attivita.this.getMailSubject(); Users bean = new Users(Attivita.this.getApFull()); Vectumerator vec = bean.findUsersWithWishlist(); String urlBase = Attivita.this.getParm("P_WWW_ADDRESS").getTesto(); NumberFormat nf = Attivita.this.getNf(); int totUsers = 0; if (vec.hasMoreElements()) { MailProperties mp = new MailProperties(); mp.setProperty("FROM", Attivita.this.getMailFrom()); mp.setProperty("CC", Attivita.this.getMailFrom()); while (vec.hasMoreElements()) { Users currentUser = (Users)vec.nextElement(); totUsers++; StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "" + totUsers + " - " + totUsers + " ..."); Vectumerator vecWl = wl.findByUser(currentUser.getId_users(), true); String elencoArticoli = ""; while (vecWl.hasMoreElements()) { Wishlist currentWl = (Wishlist)vecWl.nextElement(); if (currentWl.getFlgAbilitaAvviso() == 1L && ( currentWl.getFlgPrezzoModificato() != 0L || currentWl.isDispoLevelModificata())) { String imgSrc; if (currentWl.getFlgPrezzoModificato() != 0L) currentWl.setPrezzoUltimoAvviso(currentWl.getArticolo().getPrezzoPubblico(currentUser.getClifor())); if (currentWl.isDispoLevelModificata()) currentWl.setDispoLevelUltimoAvviso((long)currentWl.getArticolo().getDispoLevel()); if (currentWl.getId_articolo() > 0L) { imgSrc = ""; } else { imgSrc = ""; } elencoArticoli = elencoArticoli + " " + elencoArticoli + "" + currentWl.getArticolo().getCCLinkDettaglioCanonical(currentUser.getLang()) + " " + currentWl.getArticolo().getNome() + "€ " + Attivita.this.getDataFormat().format(currentWl.getDataWL()) + "€ " + nf.format(currentWl.getPrezzoWLIva()) + " " + currentWl.getDispoLevelUltimoAvviso() + "\n"; currentWl.setTmstUltimoAvviso(DBAdapter.getTimestamp()); currentWl.save(); } } msg.append("Invio notifiche a " + currentUser.getCognomeNome()); if (!elencoArticoli.isEmpty()) { StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "" + totUsers + " - " + totUsers + " invio notifica ...."); MailMessage mf = new MailMessage(Attivita.this.getApFull(), Attivita.this.getNotificheMailMessage(currentUser.getLang())); mf.setQuestionMark(false); mf.setString("nome", currentUser.getNome()); mf.setString("cognome", currentUser.getCognome()); mf.setDate("data", DBAdapter.getToday()); mf.setString("elencoArticoli", elencoArticoli); Attivita.this.sendMailStandardData(mf, currentUser.getLang(), null); mp.setProperty("TO", bean.getEMail()); mp.setProperty("SUBJECT", subject + " - " + subject + " " + Attivita.this.translate("La Mia Wish List ", currentUser.getLang())); mp.setProperty("ID_USERS", String.valueOf(currentUser.getId_users())); msg.append("--> Trovati Articoli con prezzi cambiati\n"); rp = mf.sendMailMessage(mp, true); if (!rp.getStatus()) { msg.append("Errore: " + rp.getMsg()); msg.append("\n-------\n"); } continue; } StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "" + totUsers + " - " + totUsers + " nessun articolo trovato!"); msg.append(" --> Nessun articolo trovato. Mail non inviata.\n"); } } rp.setStatus(true); rp.setMsg(msg.toString()); } catch (Exception e) { Attivita.this.handleDebug(e); rp.setStatus(false); rp.setMsg(e.toString() + "\n" + e.toString()); } return rp; } } public long getFlgQuotazione() { return this.flgQuotazione; } public void setFlgQuotazione(long flgQuotazione) { this.flgQuotazione = flgQuotazione; } public Attivita(ApplParmFull newApplParmFull) { super(newApplParmFull); } public static final Attivita getDefaultInstance(ApplParmFull ap) { if (defaultInstance == null || defaultInstance.getId_attivita() == 0L || defaultInstance.getFlgDefault() == 0L) { defaultInstance = new Attivita(ap); defaultInstance.findDefault(); } return defaultInstance; } public static final void resetDefaultInstance() { defaultInstance = null; } public static final String getGoogleMerchant(long l_flgGoogleUsaFtp) { switch ((int)l_flgGoogleUsaFtp) { case 1: return "FTP"; case 2: return "SFTP"; case 0: return "NO"; } return ""; } public static final String getTrovaprezzi(long l_flgTrovaprezzi) { switch ((int)l_flgTrovaprezzi) { case 0: return "NO"; case 1: return "Tracking Su Ordine"; case 2: return "Tracking Su Acquisto"; } return ""; } public static final String getIdealo(long l_flgIdealo) { switch ((int)l_flgIdealo) { case 0: return "NO"; case 1: return "Si"; } return ""; } public String getIdealo() { return getIdealo(getFlgIdealo()); } public double getDeliveryFreeAbove() { return this.deliveryFreeAbove; } public void setDeliveryFreeAbove(double deliveryFreeAbove) { this.deliveryFreeAbove = deliveryFreeAbove; } public String getGoogleMerchant() { return getGoogleMerchant(getFlgGoogleMerchant()); } public void setId_attivita(long newId_attivita) { this.id_attivita = newId_attivita; } public void setId_tipoAttivita(long newId_tipoAttivita) { this.id_tipoAttivita = newId_tipoAttivita; setTipoAttivita(null); } public void setNomeAttivita(String newNomeAttivita) { this.nomeAttivita = newNomeAttivita; } public void setIndirizzoAttivita(String newIndirizzoAttivita) { this.indirizzoAttivita = newIndirizzoAttivita; } public void setNumeroCivicoAttivita(String newNumeroCivicoAttivita) { this.numeroCivicoAttivita = newNumeroCivicoAttivita; } public void setId_comuneAttivita(long newId_comune) { this.id_comuneAttivita = newId_comune; setComuneAttivita(null); } public void setDescrizioneComuneAttivita(String newDescrizioneComuneAttivita) { this.descrizioneComuneAttivita = newDescrizioneComuneAttivita; } public void setDescrizioneProvinciaAttivita(String newDescrizioneProvinciaAttivita) { this.descrizioneProvinciaAttivita = newDescrizioneProvinciaAttivita; } public void setCapComuneAttivita(String newCapComuneAttivita) { this.capComuneAttivita = newCapComuneAttivita; } public void setFlgGusti(long newFlgGusti) { this.flgGusti = newFlgGusti; } public void setDataIscrizione(Date newDataIscrizione) { this.dataIscrizione = newDataIscrizione; } public void setCodiceAttivita(String newCodiceAttivita) { this.codiceAttivita = newCodiceAttivita; } public void setImgTmst(String newImgTmst) { this.imgTmst = newImgTmst; } public void setFlgMainSxCategorie(long newFglMainSxCategorie) { this.flgMainSxCategorie = newFglMainSxCategorie; } public void setFlgMainSxVetrinaBestseller(long newFlgMainSxVetrinaBestseller) { this.flgMainSxVetrinaBestseller = newFlgMainSxVetrinaBestseller; } public void setFlgMainSxVetrinaOfferte(long newFlgMainSxVetrinaOfferte) { this.flgMainSxVetrinaOfferte = newFlgMainSxVetrinaOfferte; } public void setFlgMainSxUltimiVisualizzati(long newFlgMainSxUltimiVisualizzati) { this.flgMainSxUltimiVisualizzati = newFlgMainSxUltimiVisualizzati; } public void setFlgMainBanner(long newFlgMainBanner) { this.flgMainBanner = newFlgMainBanner; } public void setFlgMainVetrina(long newFlgMainVetrina) { this.flgMainVetrina = newFlgMainVetrina; } public void setFlgMainVetrinaCategorie(long newFlgMainVetrinaCategorie) { this.flgMainVetrinaCategorie = newFlgMainVetrinaCategorie; } public void setFlgTopTelefono(long newFlgTopTelefono) { this.flgTopTelefono = newFlgTopTelefono; } public void setFlgTopLingue(long newFlgTopLingue) { this.flgTopLingue = newFlgTopLingue; } public void setFlgTopMail(long newFlgTopMail) { this.flgTopMail = newFlgTopMail; } public void setTopColoreHex(String newTopColoreHex) { this.topColoreHex = newTopColoreHex; } public void setFlgHeadCategorie(long newFlgHeadCategorie) { this.flgHeadCategorie = newFlgHeadCategorie; } public void setFlgHeadMarche(long newFlgHeadMarche) { this.flgHeadMarche = newFlgHeadMarche; } public void setFlgHeadNewsType(long newFlgHeadNewsType) { this.flgHeadNewsType = newFlgHeadNewsType; } public void setHeadColoreHex(String newHeadColoreHex) { this.headColoreHex = newHeadColoreHex; } public void setFlgDetailReviews(long newFlgDetailReviws) { this.flgDetailReviews = newFlgDetailReviws; } public void setFlgDetailRelatedProducts(long newFlgDetailRelatedProducts) { this.flgDetailRelatedProducts = newFlgDetailRelatedProducts; } public void setFlgDetailDxVetrinaBestseller(long newFlgDetailDxVetrinaBestseller) { this.flgDetailDxVetrinaBestseller = newFlgDetailDxVetrinaBestseller; } public void setFlgDetailDxVetrinaOfferte(long newFlgDetailDxVetrinaOfferte) { this.flgDetailDxVetrinaOfferte = newFlgDetailDxVetrinaOfferte; } public void setFlgCoupon(long newFlgCoupon) { this.flgCoupon = newFlgCoupon; } public void setFlgCheckoutGuest(long newFlgCheckoutGuest) { this.flgCheckoutGuest = newFlgCheckoutGuest; } public void setAccountFacebook(String newAccountFacebook) { this.accountFacebook = newAccountFacebook; } public void setAccountTwitter(String newAccountTwitter) { this.accountTwitter = newAccountTwitter; } public void setAccountInstagram(String newAccountInstagram) { this.accountInstagram = newAccountInstagram; } public void setFlgSocialSide(long newFlgSocialSide) { this.flgSocialSide = newFlgSocialSide; } public void setFlgFooterSocial(long newFlgFooterSocial) { this.flgFooterSocial = newFlgFooterSocial; } public long getId_attivita() { return this.id_attivita; } public long getId_tipoAttivita() { return this.id_tipoAttivita; } public String getNomeAttivita() { return (this.nomeAttivita == null) ? "" : this.nomeAttivita.trim(); } public String getMailFooter(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mailFooter", l_lang); } public String getIndirizzoAttivita() { return (this.indirizzoAttivita == null) ? "" : this.indirizzoAttivita.trim(); } public String getIndirizzoCompletoAttivita() { StringBuilder sb = new StringBuilder(); sb.append(getIndirizzoAttivita()); sb.append(" "); sb.append(getNumeroCivicoAttivita()); sb.append(" "); if (getCapZonaAttivita().isEmpty()) { sb.append(getCapComuneAttivita()); } else { sb.append(getCapZonaAttivita()); } sb.append(" "); sb.append(getDescrizioneComuneAttivita()); sb.append(" ("); sb.append(getDescrizioneProvinciaAttivita()); sb.append(") "); return sb.toString(); } public String getIndirizzoCompletoSede() { StringBuilder sb = new StringBuilder(); sb.append(getIndirizzoSede()); sb.append(" "); sb.append(getNumeroCivicoSede()); sb.append(" "); if (getCapZonaSede().isEmpty()) { sb.append(getCapComuneSede()); } else { sb.append(getCapZonaSede()); } sb.append(" "); sb.append(getDescrizioneComuneSede()); sb.append(" ("); sb.append(getDescrizioneProvinciaSede()); sb.append(") "); return sb.toString(); } public String getNumeroCivicoAttivita() { return (this.numeroCivicoAttivita == null) ? "" : this.numeroCivicoAttivita.trim(); } public long getId_comuneAttivita() { return this.id_comuneAttivita; } public String getDescrizioneComuneAttivita() { return (this.descrizioneComuneAttivita == null) ? "" : this.descrizioneComuneAttivita.trim(); } public String getDescrizioneProvinciaAttivita() { return (this.descrizioneProvinciaAttivita == null) ? "" : this.descrizioneProvinciaAttivita.trim(); } public String getCapComuneAttivita() { return (this.capComuneAttivita == null) ? "" : this.capComuneAttivita.trim(); } public long getFlgGusti() { return this.flgGusti; } public Date getDataIscrizione() { return this.dataIscrizione; } public String getCodiceAttivita() { return (this.codiceAttivita == null) ? "" : this.codiceAttivita.trim(); } public String getImgTmst() { return (this.imgTmst == null) ? "" : this.imgTmst.trim(); } public long getFlgMainSxCategorie() { return this.flgMainSxCategorie; } public long getFlgMainSxVetrinaBestseller() { return this.flgMainSxVetrinaBestseller; } public long getFlgMainSxVetrinaOfferte() { return this.flgMainSxVetrinaOfferte; } public long getFlgMainSxUltimiVisualizzati() { return this.flgMainSxUltimiVisualizzati; } public String getMainSxText(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mainSxText", l_lang); } public String getDeliveryConsegna(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("deliveryConsegna", l_lang); } public boolean isDeliveryConsegna(String l_lang) { if (getDeliveryConsegna(l_lang).isEmpty()) return false; return true; } public String getFooterText(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("footerText", l_lang); } public String getTripAdvisorScript(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("tripAdvisorScript", l_lang); } public boolean isTripAdvisorScript(String l_lang) { return !getTripAdvisorScript(l_lang).isEmpty(); } public long getFlgMainBanner() { return this.flgMainBanner; } public long getFlgMainVetrina() { return this.flgMainVetrina; } public long getFlgMainVetrinaCategorie() { return this.flgMainVetrinaCategorie; } public long getFlgTopTelefono() { return this.flgTopTelefono; } public long getFlgTopLingue() { return this.flgTopLingue; } public long getFlgTopMail() { return this.flgTopMail; } public String getTopColoreHex() { return (this.topColoreHex == null) ? "" : this.topColoreHex.trim(); } public long getFlgHeadCategorie() { return this.flgHeadCategorie; } public long getFlgHeadMarche() { return this.flgHeadMarche; } public long getFlgHeadNewsType() { return this.flgHeadNewsType; } public String getHeadColoreHex() { return (this.headColoreHex == null) ? "" : this.headColoreHex.trim(); } public long getFlgDetailReviews() { return this.flgDetailReviews; } public long getFlgDetailRelatedProducts() { return this.flgDetailRelatedProducts; } public String getDetailDxText(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("detailDxText", l_lang); } public String getDetailNonVisibileNoWeb(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("detailNonVisibileNoWeb", l_lang); } public String getDetailNonVisibile(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("detailNonVisibile", l_lang); } public String getDetailXsText(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("detailXsText", l_lang); } public long getFlgDetailDxVetrinaBestseller() { return this.flgDetailDxVetrinaBestseller; } public long getFlgDetailDxVetrinaOfferte() { return this.flgDetailDxVetrinaOfferte; } public long getFlgCoupon() { return this.flgCoupon; } public long getFlgCheckoutGuest() { return this.flgCheckoutGuest; } public String getAccountFacebook() { return (this.accountFacebook == null) ? "" : this.accountFacebook.trim(); } public boolean isFacebook() { return !getAccountFacebook().isEmpty(); } public boolean isTwitter() { return !getAccountTwitter().isEmpty(); } public boolean isInstagram() { return !getAccountInstagram().isEmpty(); } public String getAccountTwitter() { return (this.accountTwitter == null) ? "" : this.accountTwitter.trim(); } public String getAccountInstagram() { return (this.accountInstagram == null) ? "" : this.accountInstagram.trim(); } public long getFlgSocialSide() { return this.flgSocialSide; } public long getFlgFooterSocial() { return this.flgFooterSocial; } public void setTipoAttivita(TipoAttivita newTipoAttivita) { this.tipoAttivita = newTipoAttivita; } public TipoAttivita getTipoAttivita() { this.tipoAttivita = (TipoAttivita)getSecondaryObject(this.tipoAttivita, TipoAttivita.class, getId_tipoAttivita()); return this.tipoAttivita; } public void setComuneAttivita(Comune newComune) { this.comuneAttivita = newComune; } public Comune getComuneAttivita() { this.comuneAttivita = (Comune)getSecondaryObject(this.comuneAttivita, Comune.class, getId_comuneAttivita()); return this.comuneAttivita; } protected ResParm checkDeleteCascade() { return new ResParm(true); } protected void deleteCascade() {} public Vectumerator findByCR(AttivitaCR CR, int pageNumber, int pageRows) { String s_Sql_Find = "select A.* from ATTIVITA 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(s_Sql_Find + s_Sql_Find + wc.toString()); return findRows(stmt, pageNumber, pageRows); } catch (SQLException e) { removeCPConnection(); handleDebug(e); return AB_EMPTY_VECTUMERATOR; } } public static final String getHeadNewsType(long l_flgHeadNewsType) { switch ((int)l_flgHeadNewsType) { case 2: return "Grid"; case 1: return "Lista"; case 0: return "Nessuna"; case -1: return "Tutte"; } return "??"; } public String getHeadNewsType() { return getHeadNewsType(getFlgHeadNewsType()); } public String getTopColorStyle() { return ""; } public String getCustomCssVars() { String SEMICOLON = ";"; StringBuilder sb = new StringBuilder(""); return sb.toString(); } public String getCapZonaAttivita() { return (this.capZonaAttivita == null) ? "" : this.capZonaAttivita.trim(); } public void setCapZonaAttivita(String capZonaAttivita) { this.capZonaAttivita = capZonaAttivita; } public long getFlgDefault() { return this.flgDefault; } public void setFlgDefault(long flgDefault) { this.flgDefault = flgDefault; } public void findDefault() { String s_Sql_Find = "select A.* from ATTIVITA AS A"; String s_Sql_Order = ""; WcString wc = new WcString(); wc.addWc("A.flgDefault=1"); try { PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); findFirstRecord(stmt); } catch (SQLException e) { removeCPConnection(); handleDebug(e); } } public ResParm save() { if (getFlgDefault() == 1L) resetDefault(); String titolarePrivacy = getNomeAttivita() + "
" + getNomeAttivita() + " " + getIndirizzoAttivita() + "
"; if (getCapZonaAttivita().isEmpty()) { titolarePrivacy = titolarePrivacy + titolarePrivacy; } else { titolarePrivacy = titolarePrivacy + titolarePrivacy; } titolarePrivacy = titolarePrivacy + " " + titolarePrivacy + " (" + getComuneAttivita().getDescrizione() + ")"; setMailTitolarePrivacy(titolarePrivacy); boolean refreshParm = false; if (getPHEAD_DOC1().isEmpty()) { String headDoc = getNomeAttivita() + "\n" + getNomeAttivita() + " n." + getIndirizzoAttivita() + "\n"; if (getCapZonaAttivita().isEmpty()) { headDoc = headDoc + headDoc + " "; } else { headDoc = headDoc + headDoc + " "; } headDoc = headDoc + headDoc + " (" + getDescrizioneComuneAttivita() + ")"; setPHEAD_DOC1(headDoc); } if (getPHEAD_DOC2().isEmpty()) { String headDoc = "\nP.Iva " + getPIva() + " CF " + getCodFisc() + "\nCCIAA: " + getCciaa() + "\nTel. " + getTelefonoAttivita() + " Fax: " + getFaxAttivita(); setPHEAD_DOC2(headDoc); } ResParm rp = saveSyncParm(refreshParm); rp.append(super.save()); return rp; } private ResParm saveSyncParm(boolean refreshParm) { ResParm rp = new ResParm(true); if (!getParm("HEAD_DOC1").getTesto().equals(getPHEAD_DOC1())) { Parm parm1 = getParm("HEAD_DOC1"); parm1.setApFull(getApFull()); parm1.setTesto(getPHEAD_DOC1()); parm1.save(); } if (!getParm("HEAD_DOC2").getTesto().equals(getPHEAD_DOC2())) { Parm parm1 = getParm("HEAD_DOC2"); parm1.setApFull(getApFull()); parm1.setTesto(getPHEAD_DOC2()); parm1.save(); } if (!getParm("BCC").getTesto().equals(getPBCC())) { Parm parm1 = getParm("BCC"); parm1.setApFull(getApFull()); parm1.setTesto(getPBCC()); parm1.save(); } if (!getParm("CC").getTesto().equals(getPCC())) { Parm parm1 = getParm("CC"); parm1.setApFull(getApFull()); parm1.setTesto(getPCC()); parm1.save(); } if (!getParm("FROM").getTesto().equals(getPFROM())) { Parm parm1 = getParm("FROM"); parm1.setApFull(getApFull()); parm1.setTesto(getPFROM()); parm1.save(); } if (!getParm("SUBJECT").getTesto().equals(getPSUBJECT())) { Parm parm1 = getParm("SUBJECT"); parm1.setApFull(getApFull()); parm1.setTesto(getPSUBJECT()); parm1.save(); } if (!getParm("DOC_BCC").getTesto().equals(getPDOC_BCC())) { Parm parm1 = getParm("DOC_BCC"); parm1.setApFull(getApFull()); parm1.setTesto(getPDOC_BCC()); parm1.save(); } if (getParm("CC_ARROTONDA_PREZZO_A_EURO_SOPRA").getNumero() != getPCCArrotondaPrezzoAEuroSopra()) { Parm parm1 = getParm("CC_ARROTONDA_PREZZO_A_EURO_SOPRA"); parm1.setApFull(getApFull()); parm1.setNumero(getPCCArrotondaPrezzoAEuroSopra()); parm1.save(); } if (getParm("CC_RICARICO_MINIMO_OFFERTE").getNumero() != getPCCRicaricoMinimoOfferte()) { Parm parm1 = getParm("CC_RICARICO_MINIMO_OFFERTE"); parm1.setApFull(getApFull()); parm1.setNumero(getPCCRicaricoMinimoOfferte()); parm1.save(); } if (getParm("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI").getNumero() != getPCCArrotondaDecimalePerPrezziBassi()) { Parm parm1 = getParm("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI"); parm1.setApFull(getApFull()); parm1.setNumero(getPCCArrotondaDecimalePerPrezziBassi()); parm1.save(); } if (getParm("IVA_CEE_ONE_STOP_SHOP").getNumero() != (double)getFlgIvaOneStopShop()) { Parm parm1 = getParm("IVA_CEE_ONE_STOP_SHOP"); parm1.setApFull(getApFull()); parm1.setNumero((double)getFlgIvaOneStopShop()); parm1.save(); } if (getParm("IVA_ESTERO_AZIENDA_ESENTE").getNumero() != (double)getFlgIvaEsteroAziendeEsente()) { Parm parm1 = getParm("IVA_ESTERO_AZIENDA_ESENTE"); parm1.setApFull(getApFull()); parm1.setNumero((double)getFlgIvaEsteroAziendeEsente()); parm1.save(); } Parm parm = getParm("GOOGLE_USE_SFTP"); parm.setApFull(getApFull()); if (getFlgGoogleMerchant() == 2L) { parm.setNumero(1.0D); } else { parm.setNumero(0.0D); } parm.save(); refreshParm = true; if (!getParm("GOOGLE_FTP_PASSWORD").getTesto().equals(getGoogleFtpPassword())) { parm = getParm("GOOGLE_FTP_PASSWORD"); parm.setApFull(getApFull()); parm.setTesto(getGoogleFtpPassword()); parm.save(); refreshParm = true; } if (!getParm("GOOGLE_FTP_USER").getTesto().equals(getGoogleFtpUser())) { parm = getParm("GOOGLE_FTP_USER"); parm.setApFull(getApFull()); parm.setTesto(getGoogleFtpUser()); parm.save(); refreshParm = true; } if (!getParm("GOOGLE_SIGNIN_CLIENT_ID").getTesto().equals(getPGoogleSigninClientId())) { parm = getParm("GOOGLE_SIGNIN_CLIENT_ID"); parm.setApFull(getApFull()); parm.setTesto(getPGoogleSigninClientId()); parm.save(); refreshParm = true; } parm = getParm("GOOGLE_SIGNIN_ENABLE"); if (getFlgGoogleSignin() == 1L) { parm.setNumero(1.0D); } else { parm.setNumero(0.0D); } parm.setApFull(getApFull()); parm.save(); refreshParm = true; if (!getParm("FACEBOOK_SIGNIN_CLIENT_ID").getTesto().equals(getPFacebookSigninClientId())) { parm = getParm("FACEBOOK_SIGNIN_CLIENT_ID"); parm.setApFull(getApFull()); parm.setTesto(getPFacebookSigninClientId()); parm.save(); refreshParm = true; } if (!getParm("FACEBOOK_SIGNIN_SECRET_KEY").getTesto().equals(getPFacebookSigninSecretKey())) { parm = getParm("FACEBOOK_SIGNIN_SECRET_KEY"); parm.setApFull(getApFull()); parm.setTesto(getPFacebookSigninSecretKey()); parm.save(); refreshParm = true; } parm = getParm("FACEBOOK_SIGNIN_ENABLE"); parm.setApFull(getApFull()); if (getFlgFacebookSignin() == 1L) { parm.setNumero(1.0D); } else { parm.setNumero(0.0D); } parm.save(); refreshParm = true; if (getNomeAttivita().isEmpty()) setNomeAttivita(getParm("LOGO_MENU").getTesto()); if (!getParm("LOGO_MENU").getTesto().equals(getNomeAttivita())) { parm = getParm("LOGO_MENU"); parm.setApFull(getApFull()); parm.setTesto(getNomeAttivita()); parm.save(); refreshParm = true; } if (!getParm("TITLE").getTesto().equals(getNomeAttivita())) { parm = getParm("TITLE"); parm.setApFull(getApFull()); parm.setTesto(getNomeAttivita()); parm.save(); refreshParm = true; } if (getParm("SUBJECT").getTesto().isEmpty()) { parm = getParm("SUBJECT"); parm.setApFull(getApFull()); parm.setTesto(getNomeAttivita()); parm.save(); refreshParm = true; } if (getParm("FROM").getTesto().isEmpty()) { parm = getParm("FROM"); parm.setApFull(getApFull()); parm.setTesto(getEmailAttivita()); parm.save(); refreshParm = true; } String pathBaseImmagini = getDocBase() + getDocBase(); File logoFile = new File(pathBaseImmagini + pathBaseImmagini); if (logoFile.exists()) { String currentLogoImg = getParm("LOGO_DOCS").getTesto(); if (currentLogoImg.indexOf(getImgFileName(3)) < 0) { parm = getParm("LOGO_DOCS"); parm.setApFull(getApFull()); parm.setTesto(getPathImg() + getPathImg()); parm.save(); refreshParm = true; } } if (!getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID").getTesto().equals(getPaypalClientId())) { parm = getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID"); parm.setApFull(getApFull()); parm.setTesto(getPaypalClientId()); parm.save(); refreshParm = true; } if (!getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET").getTesto().equals(getPaypalClientSecret())) { parm = getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); parm.setApFull(getApFull()); parm.setTesto(getPaypalClientSecret()); parm.save(); refreshParm = true; } if (!getWwwAddress().isEmpty() && !getWwwAddress().equals(getWwwAddressParm())) { parm = getParm("P_WWW_ADDRESS"); parm.setApFull(getApFull()); parm.setTesto(getWwwAddress()); parm.save(); parm = getParm("CODA_MESSAGGI_IMG_URL_BASE"); parm.setTesto(getWwwAddress()); parm.save(); refreshParm = true; } if (getParm(Cart.P_PROCEDI_PAGAMENTO).getNumero() != (double)getFlgCartProcediPagamento()) { parm = getParm(Cart.P_PROCEDI_PAGAMENTO); parm.setApFull(getApFull()); parm.setNumero((double)getFlgCartProcediPagamento()); parm.save(); refreshParm = true; } if (getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumero() != getDeliveryFreeAbove()) { parm = getParm(Cart.P_DELIVERY_FREE_ABOVE); parm.setApFull(getApFull()); parm.setNumero(getDeliveryFreeAbove()); parm.save(); refreshParm = true; } if (getParm(Cart.P_DELIVERY_COST).getNumero() != getDeliveryCost()) { parm = getParm(Cart.P_DELIVERY_COST); parm.setApFull(getApFull()); parm.setNumero(getDeliveryCost()); parm.save(); refreshParm = true; } if (getParm(Cart.P_DELIVERY_COST_PUDO).getNumero() != getDeliveryCostPudo()) { parm = getParm(Cart.P_DELIVERY_COST_PUDO); parm.setApFull(getApFull()); parm.setNumero(getDeliveryCostPudo()); parm.save(); refreshParm = true; } if (getParm("CC_QTA_LOW").getNumero() != (double)getQtaDisponibilitaBassa()) { parm = getParm("CC_QTA_LOW"); parm.setApFull(getApFull()); parm.setNumero((double)getQtaDisponibilitaBassa()); parm.save(); refreshParm = true; } if (getParm("CC_CHECK_AVAIL").getNumero() != (double)getFlgAcquistaSoloDisponibile()) { parm = getParm("CC_CHECK_AVAIL"); parm.setApFull(getApFull()); parm.setNumero((double)getFlgAcquistaSoloDisponibile()); parm.save(); refreshParm = true; } if (getParm("GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT").getNumero() != getPGooglePrezzoPubblicoMinimoXExport()) { parm = getParm("GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT"); parm.setApFull(getApFull()); parm.setNumero(getPGooglePrezzoPubblicoMinimoXExport()); parm.save(); refreshParm = true; } if (getParm("GOOGLE_QTA_MINIMA_X_EXPORT").getNumero() != (double)getPGoogleQtaMinimaXExport()) { parm = getParm("GOOGLE_QTA_MINIMA_X_EXPORT"); parm.setApFull(getApFull()); parm.setNumero((double)getPGoogleQtaMinimaXExport()); parm.save(); refreshParm = true; } if (!getPStripePrivateKey().isEmpty() && !getPStripePrivateKey().equals(getParm("STRIPE_PRIVATE_KEY").getTesto())) { parm = getParm("STRIPE_PRIVATE_KEY"); parm.setApFull(getApFull()); parm.setTesto(getPStripePrivateKey()); parm.save(); refreshParm = true; } if (!getPStripePublicKey().isEmpty() && !getPStripePublicKey().equals(getParm("STRIPE_PUBLIC_KEY").getTesto())) { parm = getParm("STRIPE_PUBLIC_KEY"); parm.setApFull(getApFull()); parm.setTesto(getPStripePublicKey()); parm.save(); refreshParm = true; } if (!getPStripeReturnUrl().isEmpty() && !getPStripeReturnUrl().equals(getParm("STRIPE_RETURN_URL").getTesto())) { parm = getParm("STRIPE_RETURN_URL"); parm.setApFull(getApFull()); parm.setTesto(getPStripeReturnUrl()); parm.save(); refreshParm = true; } parm = getParm("REWRITE_URL_LANG"); parm.setApFull(getApFull()); parm.setTesto(getTopLingueAttivita()); parm.save(); parm = getParm("NEWS_LANG_DEFAULT"); parm.setApFull(getApFull()); parm.setTesto("it"); parm.save(); parm = getParm("LANG_AVAILABLE"); parm.setApFull(getApFull()); parm.setTesto(getTopLingueAttivita()); parm.save(); refreshParm = true; if (refreshParm) getApFull().resetCurrentApParms(); return rp; } public String getLangDefault() { return getParm("LANG_PRIMARY").getTesto(); } public String getLangDisponibili() { return getParm("LANG_AVAILABLE").getTesto(); } public String getLangSeNonDisponibile() { if (getFlgTopLingue() == 0L) return "it"; return "en"; } protected ResParm resetDefault() { String sql = "update ATTIVITA set flgDefault = null"; return update(sql); } public String getTelefonoAttivita() { return (this.telefonoAttivita == null) ? "" : this.telefonoAttivita.trim(); } public void setTelefonoAttivita(String telefonoAttivita) { this.telefonoAttivita = telefonoAttivita; } public String getEmailAttivita() { return (this.emailAttivita == null) ? "" : this.emailAttivita.trim(); } public boolean isHeadCategorie() { if (getFlgHeadCategorie() == 0L) return false; return true; } public boolean isMailChimp() { if (getFlgNewsletterType() == 2L && !getMailchimpSubscribeForm().isEmpty()) return true; return false; } public boolean isNewsletterInterna() { return (getFlgNewsletterType() == 1L); } public boolean isNewsletter() { return !(getFlgNewsletterType() == 0L); } public boolean isHeadMarche() { if (getFlgHeadMarche() == 0L) return false; return true; } public boolean isQuotazione() { if (getFlgQuotazione() == 0L) return false; return true; } public boolean isHeadNews() { if (getFlgHeadNewsType() == 0L) return false; return true; } public boolean isMainSxCategorie() { return !(getFlgMainSxCategorie() == 0L); } public boolean isMainSxVetrinaBestsellers() { return (getFlgMainSxVetrinaBestseller() == 1L); } public boolean isMainSxVetrinaOfferte() { return (getFlgMainSxVetrinaOfferte() == 1L); } public boolean isMainSxUltimiVisualizzati() { return (getFlgMainSxUltimiVisualizzati() == 1L); } public boolean isMainSxText(String l_lang) { return !(getMainSxText(l_lang).isEmpty() || getMainSxTitle(l_lang).isEmpty()); } public boolean isMainTestoCentrale(String l_lang) { return !(getMainTestoCentrale(l_lang).isEmpty() || getMainTestoTitle(l_lang).isEmpty()); } public boolean isDetailDxVetrinaBestseller() { return (getFlgDetailDxVetrinaBestseller() == 1L); } public boolean isCheckoutGuest() { return (getFlgCheckoutGuest() == 1L); } public boolean isCoupon() { return (getFlgCoupon() == 1L); } public boolean isDetailDxText(String l_lang) { return !(getDetailDxText(l_lang).isEmpty() || getDetailDxTitle(l_lang).isEmpty()); } public boolean isTelefonoAttivita() { if (getFlgTopTelefono() == 0L || getTelefonoAttivita().isEmpty()) return false; return true; } public boolean isTopChatWhatsapp() { if (getFlgTopChatWhatsapp() == 0L || getCellulareAttivita().isEmpty()) return false; return true; } public boolean isFooterChatWhatsapp() { if (getFlgFooterChatWhatsapp() == 0L || getCellulareAttivita().isEmpty()) return false; return true; } public boolean isTopChatTelegram() { if (getFlgTopChatTelegram() == 0L || getChatTelegramUsername().isEmpty()) return false; return true; } public boolean isFooterChatTelegram() { if (getFlgFooterChatTelegram() == 0L || getChatTelegramUsername().isEmpty()) return false; return true; } public boolean isDetailShareAddThis() { return !(getFlgDetailShareAddThis() == 0L); } public void setEmailAttivita(String emailAttivita) { this.emailAttivita = emailAttivita; setMailFrom(emailAttivita); } public String getTopLingueAttivita() { return (this.topLingueAttivita == null) ? "" : this.topLingueAttivita.trim(); } public void setTopLingueAttivita(String topLingueAttivita) { this.topLingueAttivita = topLingueAttivita; } public Vectumerator findLangAttivita() { Vectumerator vec = new Vectumerator(); String lingue = getTopLingueAttivita(); StringTokenizer st = new StringTokenizer(lingue, ","); while (st.hasMoreTokens()) { Lang lg = new Lang(); lg.setLang(st.nextToken()); vec.add(lg); } return vec; } public String getImgFileName(int imgNumber) { return getImgFileName(imgNumber, getImgTmst()); } public String getImgLogo() { return getPathImg() + getPathImg(); } public String getImgLogoAdmin() { if (new File(getDocBase() + getDocBase() + getPathImg()).exists()) return getPathImg() + getPathImg(); return "admin/_V4/_logo/logo.png"; } public String getImgFavicon() { String faviconDir = getDocBase() + getDocBase(); DBAdapter.checkAndMakeDir(faviconDir); String nomeFileIcoFull = faviconDir + faviconDir; if (!new File(nomeFileIcoFull).exists()) try { ResParm rp = new ResParm(true); String fileOrig = getDocBase() + getDocBase() + getPathImg(); ScaleImage si = new ScaleImage(fileOrig, "32/", 0L, 32, 0, true, false); rp = si.scaleIt(); fileOrig = si.getTheScaledImageName(); if (rp.getStatus()) { BufferedImage bi = ImageIO.read(new File(fileOrig)); DBAdapter.mkDirs(nomeFileIcoFull); ICOEncoder.write(bi, new File(nomeFileIcoFull)); } } catch (Exception e) { logDebug(true, e.getMessage()); } if (new File(getDocBase() + getDocBase() + getPathImg()).exists()) return getPathImg() + getPathImg(); return "admin/_V4/_logo/favicon.ico"; } private String getNomeFileIco() { return getImgTmst() + "_fi/favicon.ico"; } private String getNomeFileIcoAdmin() { return getImgTmst() + "_faviconAdmin.ico"; } public String getImgFileName(int imgNumber, int scaledWidth) { String targetDir = getDocBase() + getDocBase(); String newImageName = "" + scaledWidth + "/" + scaledWidth; String srcFileName = targetDir + targetDir; String targetFileName = targetDir + targetDir; ResParm rp = ScaleImage.scaleImageToFile(srcFileName, targetFileName, getPathTmpFull(), scaledWidth, 75); if (rp.getStatus()) return newImageName; return getImgFileName(imgNumber, getImgTmst()); } public String getImgFileName(int imgNumber, String l_Tmst) { return "" + getId_attivita() + "_" + getId_attivita() + "_" + l_Tmst + ".jpg"; } public String getImgFileName(long imgNumber) { return getImgFileName((int)imgNumber); } public boolean isEmailAttivita() { if (getFlgTopMail() == 0L || getEmailAttivita().isEmpty()) return false; return true; } public String getMailFrom() { return (this.mailFrom == null) ? "" : this.mailFrom.trim(); } public void setMailFrom(String mailFrom) { this.mailFrom = mailFrom; } public String getMailTitolarePrivacy() { return (this.mailTitolarePrivacy == null) ? "" : this.mailTitolarePrivacy.trim(); } public void setMailTitolarePrivacy(String mailTitolarePrivacy) { this.mailTitolarePrivacy = mailTitolarePrivacy; } public String getMailFooterCalcolato(String l_lang) { if (getId_attivita() == 0L) return ""; String l_fileName = getDocBase() + "admin/cc/_template/mailFooter-" + getDocBase() + ".html"; if (new File(l_fileName).exists()) { MailMessage mf = new MailMessage(this.apFull, l_fileName); mf.setString("ragioneSociale", getNomeAttivita()); mf.setString("sedeLegale", getIndirizzoCompletoSede()); mf.setString("cf", getCodFisc()); mf.setString("telefono", getTelefonoAttivita()); mf.setString("email", getEmailAttivita()); mf.setString("pIva", getPIva()); mf.setString("sdi", getCodiceIdentificativoFE()); mf.setString("pec", getPec()); return mf.getMessage(); } return ""; } public String getMailTitle() { return (this.mailTitle == null) ? "" : this.mailTitle.trim(); } public void setMailTitle(String mailTitle) { this.mailTitle = mailTitle; } public long getFlgCartProcediPagamento() { return this.flgCartProcediPagamento; } public void setFlgCartProcediPagamento(long flgCartProcediPagamento) { this.flgCartProcediPagamento = flgCartProcediPagamento; } public long getId_vettore() { return this.id_vettore; } public void setId_vettore(long id_vettore) { this.id_vettore = id_vettore; setVettore(null); } public Vettore getVettore() { this.vettore = (Vettore)getSecondaryObject(this.vettore, Vettore.class, getId_vettore()); return this.vettore; } public void setVettore(Vettore vettore) { this.vettore = vettore; } public String getMailCoordinateBancarie() { return (this.mailCoordinateBancarie == null) ? "" : this.mailCoordinateBancarie.trim(); } public void setMailCoordinateBancarie(String mailCoordinateBancarie) { this.mailCoordinateBancarie = mailCoordinateBancarie; } public ResParm sendLostPasswordMailMessage(String lostEmail, String lang, HttpServletRequest req) { ResParm rp = new ResParm(true); try { String subject = getMailSubject(); Users bean = new Users(getApFull()); UsersCR CR = new UsersCR(); CR.setEMail(lostEmail); bean.findUsersByEmail(lostEmail); if (bean.getDBState() == 1) { MailMessage mf = new MailMessage(getApFull(), getLostPwdMailMessage(lang)); mf.setQuestionMark(false); mf.setString("login", bean.getLogin()); if (bean.isSocialAccount()) { mf.setString("pwd", bean.getSocialIdType() + " social account"); mf.setString("extra", translate("Puoi accedere tramite il tuo account", lang) + " " + translate("Puoi accedere tramite il tuo account", lang) + ".
" + bean.getSocialIdType() + " " + translate("Se non puoi più accedere al tuo account", lang) + ", " + bean.getSocialIdType()); } else { mf.setString("pwd", bean.getPwd()); } mf.setString("nominativo", bean.getNominativo()); mf.setString("nome", bean.getNome()); mf.setString("cognome", bean.getCognome()); sendMailStandardData(mf, lang, req); MailProperties mp = new MailProperties(); mp.setProperty("FROM", getMailFrom()); mp.setProperty("TO", bean.getEMail()); if (!getMailBcc().isEmpty()) { mp.put("BCC", getEmailAttivita() + "," + getEmailAttivita()); } else { mp.setProperty("BCC", getEmailAttivita()); } mp.setProperty("SUBJECT", mf.getMailSubject() + " - " + mf.getMailSubject()); mp.setProperty("ID_USERS", String.valueOf(bean.getId_users())); rp = mf.sendMailMessage(mp, true); if (rp.getStatus()) rp.setMsg(translate("La tua password e' stata inviata correttamente all'indirizzo", lang) + translate("La tua password e' stata inviata correttamente all'indirizzo", lang)); } else { rp.setStatus(false); rp.setMsg(translate("Email non in archivio", lang)); } } catch (Exception e) { handleDebug(e); rp.setStatus(false); rp.setMsg(e.toString() + "\n" + e.toString()); } return rp; } public ResParm sendUserDataMailMessageCC(Users l_user, String lang, HttpServletRequest req) { ResParm rp = new ResParm(true); try { if (getDBState() == 1) { String userMailMessage = getUserMailMessage(lang); if (l_user.isUseControCodeAccess() && !l_user.getControlCode().isEmpty()) userMailMessage = userMailMessage.substring(0, userMailMessage.length() - 5) + "CC" + userMailMessage.substring(0, userMailMessage.length() - 5); MailMessage mf = new MailMessage(getApFull(), userMailMessage); mf.setQuestionMark(false); if (!l_user.getControlCode().isEmpty()) mf.setString("controlCode", l_user.getControlCode()); mf.setString("nota", l_user.getNota()); mf.setString("login", l_user.getLogin()); mf.setString("pwd", l_user.getPwd()); Clifor l_cliente = l_user.getClifor(); mf.setString("nome", l_cliente.getNome()); mf.setString("cognome", l_cliente.getCognome()); mf.setString("cellulare", l_cliente.getCellulare()); mf.setString("indirizzo", l_cliente.getIndirizzo()); mf.setString("numero", l_cliente.getNumeroCivico()); if (l_cliente.getCapZona().isEmpty()) { mf.setString("cap", l_cliente.getCapComune()); } else { mf.setString("cap", l_cliente.getCapZona()); } mf.setString("citta", l_cliente.getDescrizioneComune()); mf.setString("provincia", l_cliente.getProvinciaComune()); mf.setString("codfisc", l_cliente.getCodFisc()); mf.setString("codSDI", l_cliente.getCodiceIdentificativoFE()); mf.setString("pec", l_cliente.getPec()); mf.setString("piva", l_cliente.getPIva()); mf.setString("email", l_cliente.getEMail()); mf.setString("nazione", l_cliente.getNazione().getDescrizione(lang)); DestinazioneDiversa l_dd = l_cliente.getCurrentDD(); if (l_dd.getId_destinazioneDiversa() == 0L) { mf.setString("indirizzoSped", l_cliente.getIndirizzo()); mf.setString("numeroSped", l_cliente.getNumeroCivico()); if (l_cliente.getCapZona().isEmpty()) { mf.setString("capSped", l_cliente.getCapComune()); } else { mf.setString("capSped", l_cliente.getCapZona()); } mf.setString("cittaSped", l_cliente.getDescrizioneComune()); mf.setString("provinciaSped", l_cliente.getProvinciaComune()); mf.setString("nazioneSped", l_cliente.getNazione().getDescrizione(lang)); } else { if (l_dd.getPressoDD().isEmpty()) { mf.setString("indirizzoSped", l_dd.getIndirizzoDD()); } else { mf.setString("indirizzoSped", " c/o " + l_dd.getPressoDD() + "
" + l_dd.getIndirizzoDD()); } mf.setString("numeroSped", l_dd.getNumeroCivicoDD()); if (l_dd.getCapZonaDD().isEmpty()) { mf.setString("capSped", l_dd.getCapComuneDD()); } else { mf.setString("capSped", l_dd.getCapZonaDD()); } mf.setString("cittaSped", l_dd.getDescrizioneComuneDD()); mf.setString("provinciaSped", l_dd.getProvinciaComuneDD()); mf.setString("nazioneSped", l_dd.getNazioneDD().getDescrizione(lang)); } sendMailStandardData(mf, lang, req); mf.setString("titolarePrivacy", getMailTitolarePrivacy()); MailProperties mp = new MailProperties(); mp.setProperty("FROM", getMailFrom()); mp.setProperty("TO", l_cliente.getEMail()); if (!getMailBcc().isEmpty()) { mp.put("BCC", getEmailAttivita() + "," + getEmailAttivita()); } else { mp.setProperty("BCC", getEmailAttivita()); } mp.setProperty("SUBJECT", mf.getMailSubject() + " " + mf.getMailSubject()); mp.setProperty("ID_USERS", String.valueOf(l_user.getId_users())); rp = mf.sendMailMessage(mp, true); } else { rp.setStatus(false); rp.setMsg(translate("Email non in archivio", lang)); } } catch (Exception e) { handleDebug(e); rp.setStatus(false); rp.setMsg(e.getMessage()); } return rp; } private void sendMailStandardData(MailMessage mf, String l_lang, HttpServletRequest req) { sendMailStandardData(mf, l_lang, this, req); } public static final void sendMailStandardData(MailMessage mf, String l_lang, Attivita bean, HttpServletRequest req) { String l_wwwaddress = bean.getWwwAddress(); mf.setString("wwwaddress", l_wwwaddress); mf.setString("logo", l_wwwaddress + l_wwwaddress + bean.getPathImg()); mf.setString("titolarePrivacy", bean.getMailTitolarePrivacy()); mf.setString("footer", bean.getMailFooter(l_lang)); mf.setString("mailContatto", bean.getEmailAttivita()); mf.setString("firma", bean.getNomeAttivita()); if (req != null) mf.setString("ip", req.getRemoteHost() + " " + req.getRemoteHost()); mf.setString("timestamp", new java.util.Date(System.currentTimeMillis()).toString()); String social = "\"\""; if (!bean.getAccountFacebook().isEmpty()) { String s = social.replace("#", bean.getAccountFacebook()); s = s.replace("@", "facebook"); System.out.println(s); mf.setString("socialFacebook", s); } if (!bean.getAccountTwitter().isEmpty()) { String s = social.replace("#", bean.getAccountTwitter()); s = s.replace("@", "twitter"); mf.setString("socialTwitter", s); } if (!bean.getAccountInstagram().isEmpty()) { String s = social.replace("#", bean.getAccountInstagram()); s = s.replace("@", "instagram"); mf.setString("socialInstagram", s); } if (bean.getTopColoreHex().isEmpty()) { mf.setString("topColor", "#3e7cb4"); } else { mf.setString("topColor", bean.getTopColoreHex()); } if (bean.getTopFontColorHex().isEmpty()) { mf.setString("topFontColor", "#fff"); } else { mf.setString("topFontColor", bean.getTopFontColorHex()); } } protected String getUserMailMessage(String lang) { if (lang != null && lang.isEmpty()) lang = "it"; String temp = getDocBase() + getDocBase(); if (lang != null && !lang.isEmpty()) { int dot = temp.lastIndexOf("."); if (dot > 0) temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); } return temp; } protected String getLostPwdMailMessage(String lang) { if (lang != null && lang.isEmpty()) lang = "it"; String temp = getDocBase() + getDocBase(); if (lang != null && !lang.isEmpty()) { int dot = temp.lastIndexOf("."); if (dot > 0) temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); } return temp; } public ResParm sendOrderMailMessageCC(Documento l_documento, Users l_user, String lang, boolean mailAdmin, boolean mailUser, boolean isPagamentoVariato, boolean isSpedito, HttpServletRequest req) { lang = "it"; ResParm rp = new ResParm(true); if (l_documento.getId_tipoDocumento() != l_documento.getId_docOrdineWWW() || l_documento.getTmstInvioMailOrdine() == null); NumberFormat nf = getNf(); String RIGA_RIEPILOGO = " \n ##desc##\n Eu ##prezzo##\n "; String rigaRiepilogoAltreSpese = ""; if (l_documento.getSpeseAltre() > 0.0D) { rigaRiepilogoAltreSpese = " \n ##desc##\n Eu ##prezzo##\n ".replace("##desc##", translate(l_documento.getDescSpeseAltre(), lang)); rigaRiepilogoAltreSpese = rigaRiepilogoAltreSpese.replace("##prezzo##", nf.format(l_documento.getSpeseAltre())); } String urlBase = getWwwAddress(); MailProperties mp = new MailProperties(); if (l_documento.getId_documento() == 0L) { rp.setStatus(false); rp.setMsg(translate("ERRORE! Codice Documento nullo! Contattare l'amministratore del sito", lang)); handleDebug(rp.getMsg(), 0); return rp; } try { int ordineInverso = (l_documento.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; Documento fattura = null; if (isSpedito) if (l_documento.isFatturaONotaDiCredito()) { fattura = l_documento.getDocumentoFiglioUno(); } else { fattura = l_documento; } String subject = getMailSubject(); String notePagamento = "", statoPagamento = ""; String notaStato = " " + translate(l_documento.getStatoOrdineWww(), lang) + " "; String linkOrdineDiretto = ""; String orderLine = ""; String orderLine2 = ""; DoubleOperator totaleCosto = new DoubleOperator(); double totaleQta = 0.0D; statoPagamento = translate("Metodo di pagamento scelto ", lang) + ": " + translate("Metodo di pagamento scelto ", lang); if (l_documento.getStatoPagato() >= 1L) statoPagamento = statoPagamento + "
" + statoPagamento + translate("Transazione n. ", lang) + " " + l_documento.getDescTransaction() + " " + translate("del", lang); if (l_user.isProfileNoReg()) { linkOrdineDiretto = "
" + translate("Per accedere direttamente all'ordine: ", lang); linkOrdineDiretto = linkOrdineDiretto + "" + l_documento.getLinkOrdineWwwNoReg(l_user) + ""; } else { linkOrdineDiretto = "
" + translate("Per accedere direttamente all'ordine: ", lang); linkOrdineDiretto = linkOrdineDiretto + "" + l_documento.getLinkOrdineWww() + ""; } if (l_documento.getStatoPagato() == 0L) { if (l_documento.getFlgProcediPagamento() == 1L) { notePagamento = l_documento.getTipoPagamento().getMsgMailProcedi(lang); if (l_documento.getTipoPagamento().getFlgTipoPagamento() != 5L); notePagamento = notePagamento + notePagamento; } else { notePagamento = l_documento.getTipoPagamento().getMsgMailAspetta(lang); } } else { notePagamento = ""; } if (l_documento.getFlgStatoOrdineWww() == 2L) notaStato = translate(getParm("MSG_ORDINE_SPEDITO").getTesto(), lang); if (mailUser || isPagamentoVariato) { String temp; String mmFile = l_documento.getCheckOutMailMessage(lang); if (isSpedito) mmFile = mmFile.replace(".html", "_spedito.html"); MailMessage mf = new MailMessage(getApFull(), mmFile); if (isSpedito) { if (fattura.getDataSpedizione() == null) fattura.setDataSpedizione(DBAdapter.getToday()); mf.setString("dataSpedizione", getDataFormat().format(fattura.getDataSpedizione())); mf.setString("corriere", fattura.getVettore().getDescrizione()); mf.setString("nColli", String.valueOf(fattura.getNColli())); String str = ""; if (!l_documento.getNotaSpedizione().isEmpty()) str = str + "

" + str; mf.setString("notaContrassegno", str); if (!fattura.getVettore().getLinkTracking().isEmpty() && !fattura.getTrackingSpedizione().isEmpty()) { String id_docCrypt = crypt(String.valueOf(fattura.getId_documento())); String link = fattura.getVettore().getLinkTracking() + fattura.getVettore().getLinkTracking(); String track = translate("Potra' verificare la spedizione al seguente", lang) + " link "; mf.setString("tracking", track); } } mf.setQuestionMark(false); mf.setLong("id_ordine", l_documento.getProgOrdineWww()); mf.setString("stato", translate(l_documento.getStatoOrdineWww(), lang)); mf.setString("dataOrdine", getDataFormat().format(l_documento.getDataDocumento())); mf.setString("statoPagamento", statoPagamento); mf.setString("notaPagamento", notePagamento); mf.setLong("id_users", l_documento.getClifor().getId_clifor()); mf.setString("nome", l_documento.getClifor().getNome()); mf.setString("cognome", l_documento.getClifor().getCognome()); mf.setString("indirizzo", l_documento.getClifor().getIndirizzo()); mf.setString("numero", l_documento.getClifor().getNumeroCivico()); if (l_documento.getClifor().getCapZona().isEmpty()) { mf.setString("cap", l_documento.getClifor().getCapComune()); } else { mf.setString("cap", l_documento.getClifor().getCapZona()); } mf.setString("citta", l_documento.getClifor().getDescrizioneComune()); mf.setString("provincia", l_documento.getClifor().getProvinciaComune()); mf.setString("codfisc", l_documento.getClifor().getCodFisc()); mf.setString("codSDI", l_documento.getClifor().getCodiceIdentificativoFE()); mf.setString("pec", l_documento.getClifor().getPec()); mf.setString("piva", l_documento.getClifor().getPIva()); mf.setString("email", l_documento.getClifor().getEMail()); mf.setString("nazione", l_documento.getClifor().getNazione().getDescrizione(lang)); if (l_documento.getIndirizzoSped().trim().equals("")) { if (l_documento.getPresso().isEmpty()) { mf.setString("indirizzoSped", l_documento.getClifor().getIndirizzo()); } else { mf.setString("indirizzoSped", "c/o " + l_documento.getPresso() + "
" + l_documento.getClifor().getIndirizzo()); } mf.setString("numeroSped", l_documento.getClifor().getNumeroCivico()); if (l_documento.getClifor().getCapZona().isEmpty()) { mf.setString("capSped", l_documento.getClifor().getCapComune()); } else { mf.setString("capSped", l_documento.getClifor().getCapZona()); } mf.setString("cittaSped", l_documento.getClifor().getDescrizioneComune()); mf.setString("provinciaSped", l_documento.getClifor().getProvinciaComune()); mf.setString("nazioneSped", l_documento.getClifor().getNazione().getDescrizione(lang)); } else { if (l_documento.getPresso().isEmpty()) { mf.setString("indirizzoSped", l_documento.getIndirizzoSped()); } else { mf.setString("indirizzoSped", " c/o " + l_documento.getPresso() + "
" + l_documento.getIndirizzoSped()); } mf.setString("numeroSped", l_documento.getNumeroCivicoSped()); mf.setString("capSped", l_documento.getCapSped()); mf.setString("cittaSped", l_documento.getCittaSped()); mf.setString("provinciaSped", l_documento.getProvinciaSped()); mf.setString("nazioneSped", l_documento.getNazioneSped().getDescrizione(lang)); } Vectumerator enu = l_documento.findRigheDocumento(0, 0, ordineInverso); while (enu.hasMoreElements()) { String imgSrc; RigaDocumento row = (RigaDocumento)enu.nextElement(); if (row.getId_articolo() > 0L) { imgSrc = ""; } else { imgSrc = ""; } orderLine = orderLine + " " + orderLine + imgSrc + "€ " + row.getDescrizioneRigaCompleta() + "" + nf.format(row.getImponibile()) + "" + row.getQuantita() + "€ " + ((row.getSconto() == 0.0D) ? "" : (nf.format(row.getSconto()) + " %")) + "\n"; totaleQta += row.getQuantita(); } mf.setString("orderline", orderLine); if (l_documento.getTotaleScontiAbbuoniConIva() > 0.0D) { mf.setString("descSconto", "**** " + translate("SCONTO INCONDIZIONATO", lang) + " *****"); mf.setString("scontoInc", " - " + nf.format(l_documento.getTotaleScontiAbbuoni())); } mf.setString("qta", nf.format(totaleQta)); mf.setString("totale", nf.format(l_documento.getImponibileTotale())); mf.setString("totaleOrdine", nf.format(l_documento.getTotaleDocumento())); mf.setString("iva", nf.format(l_documento.getImportoIvaTotale())); if (l_documento.isSpeseSpedizioneWwwPreventivo()) { mf.setString("speseSped", " " + translate("da preventivare", lang)); } else { mf.setString("speseSped", nf.format(l_documento.getSpeseTrasporto())); } if (l_documento.getSpeseAltre() > 0.0D) mf.setString("rigaRiepilogo1", rigaRiepilogoAltreSpese); if (l_documento.getNotePagamento().isEmpty()) { temp = l_documento.getNotaAggiuntiva(); } else { temp = "" + l_documento.getNotePagamento() + "
" + l_documento.getNotaAggiuntiva(); } if (!l_documento.getNotaMail().isEmpty()) temp = temp + "
" + temp; mf.setString("nota", temp); mf.setLong("codiceOrdine", l_documento.getProgOrdineWww()); mf.setString("telefono", l_documento.getClifor().getCellulare() + " " + l_documento.getClifor().getCellulare()); mf.setString("linkOrdineDiretto", linkOrdineDiretto); sendMailStandardData(mf, lang, req); String theSubject = translate(subject, lang); String l_email = l_documento.getClifor().getEMail(); if (mailUser) { theSubject = theSubject + " - " + theSubject + " " + translate("Ordine n.", lang) + " - " + l_documento.getProgOrdineWww(); if (l_documento.getFlgPagata() == 1L) theSubject = theSubject + " - " + theSubject + " " + translate("Pagato tramite ", lang); } if (isPagamentoVariato) { theSubject = theSubject + theSubject + " " + translate("Ordine n.", lang) + " - " + l_documento.getProgOrdineWww() + " - "; theSubject = theSubject + theSubject; theSubject = theSubject + theSubject; } mp.put("TO", l_email); if (!getMailBcc().isEmpty()) { mp.put("BCC", getEmailAttivita() + "," + getEmailAttivita()); } else { mp.setProperty("BCC", getEmailAttivita()); } mp.setProperty("FROM", getMailFrom()); if (l_documento.hasDocumentiFiglio()) { Documento fatturaAll = l_documento.getDocumentoFiglioUno(); if (fatturaAll.getId_documento() > 0L && fatturaAll.getFlgStato() != 0L) { DocumentoCR CRf = new DocumentoCR(getApFull()); CRf.setId_documentoS(fatturaAll.getId_documento()); fatturaAll.creaDocumentoPdf(CRf, true); mp.put("FILES", CRf.getFilePdf()); } } mp.put("SUBJECT", theSubject); mp.put("MSG", mf.getMessage()); System.out.println(mf.getMessage()); mp.setProperty("ISHTML", "true"); rp = sendMailMessage(mp); if (rp.getStatus() && isSpedito) { fattura.setDataInvioMailSped(getToday()); fattura.save(); } } if (mailAdmin) { String temp; String mmfAdmMessage = l_documento.getCheckOutMailMessage("it"); mmfAdmMessage = mmfAdmMessage.replace(".html", "_Adm.html"); MailMessage mfAdm = new MailMessage(getApFull(), mmfAdmMessage); mfAdm.setQuestionMark(false); mfAdm.setLong("id_ordine", l_documento.getProgOrdineWww()); mfAdm.setString("stato", l_documento.getStato()); mfAdm.setString("dataOrdine", getDataFormat().format(l_documento.getDataDocumento())); mfAdm.setString("statoPagamento", statoPagamento); mfAdm.setString("notaPagamento", notePagamento); mfAdm.setLong("id_users", l_documento.getClifor().getId_clifor()); mfAdm.setLong("id_clifor", l_documento.getClifor().getId_clifor()); mfAdm.setString("nominativo", l_documento.getClifor().getCognome()); mfAdm.setString("nome", l_documento.getClifor().getNome()); mfAdm.setString("cognome", l_documento.getClifor().getCognome()); mfAdm.setString("indirizzo", l_documento.getClifor().getIndirizzo()); mfAdm.setString("numero", l_documento.getClifor().getNumeroCivico()); if (l_documento.getClifor().getCapZona().isEmpty()) { mfAdm.setString("cap", l_documento.getClifor().getCapComune()); } else { mfAdm.setString("cap", l_documento.getClifor().getCapZona()); } mfAdm.setString("citta", l_documento.getClifor().getDescrizioneComune()); mfAdm.setString("provincia", l_documento.getClifor().getProvinciaComune()); mfAdm.setString("codfisc", l_documento.getClifor().getCodFisc()); mfAdm.setString("codSDI", l_documento.getClifor().getCodiceIdentificativoFE()); mfAdm.setString("pec", l_documento.getClifor().getPec()); mfAdm.setString("piva", l_documento.getClifor().getPIva()); mfAdm.setString("email", l_documento.getClifor().getEMail()); if (l_documento.getIndirizzoSped().trim().equals("")) { if (l_documento.getPresso().isEmpty()) { mfAdm.setString("indirizzoSped", l_documento.getClifor().getIndirizzo()); } else { mfAdm.setString("indirizzoSped", "c/o " + l_documento.getPresso() + "
" + l_documento.getClifor().getIndirizzo()); } mfAdm.setString("numeroSped", l_documento.getClifor().getNumeroCivico()); if (l_documento.getClifor().getCapZona().isEmpty()) { mfAdm.setString("capSped", l_documento.getClifor().getCapComune()); } else { mfAdm.setString("capSped", l_documento.getClifor().getCapZona()); } mfAdm.setString("cittaSped", l_documento.getClifor().getDescrizioneComune()); mfAdm.setString("provinciaSped", l_documento.getClifor().getProvinciaComune()); mfAdm.setString("nazioneSped", l_documento.getClifor().getNazione().getDescrizione(lang)); } else { if (l_documento.getPresso().isEmpty()) { mfAdm.setString("indirizzoSped", l_documento.getIndirizzoSped()); } else { mfAdm.setString("indirizzoSped", "c/o " + l_documento.getPresso() + "
" + l_documento.getIndirizzoSped()); } mfAdm.setString("numeroSped", l_documento.getNumeroCivicoSped()); mfAdm.setString("capSped", l_documento.getCapSped()); mfAdm.setString("cittaSped", l_documento.getCittaSped()); mfAdm.setString("provinciaSped", l_documento.getProvinciaSped()); mfAdm.setString("nazioneSped", l_documento.getNazioneSped().getDescrizione(lang)); } orderLine2 = ""; totaleCosto = new DoubleOperator(); totaleQta = 0.0D; String stileRicarico = ""; Vectumerator enu = l_documento.findRigheDocumento(0, 0, ordineInverso); while (enu.hasMoreElements()) { RigaDocumento row = (RigaDocumento)enu.nextElement(); StringBuilder sbLinkAdmin = new StringBuilder(); sbLinkAdmin.append("
"); sbLinkAdmin.append(row.getArticolo().getCodice()); sbLinkAdmin.append(""); String fornitoreUltimoCosto = "
" + row.getArticolo().getFornitoreCostoNuovo().getCognomeNome(); orderLine2 = orderLine2 + " " + orderLine2 + row.getCodiceArticolo() + "" + sbLinkAdmin.toString() + " " + row.getDescrizioneRigaCompleta() + "" + row.getArticolo().getCodiciAlternativi() + getNf0().format(row.getArticolo().getQuantita()) + "" + ((row.getArticolo().getFlgEbay() == 1L) ? " EBAY " : "") + nf.format(row.getArticolo().getCostoNetto()) + "" + fornitoreUltimoCosto + "" + row.getArticolo().getRicaricoEffettivoDaCostoNetto() + "" + nf.format(row.getImponibile()) + "" + getNf0().format(row.getQuantita()) + "" + ((row.getSconto() == 0.0D) ? "" : (nf.format(row.getSconto()) + " %")) + "\n"; DoubleOperator totaleArticolo = new DoubleOperator(row.getImponibile()); totaleArticolo.multiply(row.getQuantita()); totaleCosto.add(totaleArticolo); totaleQta += row.getQuantita(); } mfAdm.setString("orderline", orderLine2); mfAdm.setString("qta", nf.format(totaleQta)); mfAdm.setString("iva", nf.format(l_documento.getImportoIvaTotale())); if (l_documento.isSpeseSpedizioneWwwPreventivo()) { mfAdm.setString("speseSped", " " + translate("da preventivare", lang)); } else { mfAdm.setString("speseSped", nf.format(l_documento.getSpeseTrasporto())); } if (l_documento.getSpeseAltre() > 0.0D) mfAdm.setString("rigaRiepilogo1", rigaRiepilogoAltreSpese); mfAdm.setString("totale", nf.format(l_documento.getImponibileTotale())); mfAdm.setString("totaleOrdine", nf.format(l_documento.getTotaleDocumento())); if (l_documento.getNotePagamento().isEmpty()) { temp = "Nota su Ordine: " + l_documento.getNotaAggiuntiva(); } else { temp = "Nota Pagamento: " + l_documento.getNotePagamento() + "
Nota su Ordine: " + l_documento.getNotaAggiuntiva(); } if (!l_documento.getNotaMail().isEmpty()) temp = temp + "
Nota Mail: " + temp; mfAdm.setString("nota", temp); mfAdm.setString("notaAmm", "Nota su cliente: " + l_documento.getClifor().getNota()); mfAdm.setLong("codiceOrdine", l_documento.getProgOrdineWww()); mfAdm.setString("telefono", l_documento.getClifor().getCellulare() + " " + l_documento.getClifor().getCellulare()); mfAdm.setString("orderline", orderLine2); mfAdm.setString("notaStato", notaStato); sendMailStandardData(mfAdm, lang, req); String sbjAdmin = subject + " - Adm Ordine n. " + subject + " - " + String.valueOf(l_documento.getProgOrdineWww()) + " - " + l_documento.getNominativoDocumento() + " - "; if (isPagamentoVariato) sbjAdmin = sbjAdmin + "PAGAMENTO VARIATO "; if (l_documento.getFlgPagata() == 1L) { sbjAdmin = sbjAdmin + sbjAdmin + " " + translate("Pagato tramite ", lang); } else { sbjAdmin = sbjAdmin + sbjAdmin; } mp = new MailProperties(); mp.put("TO", getEmailAttivita()); if (!getMailBcc().isEmpty()) mp.put("BCC", getMailBcc()); mp.setProperty("FROM", getMailFrom()); mp.put("SUBJECT", sbjAdmin); mp.put("MSG", mfAdm.getMessage()); mp.setProperty("ISHTML", "true"); rp.append(sendMailMessage(mp)); } } catch (Exception e) { handleDebug(e); rp.setStatus(false); rp.setMsg(e); System.out.println("sendOrderMailMessageCC ERRORE INVIO EMAIL:"); e.printStackTrace(); } if (!rp.getStatus()) { handleDebug(rp.getMsg(), 2); System.out.println("sendOrderMailMessageCC ERRORE INVIO EMAIL:" + rp.getMsg()); } else { Timestamp tmst = getTimestamp(); l_documento.setTmstInvioMailOrdine(tmst); l_documento.superSave(); } return rp; } public ResParm sendResoMailMessage() { ResParm rp = new ResParm(true); return rp; } public ResParm sendMLMailMessage(Users l_user, String lang, HttpServletRequest req) { ResParm rp = new ResParm(true); try { if (lang.equals("")) lang = "it"; MailMessage mf = new MailMessage(getApFull(), getDocBase() + getDocBase()); mf.setQuestionMark(false); String indirizzoWWW = getWwwAddressParm(); if (!l_user.getControlCode().isEmpty()) { String codiceConferma = "" + translate("Clicca qui per attivare", l_user.getLangMl()) + " "; mf.setString("codiceConferma", codiceConferma); } sendMailStandardData(mf, lang, req); MailProperties mp = new MailProperties(); mp.setProperty("FROM", getMailFrom()); mp.setProperty("TO", l_user.getEMail()); if (!getMailBcc().isEmpty()) { mp.put("BCC", getEmailAttivita() + "," + getEmailAttivita()); } else { mp.setProperty("BCC", getEmailAttivita()); } mp.setProperty("SUBJECT", mf.getMailSubject() + " - " + mf.getMailSubject()); rp = mf.sendMailMessage(mp, true); } catch (Exception e) { handleDebug(e); rp.setStatus(false); rp.setMsg(e.toString() + "\n" + e.toString()); } return rp; } public String getWwwAddress() { return (this.wwwAddress == null) ? "" : this.wwwAddress.trim(); } public void setWwwAddress(String wwwAddress) { this.wwwAddress = wwwAddress; } public String getTopFontColorHex() { return (this.topFontColorHex == null) ? "" : this.topFontColorHex; } public void setTopFontColorHex(String topFontColor) { this.topFontColorHex = topFontColor; } public String getBackgroundColorHex() { return (this.backgroundColorHex == null) ? "" : this.backgroundColorHex.trim(); } public void setBackgroundColorHex(String backgroundColorHex) { this.backgroundColorHex = backgroundColorHex; } public String getBackgroundColorFooterHex() { return (this.backgroundColorFooterHex == null) ? "" : this.backgroundColorFooterHex.trim(); } public void setBackgroundColorFooterHex(String backgroundColorFooterHex) { this.backgroundColorFooterHex = backgroundColorFooterHex; } public String getBackgroundColorNavHoverHex() { return (this.backgroundColorNavHoverHex == null) ? "" : this.backgroundColorNavHoverHex.trim(); } public void setBackgroundColorNavHoverHex(String backgroundColorNavHoverHex) { this.backgroundColorNavHoverHex = backgroundColorNavHoverHex; } public String getBackgroundCustomFeatureBox() { return (this.backgroundCustomFeatureBox == null) ? "" : this.backgroundCustomFeatureBox.trim(); } public void setBackgroundCustomFeatureBox(String backgroundCustomFeatureBox) { this.backgroundCustomFeatureBox = backgroundCustomFeatureBox; } public String getHeadCategorieBorderColorHex() { return (this.headCategorieBorderColorHex == null) ? "" : this.headCategorieBorderColorHex.trim(); } public void setHeadCategorieBorderColorHex(String headCategorieBorderColorHex) { this.headCategorieBorderColorHex = headCategorieBorderColorHex; } public String getMainTextColorHex() { return (this.mainTextColorHex == null) ? "" : this.mainTextColorHex.trim(); } public void setMainTextColorHex(String mainTextColorHex) { this.mainTextColorHex = mainTextColorHex; } public String getLeftMenuTextColorHex() { return (this.leftMenuTextColorHex == null) ? "" : this.leftMenuTextColorHex.trim(); } public void setLeftMenuTextColorHex(String leftMenuTextColorHex) { this.leftMenuTextColorHex = leftMenuTextColorHex; } public String getLeftMenuSubTextColorHex() { return (this.leftMenuSubTextColorHex == null) ? "" : this.leftMenuSubTextColorHex.trim(); } public void setLeftMenuSubTextColorHex(String leftMenuSubTextColorHex) { this.leftMenuSubTextColorHex = leftMenuSubTextColorHex; } public String getSubtitleHex() { return (this.subtitleHex == null) ? "" : this.subtitleHex.trim(); } public void setSubtitleHex(String subtitleHex) { this.subtitleHex = subtitleHex; } public String getBodyBackgroundHex() { return (this.bodyBackgroundHex == null) ? "" : this.bodyBackgroundHex.trim(); } public void setBodyBackgroundHex(String bodyBackgroundHex) { this.bodyBackgroundHex = bodyBackgroundHex; } public String getFooterTextH5Hex() { return (this.footerTextH5Hex == null) ? "" : this.footerTextH5Hex.trim(); } public void setFooterTextH5Hex(String footerTextH5Hex) { this.footerTextH5Hex = footerTextH5Hex; } public String getFooterTextliHex() { return (this.footerTextliHex == null) ? "" : this.footerTextliHex.trim(); } public void setFooterTextliHex(String footerTextliHex) { this.footerTextliHex = footerTextliHex; } public String getFooterTextliAHex() { return (this.footerTextliAHex == null) ? "" : this.footerTextliAHex.trim(); } public void setFooterTextliAHex(String footerTextliAHex) { this.footerTextliAHex = footerTextliAHex; } public String getPaypalClientId() { return (this.paypalClientId == null) ? "" : this.paypalClientId.trim(); } public void setPaypalClientId(String paypalApiPwd) { this.paypalClientId = paypalApiPwd; } public String getPaypalClientSecret() { return (this.paypalClientSecret == null) ? "" : this.paypalClientSecret.trim(); } public void setPaypalClientSecret(String paypalApiSignature) { this.paypalClientSecret = paypalApiSignature; } public double getCostoContrassegno() { return this.costoContrassegno; } public void setCostoContrassegno(double costoContrassegno) { this.costoContrassegno = costoContrassegno; } public String getMainSxTitle(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mainSxTitle", l_lang); } public String getCartTitle(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("cartTitle", l_lang); } public String getCartText(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("cartText", l_lang); } public String getPrivacy(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("privacy", l_lang); } public String getTermConditions(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("termConditions", l_lang); } public boolean isSocial(String l_lang) { return (isFacebook() || isTwitter() || isInstagram() || isTripAdvisorScript(l_lang)); } public String getReturnConditions(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("returnConditions", l_lang); } public String getDetailDxTitle(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("detailDxTitle", l_lang); } public String getDetailXsTitle(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("detailXsTitle", l_lang); } public String getCookiePolicyText(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("cookiePolicyText", l_lang); } public String getCheckCartText(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("checkCartText", l_lang); } public boolean isCartText(String l_lang) { return !(getCartText(l_lang).isEmpty() || getCartTitle(l_lang).isEmpty()); } public boolean useDescLangTables() { return true; } public long getFlgNewsletterType() { return this.flgNewsletterType; } public void setFlgNewsletterType(long flgNewsletterType) { this.flgNewsletterType = flgNewsletterType; } public String getMailchimpSubscribeForm() { return (this.mailchimpSubscribeForm == null) ? "" : this.mailchimpSubscribeForm.trim(); } public void setMailchimpSubscribeForm(String mailchimpSubscribeForm) { this.mailchimpSubscribeForm = mailchimpSubscribeForm; } public String getTagManagerHead() { return (this.tagManagerHead == null) ? "" : this.tagManagerHead.trim(); } public void setTagManagerHead(String tagManagerHead) { this.tagManagerHead = tagManagerHead; } public String getTagManagerBody() { return (this.tagManagerBody == null) ? "" : this.tagManagerBody.trim(); } public void setTagManagerBody(String tagManagerBody) { this.tagManagerBody = tagManagerBody; } public static final String getNewsletterType(long l_flgNewsletterType) { switch ((int)l_flgNewsletterType) { case 0: return "Nessuna"; case 2: return "Mailchimp"; case 1: return "Interna"; } return "??"; } public String getNewsletterType() { return getNewsletterType(getFlgNewsletterType()); } public long getFlgDetailCompara() { return this.flgDetailCompara; } public void setFlgDetailCompara(long flgDetailCompara) { this.flgDetailCompara = flgDetailCompara; } public long getFlgDetailWishlist() { return this.flgDetailWishlist; } public void setFlgDetailWishlist(long flgDetailWishlist) { this.flgDetailWishlist = flgDetailWishlist; } public long getFlgDetailShareAddThis() { return this.flgDetailShareAddThis; } public void setFlgDetailShareAddThis(long flgDetailShareAddThis) { this.flgDetailShareAddThis = flgDetailShareAddThis; } public boolean isDetailWishlist() { return !(getFlgDetailWishlist() == 0L); } public boolean isLingueAttive() { if (getFlgTopLingue() == 0L || getTopLingueAttivita().isEmpty()) return false; return true; } public boolean isDetailReviews() { return (getFlgDetailReviews() == 0L) ? false : false; } public boolean isMainBanner() { return !(getFlgMainBanner() == 0L); } public boolean isMainUltimi() { return (getFlgMainUltimi() == 1L && getMainUltimiNum() > 0L); } public boolean isMainUltimaNews() { return !(getFlgMainUltimaNews() == 0L); } public boolean isMainVetrina() { return !(getFlgMainVetrina() == 0L); } public boolean isMainVetrinaCategorie() { return !(getFlgMainVetrinaCategorie() == 0L); } public boolean isMainMiniBanner() { return !(getFlgMainMiniBanner() == 0L); } public boolean isDetailRelatedProducts() { return !(getFlgDetailRelatedProducts() == 0L); } public boolean isDetailCompara() { return !(getFlgDetailCompara() == 0L); } public boolean isDetailDxVetrinaOfferte() { return (getFlgDetailDxVetrinaOfferte() == 1L); } public long getFlgMainMiniBanner() { return this.flgMainMiniBanner; } public void setFlgMainMiniBanner(long flgMainMiniBanner) { this.flgMainMiniBanner = flgMainMiniBanner; } public String getIndirizzoCompletoAttivitaHtml() { StringBuilder sb = new StringBuilder(); sb.append(getIndirizzoAttivita()); sb.append(" "); sb.append(getNumeroCivicoAttivita()); sb.append("
"); if (getCapZonaAttivita().isEmpty()) { sb.append(getCapComuneAttivita()); } else { sb.append(getCapZonaAttivita()); } sb.append(" "); sb.append(getDescrizioneComuneAttivita()); sb.append(" ("); sb.append(getDescrizioneProvinciaAttivita()); sb.append(")
"); return sb.toString(); } public String getMainSubtitleBottomBorderHex() { return (this.mainSubtitleBottomBorderHex == null) ? "" : this.mainSubtitleBottomBorderHex.trim(); } public void setMainSubtitleBottomBorderHex(String mainSubtitleBottomBorderHex) { this.mainSubtitleBottomBorderHex = mainSubtitleBottomBorderHex; } public boolean isNOSocialNOnewsletter(String l_lang) { return (!isSocial(l_lang) && getFlgNewsletterType() == 0L); } public String getIndirizzoSede() { return (this.indirizzoSede == null) ? "" : this.indirizzoSede.trim(); } public void setIndirizzoSede(String indirizzoSede) { this.indirizzoSede = indirizzoSede; } public String getNumeroCivicoSede() { return (this.numeroCivicoSede == null) ? "" : this.numeroCivicoSede.trim(); } public void setNumeroCivicoSede(String numeroCivicoSede) { this.numeroCivicoSede = numeroCivicoSede; } public long getId_comuneSede() { return this.id_comuneSede; } public void setId_comuneSede(long id_comuneSede) { this.id_comuneSede = id_comuneSede; setComuneSede(null); } public String getDescrizioneComuneSede() { return (this.descrizioneComuneSede == null) ? "" : this.descrizioneComuneSede.trim(); } public void setDescrizioneComuneSede(String descrizioneComuneSede) { this.descrizioneComuneSede = descrizioneComuneSede; } public String getDescrizioneProvinciaSede() { return (this.descrizioneProvinciaSede == null) ? "" : this.descrizioneProvinciaSede.trim(); } public void setDescrizioneProvinciaSede(String descrizioneProvinciaSede) { this.descrizioneProvinciaSede = descrizioneProvinciaSede; } public String getCapComuneSede() { return (this.capComuneSede == null) ? "" : this.capComuneSede.trim(); } public void setCapComuneSede(String capComuneSede) { this.capComuneSede = capComuneSede; } public Comune getComuneSede() { this.comuneSede = (Comune)getSecondaryObject(this.comuneSede, Comune.class, getId_comuneSede()); return this.comuneSede; } public void setComuneSede(Comune comuneSede) { this.comuneSede = comuneSede; } public String getCapZonaSede() { return (this.capZonaSede == null) ? "" : this.capZonaSede.trim(); } public void setCapZonaSede(String capZonaSede) { this.capZonaSede = capZonaSede; } public String getTelefonoSede() { return (this.telefonoSede == null) ? "" : this.telefonoSede.trim(); } public void setTelefonoSede(String telefonoSede) { this.telefonoSede = telefonoSede; } public String getCodFisc() { return (this.codFisc == null) ? "" : this.codFisc.trim(); } public void setCodFisc(String codFisc) { this.codFisc = codFisc; } public String getPIva() { return (this.pIva == null) ? "" : this.pIva.trim(); } public void setPIva(String pIva) { this.pIva = pIva; } public String getPec() { return (this.pec == null) ? "" : this.pec.trim(); } public void setPec(String pec) { this.pec = pec; } public String getCodiceIdentificativoFE() { return (this.codiceIdentificativoFE == null) ? "" : this.codiceIdentificativoFE.trim().toUpperCase(); } public void setCodiceIdentificativoFE(String codiceIdentificativoFE) { this.codiceIdentificativoFE = codiceIdentificativoFE; } public String getContatto() { return (this.contatto == null) ? "" : this.contatto.trim(); } public void setContatto(String contatto) { this.contatto = contatto; } public boolean isTagManagerAttivo() { if (getTagManagerBody().isEmpty() || getTagManagerHead().isEmpty()) return false; return true; } public long getQtaDisponibilitaBassa() { return this.qtaDisponibilitaBassa; } public void setQtaDisponibilitaBassa(long qtaDisponibilitaBassa) { this.qtaDisponibilitaBassa = qtaDisponibilitaBassa; } public long getFlgAcquistaSoloDisponibile() { return this.flgAcquistaSoloDisponibile; } public void setFlgAcquistaSoloDisponibile(long flgAcquistaSoloDisponibile) { this.flgAcquistaSoloDisponibile = flgAcquistaSoloDisponibile; } protected void initFields() { super.initFields(); setQtaDisponibilitaBassa(5L); setPHEAD_DOC1(null); setPHEAD_DOC2(null); setPBCC(null); setPCC(null); setPDOC_BCC(null); setPFROM(null); setPSUBJECT(null); setPCCArrotondaDecimalePerPrezziBassi(0.0D); setPCCArrotondaPrezzoAEuroSopra(0.0D); setPCCRicaricoMinimoOfferte(0.0D); setPGooglePrezzoPubblicoMinimoXExport(0.0D); setPGoogleQtaMinimaXExport(0L); setPStripePrivateKey(null); setPStripePublicKey(null); setPStripeReturnUrl(null); } public String getGoogleFtpUser() { return (this.googleFtpUser == null) ? "" : this.googleFtpUser; } public void setGoogleFtpUser(String googleFtpUser) { this.googleFtpUser = googleFtpUser; } public String getGoogleFtpPassword() { return (this.googleFtpPassword == null) ? "" : this.googleFtpPassword.trim(); } public void setGoogleFtpPassword(String googleFtpPassword) { this.googleFtpPassword = googleFtpPassword; } public String getGoogleNomiFileFeed() { return (this.googleNomiFileFeed == null) ? "" : this.googleNomiFileFeed; } public Vectumerator findGoogleNomiFileFeed() { Vectumerator res = new Vectumerator(); StringTokenizer st = new StringTokenizer(getGoogleNomiFileFeed(), ","); while (st.hasMoreTokens()) { StringAdapter row = new StringAdapter(); row.setDescrizione(st.nextToken()); res.add(row); } return res; } public void setGoogleNomiFileFeed(String googleNomiFileFeed) { this.googleNomiFileFeed = googleNomiFileFeed; } public long getFlgGoogleMerchant() { return this.flgGoogleMerchant; } public void setFlgGoogleMerchant(long flgGoogleMerchant) { this.flgGoogleMerchant = flgGoogleMerchant; } protected void prepareSave(PreparedStatement ps) throws SQLException { super.prepareSave(ps); } public boolean isEbay() { if (getFlgEbay() <= 0L) return false; return true; } public boolean isPaypalRateDettaglio() { if (getFlgPaypalRate() == 0L || getPaypalRateScriptHead().isEmpty() || getPaypalRateScriptBodyDett().isEmpty()) return false; return true; } public boolean isPaypalRatePagine() { if (getFlgPaypalRate() == 0L || getPaypalRateScriptHead().isEmpty() || getPaypalRateScriptBodyCat().isEmpty()) return false; return true; } public boolean isPaypalRate() { if (getFlgPaypalRate() == 0L || (getPaypalRateScriptHead().isEmpty() && getPaypalRateScriptBodyCat().isEmpty())) return false; return true; } public String getDirittoDiRecesso(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("dirittoDiRecesso", l_lang); } public boolean isSpedizioneGratis() { return (getDeliveryFreeAbove() == 0.0D); } public boolean isSpedizioneGratisOltre() { return (getDeliveryFreeAbove() > 0.0D); } protected String getNotificheMailMessage(String lang) { if (lang != null && lang.isEmpty()) lang = "it"; String temp = getDocBase() + getDocBase(); if (lang != null && !lang.isEmpty()) { int dot = temp.lastIndexOf("."); if (dot > 0) temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); } return temp; } public ResParm crontabJob(ApplParmFull ap) { ResParm rp = new ResParm(true); StringBuffer msg = new StringBuffer("\n################# Inizio crontab NOTIFICHE WISHLIST (" + DBAdapter.getNow().toString() + ")\n#################"); long t0 = System.currentTimeMillis(); Attivita attivita = getDefaultInstance(ap); rp = attivita.startThreadNotifiche(); msg.append(rp.getMsg()); msg.append("\n################# Fine crontab NOTIFICHE WISHLIST (" + DBAdapter.getNow().toString() + ")\n#################"); long tn = System.currentTimeMillis(); long duration = (tn - t0) / 60000L; msg.append("Durata: " + duration + " minuti.\n"); rp.setMsg(msg.toString()); return rp; } public long getFlgTopChatWhatsapp() { return this.flgTopChatWhatsapp; } public void setFlgTopChatWhatsapp(long flgTopChatWhatsapp) { this.flgTopChatWhatsapp = flgTopChatWhatsapp; } public long getFlgTopChatTelegram() { return this.flgTopChatTelegram; } public void setFlgTopChatTelegram(long flgTopChatTelegram) { this.flgTopChatTelegram = flgTopChatTelegram; } public long getFlgFooterChatWhatsapp() { return this.flgFooterChatWhatsapp; } public void setFlgFooterChatWhatsapp(long flgFooterChatWhatsapp) { this.flgFooterChatWhatsapp = flgFooterChatWhatsapp; } public long getFlgFooterChatTelegram() { return this.flgFooterChatTelegram; } public void setFlgFooterChatTelegram(long flgFooterChatTelegram) { this.flgFooterChatTelegram = flgFooterChatTelegram; } public long getFlgSubito() { return this.flgSubito; } public void setFlgSubito(long flgSubito) { this.flgSubito = flgSubito; } public String getCellulareAttivita() { return (this.cellulareAttivita == null) ? "" : this.cellulareAttivita.trim(); } public void setCellulareAttivita(String cellulareAttivita) { this.cellulareAttivita = cellulareAttivita; } public String getChatTelegramUsername() { return (this.chatTelegramUsername == null) ? "" : this.chatTelegramUsername.trim(); } public void setChatTelegramUsername(String chatTelegramUsername) { this.chatTelegramUsername = chatTelegramUsername; } public final ResParm startThreadNotifiche() { if (!isThreadAttivo()) { new ThreadNotificheWL(); return new ResParm(true, "Thread Invio Notifiche Wishlist avviato"); } return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); } public static boolean isThreadAttivo() { return threadWL; } public long getMainUltimiNum() { return this.mainUltimiNum; } public long getMainUltimiFetch() { return getMainUltimiNum() * 4L; } public void setMainUltimiNum(long mainUltimiNum) { this.mainUltimiNum = mainUltimiNum; } public long getFlgMainUltimi() { return this.flgMainUltimi; } public void setFlgMainUltimi(long flgMainUltimi) { this.flgMainUltimi = flgMainUltimi; } public long getFlgMainUltimaNews() { return this.flgMainUltimaNews; } public void setFlgMainUltimaNews(long flgMainUltimaNews) { this.flgMainUltimaNews = flgMainUltimaNews; } public String getMainTestoCentrale(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mainTestoCentrale", l_lang); } public String getMainTestoTitle(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mainTestoTitle", l_lang); } public String getMainTagDesc(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mainTagDesc", l_lang); } public String getMainTagH1(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mainTagH1", l_lang); } public String getMainTagH2(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mainTagH2", l_lang); } public String getMainTagTitle(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mainTagTitle", l_lang); } public String getMainTagKeyword(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("mainTagKeyword", l_lang); } public double getDeliveryCost() { return this.deliveryCost; } public void setDeliveryCost(double deliveryCost) { this.deliveryCost = deliveryCost; } public String getRecaptchaV2Key() { return (this.recaptchaV2Key == null) ? "" : this.recaptchaV2Key.trim(); } public boolean isRecaptcha() { return !getRecaptchaV2Key().isEmpty(); } public void setRecaptchaV2Key(String recaptchaV2Key) { this.recaptchaV2Key = recaptchaV2Key; } public boolean isGoogleMerchant() { if (getFlgGoogleMerchant() <= 0L || getGoogleFtpPassword().isEmpty() || getGoogleFtpUser().isEmpty()) return false; return true; } public boolean isTrovaprezziOrdine() { if (getTrovaprezziTrustedProgramScript().isEmpty() || getFlgTrovaprezzi() != 1L) return false; return true; } public boolean isTrovaprezziAcquisto() { if (getTrovaprezziTrustedProgramScript().isEmpty() || getFlgTrovaprezzi() != 2L) return false; return true; } public boolean isGoogleMerchantRecensioni() { if (isGoogleMerchant() && getFlgGoogleMerchantRecensioni() == 1L && !getGoogleMerchantRecensioniScript().isEmpty()) return true; return false; } public boolean isGoogleMerchantRecensioniBadge() { if (isGoogleMerchant() && getFlgGoogleMerchantRecensioniBadge() == 1L && !getGoogleMerchantRecensioniScript().isEmpty()) return true; return false; } public boolean isSubito() { if (getFlgSubito() <= 0L) return false; return true; } public long getFlgEbay() { return this.flgEbay; } public void setFlgEbay(long flgEbay) { this.flgEbay = flgEbay; } public long getId_listinoEbay() { return this.id_listinoEbay; } public void setId_listinoEbay(long id_listinoEbay) { this.id_listinoEbay = id_listinoEbay; setListinoEbay(null); } public Listino getListinoEbay() { this.listinoEbay = (Listino)getSecondaryObject(this.listinoEbay, Listino.class, getId_listinoEbay()); return this.listinoEbay; } public void setListinoEbay(Listino listinoEbay) { this.listinoEbay = listinoEbay; } public String getPHEAD_DOC1() { return this.pHEAD_DOC1; } public void setPHEAD_DOC1(String pHEAD_DOC1) { this.pHEAD_DOC1 = pHEAD_DOC1; } public String getPHEAD_DOC2() { return this.pHEAD_DOC2; } public void setPHEAD_DOC2(String pHEAD_DOC2) { this.pHEAD_DOC2 = pHEAD_DOC2; } protected void fillFields(ResultSet rst) { super.fillFields(rst); setPHEAD_DOC1(getParm("HEAD_DOC1").getTesto()); setPHEAD_DOC2(getParm("HEAD_DOC2").getTesto()); setPBCC(getParm("BCC").getTesto()); setPCC(getParm("CC").getTesto()); setPFROM(getParm("FROM").getTesto()); setPSUBJECT(getParm("SUBJECT").getTesto()); setPDOC_BCC(getParm("DOC_BCC").getTesto()); setPCCArrotondaPrezzoAEuroSopra(getParm("CC_ARROTONDA_PREZZO_A_EURO_SOPRA").getNumero()); setPCCArrotondaDecimalePerPrezziBassi(getParm("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI").getNumero()); setFlgIvaEsteroAziendeEsente(getParm("IVA_ESTERO_AZIENDA_ESENTE").getNumeroLong()); setFlgIvaOneStopShop(getParm("IVA_CEE_ONE_STOP_SHOP").getNumeroLong()); setPCCRicaricoMinimoOfferte(getParm("CC_RICARICO_MINIMO_OFFERTE").getNumero()); setPGoogleSigninClientId(getParm("GOOGLE_SIGNIN_CLIENT_ID").getTesto()); setFlgGoogleSignin(getParm("GOOGLE_SIGNIN_ENABLE").getNumeroLong()); setPFacebookSigninClientId(getParm("FACEBOOK_SIGNIN_CLIENT_ID").getTesto()); setPFacebookSigninSecretKey(getParm("FACEBOOK_SIGNIN_SECRET_KEY").getTesto()); setFlgFacebookSignin(getParm("FACEBOOK_SIGNIN_ENABLE").getNumeroLong()); setPGooglePrezzoPubblicoMinimoXExport(getParm("GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT").getNumeroDouble()); setPGoogleQtaMinimaXExport(getParm("GOOGLE_QTA_MINIMA_X_EXPORT").getNumeroLong()); setPStripePrivateKey(getParm("STRIPE_PRIVATE_KEY").getTesto()); setPStripePublicKey(getParm("STRIPE_PUBLIC_KEY").getTesto()); setPStripeReturnUrl(getParm("STRIPE_RETURN_URL").getTesto()); } public String getCciaa() { return (this.cciaa == null) ? "" : this.cciaa.trim(); } public void setCciaa(String cciaa) { this.cciaa = cciaa; } public String getFaxAttivita() { return (this.faxAttivita == null) ? "" : this.faxAttivita.trim(); } public void setFaxAttivita(String faxAttivita) { this.faxAttivita = faxAttivita; } public String getPFROM() { return this.pFROM; } public void setPFROM(String pFROM) { this.pFROM = pFROM; } public String getPBCC() { return this.pBCC; } public void setPBCC(String pBCC) { this.pBCC = pBCC; } public String getPCC() { return this.pCC; } public void setPCC(String pCC) { this.pCC = pCC; } public String getPSUBJECT() { return this.pSUBJECT; } public void setPSUBJECT(String pSUBJECT) { this.pSUBJECT = pSUBJECT; } public String getPDOC_BCC() { return this.pDOC_BCC; } public void setPDOC_BCC(String pDOC_BCC) { this.pDOC_BCC = pDOC_BCC; } public String getEbayFulfillmentPolicyId() { return (this.ebayFulfillmentPolicyId == null) ? "" : this.ebayFulfillmentPolicyId.trim(); } public void setEbayFulfillmentPolicyId(String ebayFulfillmentPolicyId) { this.ebayFulfillmentPolicyId = ebayFulfillmentPolicyId; } public String getEbayPaymentPolicyId() { return (this.ebayPaymentPolicyId == null) ? "" : this.ebayPaymentPolicyId.trim(); } public void setEbayPaymentPolicyId(String ebayPaymentPolicyId) { this.ebayPaymentPolicyId = ebayPaymentPolicyId; } public String getEbayReturnPolicyId() { return (this.ebayReturnPolicyId == null) ? "" : this.ebayReturnPolicyId.trim(); } public void setEbayReturnPolicyId(String ebayReturnPolicyId) { this.ebayReturnPolicyId = ebayReturnPolicyId; } public String getEbayMerchantLocationKey() { return (this.ebayMerchantLocationKey == null) ? "" : this.ebayMerchantLocationKey.trim(); } public void setEbayMerchantLocationKey(String ebayMerchantLocationKey) { this.ebayMerchantLocationKey = ebayMerchantLocationKey; } public ResParm ebayCaricaProfilesId() { ResParm rp = new ResParm(); return rp; } public boolean isEbayPubblicabile() { if (getEbayFulfillmentPolicyId().isEmpty() || getEbayPaymentPolicyId().isEmpty() || getEbayReturnPolicyId().isEmpty()) return false; return isEbay(); } public String getEbayOAuthRefreshToken() { return (this.ebayOAuthRefreshToken == null) ? "" : this.ebayOAuthRefreshToken.trim(); } public void setEbayOAuthRefreshToken(String ebayOAuthAuthCode) { this.ebayOAuthRefreshToken = ebayOAuthAuthCode; } public Timestamp getEbayOAuthRefreshTokenExpire() { return this.ebayOAuthRefreshTokenExpire; } public void setEbayOAuthRefreshTokenExpire(Timestamp ebayOAuthAuthCodeExpire) { this.ebayOAuthRefreshTokenExpire = ebayOAuthAuthCodeExpire; } public String getEbayOAuthUserToken() { return (this.ebayOAuthUserToken == null) ? "" : this.ebayOAuthUserToken.trim(); } public void setEbayOAuthUserToken(String ebayOAuthUserCode) { this.ebayOAuthUserToken = ebayOAuthUserCode; } public Timestamp getEbayOAuthUserTokenExpire() { return this.ebayOAuthUserTokenExpire; } public void setEbayOAuthUserTokenExpire(Timestamp ebayOAuthUserCodeExpire) { this.ebayOAuthUserTokenExpire = ebayOAuthUserCodeExpire; } public boolean isEbayOAuthUserTokenExpired() { if (getEbayOAuthUserToken().isEmpty()) return true; int gap = 10000; if (Calendar.getInstance().getTimeInMillis() + (long)gap > getEbayOAuthUserTokenExpire().getTime()) return true; return false; } public boolean isEbayOAuthRefreshTokenExpired() { if (getEbayOAuthRefreshToken().isEmpty()) return true; int gap = 10000; if (Calendar.getInstance().getTimeInMillis() + (long)gap > getEbayOAuthRefreshTokenExpire().getTime()) return true; return false; } public ResParm superSave() { return super.save(); } public ResParm ebayUpdateFulfillmentPolicyId() { ResParm rp = new ResParm(true); if (getId_attivita() > 0L) { EbayAbliaApi bean = new EbayAbliaApi(getApFull()); EbayResult ebayRes = bean.ebayGetFulfillmentPolicy(); if (ebayRes.isOk()) { setEbayFulfillmentPolicyId((String)ebayRes.getResult()); rp = superSave(); if (rp.getStatus()) rp.setMsg(ebayRes.getMsg()); } else { rp.setStatus(false); rp.setMsg(ebayRes.getMsg()); } } return rp; } public ResParm ebayUpdatePaymentPolicyId() { ResParm rp = new ResParm(true); if (getId_attivita() > 0L) { EbayAbliaApi bean = new EbayAbliaApi(getApFull()); EbayResult ebayRes = bean.ebayGetPaymentPolicy(); if (ebayRes.isOk()) { setEbayPaymentPolicyId((String)ebayRes.getResult()); rp = superSave(); if (rp.getStatus()) rp.setMsg(ebayRes.getMsg()); } else { rp.setStatus(false); rp.setMsg(ebayRes.getMsg()); } } return rp; } public ResParm ebayCreaMerchantLocationKey() { ResParm rp = new ResParm(true); if (getId_attivita() > 0L) { EbayAbliaApi bean = new EbayAbliaApi(getApFull()); EbayResult ebayRes = bean.ebayCreateInventoryLocation(getEbayMerchantLocationKey()); if (ebayRes.isOk()) { rp.setMsg(ebayRes.getMsg()); } else { rp.setStatus(false); rp.setMsg(ebayRes.getMsg()); } } return rp; } public ResParm ebayUpdateReturnPolicyId() { ResParm rp = new ResParm(true); if (getId_attivita() > 0L) { EbayAbliaApi bean = new EbayAbliaApi(getApFull()); EbayResult ebayRes = bean.ebayGetReturnPolicy(); if (ebayRes.isOk()) { setEbayReturnPolicyId((String)ebayRes.getResult()); rp = superSave(); if (rp.getStatus()) rp.setMsg(ebayRes.getMsg()); } else { rp.setStatus(false); rp.setMsg(ebayRes.getMsg()); } } return rp; } public boolean isDetailXsText(String l_lang) { return !(getDetailXsText(l_lang).isEmpty() || getDetailXsTitle(l_lang).isEmpty()); } public String getDescSpeseSpedizioni(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("descSpeseSpedizioni", l_lang); } public long getFlgIcecat() { return this.flgIcecat; } public void setFlgIcecat(long flgIcecat) { this.flgIcecat = flgIcecat; } public String getIcecatUsername() { return (this.icecatUsername == null) ? "" : this.icecatUsername.trim(); } public void setIcecatUsername(String icecatUsername) { this.icecatUsername = icecatUsername; } public String getIcecatPassword() { return (this.icecatPassword == null) ? "" : this.icecatPassword; } public void setIcecatPassword(String icecatPassowrd) { this.icecatPassword = icecatPassowrd; } public boolean isIcecat() { return (getFlgIcecat() == 1L && !getIcecatUsername().isEmpty()); } public String getHomePage(String lang) { if (getTopLingueAttivita().indexOf(",") > 0) { if (lang.equals("it")) { if (getWwwAddress().endsWith("/")) return getWwwAddress().substring(0, getWwwAddress().length() - 1); return getWwwAddress(); } return getWwwAddress() + "index-" + getWwwAddress() + ".html"; } if (getWwwAddress().endsWith("/")) return getWwwAddress().substring(0, getWwwAddress().length() - 1); return getWwwAddress(); } public long getPercentileMaxPerPreventivo() { return this.percentileMaxPerPreventivo; } public void setPercentileMaxPerPreventivo(long flgPercSpedizioneSuperato) { this.percentileMaxPerPreventivo = flgPercSpedizioneSuperato; } public String getDescrizioneAttivita(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("descrizioneAttivita", l_lang); } public String getSloganTrasporto(String l_lang) { if (l_lang.isEmpty()) l_lang = "it"; return getDescTxtLang("sloganTrasporto", l_lang); } public double getPCCArrotondaPrezzoAEuroSopra() { return this.pCCArrotondaPrezzoAEuroSopra; } public void setPCCArrotondaPrezzoAEuroSopra(double prezzoConIvaMinimoConArrotondamento) { this.pCCArrotondaPrezzoAEuroSopra = prezzoConIvaMinimoConArrotondamento; } public double getPCCArrotondaDecimalePerPrezziBassi() { return this.pCCArrotondaDecimalePerPrezziBassi; } public void setPCCArrotondaDecimalePerPrezziBassi(double pCCArrotondaDecimalePerPrezziBassi) { this.pCCArrotondaDecimalePerPrezziBassi = pCCArrotondaDecimalePerPrezziBassi; } public double getDeliveryCostConIva() { long l_id_ivaV = getParm("CODICE_IVA_STD_VEND").getNumeroLong(); if (l_id_ivaV == 0L) return getDeliveryCost(); Iva iva = new Iva(getApFull()); iva.findByPrimaryKey(l_id_ivaV); return conIva(getDeliveryCost(), (double)iva.getAliquota()); } public long getFlgIvaOneStopShop() { return this.flgIvaOneStopShop; } public void setFlgIvaOneStopShop(long flgOneStopShop) { this.flgIvaOneStopShop = flgOneStopShop; } public long getFlgIvaEsteroAziendeEsente() { return this.flgIvaEsteroAziendeEsente; } public void setFlgIvaEsteroAziendeEsente(long flgIvaEsteroAziendeEsente) { this.flgIvaEsteroAziendeEsente = flgIvaEsteroAziendeEsente; } public String getGoogleMerchantRecensioniScript() { return (this.googleMerchantRecensioniScript == null) ? "" : this.googleMerchantRecensioniScript.trim(); } public String getGoogleMerchantRecensioniScript(Documento doc) { String temp = getGoogleMerchantRecensioniScript(); temp = temp.replace("ORDER_ID", String.valueOf(doc.getProgOrdineWww())); temp = temp.replace("CUSTOMER_EMAIL", doc.getClifor().getEMail()); temp = temp.replace("COUNTRY_CODE", doc.getClifor().getNazione().getCodice()); temp = temp.replace("YYYY-MM-DD", String.valueOf(doc.getDataDocumento())); StringBuilder sb = new StringBuilder("\"products\":["); Vectumerator vec = doc.findRigheDocumento(0, 0, 0); boolean firstRow = true; while (vec.hasMoreElements()) { RigaDocumento row = (RigaDocumento)vec.nextElement(); if (!firstRow && !row.getArticolo().getCodiceEan().isEmpty()) sb.append(","); if (!row.getArticolo().getCodiceEan().isEmpty()) { sb.append("{\"gtin\":\""); sb.append(row.getArticolo().getCodiceEan()); sb.append("\"}"); firstRow = false; } } sb.append("]"); if (!firstRow) { temp = temp.replace("PRODUCTS", sb.toString()); } else { temp = temp.replace("PRODUCTS", ""); } return temp; } public void setGoogleMerchantRecensioniScript(String googleMerchantRecensioniScript) { this.googleMerchantRecensioniScript = googleMerchantRecensioniScript; } public String getGoogleMerchantRecensioniScriptBadge() { return (this.googleMerchantRecensioniScriptBadge == null) ? "" : this.googleMerchantRecensioniScriptBadge.trim(); } public void setGoogleMerchantRecensioniScriptBadge(String googleMerchantRecensioniScriptBadge) { this.googleMerchantRecensioniScriptBadge = googleMerchantRecensioniScriptBadge; } public long getFlgGoogleMerchantRecensioni() { return this.flgGoogleMerchantRecensioni; } public void setFlgGoogleMerchantRecensioni(long flgGoogleMerchatRecensioni) { this.flgGoogleMerchantRecensioni = flgGoogleMerchatRecensioni; } public long getFlgGoogleMerchantRecensioniBadge() { return this.flgGoogleMerchantRecensioniBadge; } public void setFlgGoogleMerchantRecensioniBadge(long flgGoogleMerchatRecensioniBadge) { this.flgGoogleMerchantRecensioniBadge = flgGoogleMerchatRecensioniBadge; } public GoogleReviews getReview(boolean userReview) { boolean debug = false; GoogleReviews res = new GoogleReviews(); if (getGoogleApiKey().isEmpty() || getGoogleSiteId().isEmpty()) { res.setStatus(false); res.setMsg("APikey o Site id non impostati"); } Date dataRating = getParm(GoogleReview.P_GOOGLE_REVIEW_DATE).getDataParm(); if (userReview || dataRating == null || getDateDiff(dataRating, getToday()) != 0L) { String HTTP_REVIEW = "https://maps.googleapis.com/maps/api/place/details/json?cid=CID&language=it&key=API_KEY"; String httpReviev = "https://maps.googleapis.com/maps/api/place/details/json?cid=CID&language=it&key=API_KEY".replace("CID", getGoogleSiteId()).replace("API_KEY", getGoogleApiKey()); try { if (debug) System.out.println("Google Review --> getReview: "); CloseableHttpClient client = HttpClients.createDefault(); HttpGet request = new HttpGet(httpReviev); request.setHeader("Accept", "application/json"); request.setHeader("Content-Type", "application/json"); request.setHeader("Content-Language", "it-IT"); CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); String content = EntityUtils.toString(closeableHttpResponse.getEntity()); int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); if (debug) System.out.println("Status Code: " + statusCode); JSONObject jo = new JSONObject(); if (statusCode >= 400) { jo = new JSONObject(content); System.out.println(jo.toString(4)); } else { jo = new JSONObject(content); if (jo.has("result")) { JSONObject jRes = jo.getJSONObject("result"); res.setRating(jRes.getDouble("rating")); res.setUserRatingsTotal(jRes.getLong("user_ratings_total")); JSONArray jRev = jRes.getJSONArray("reviews"); Vectumerator vecGr = res.getReviews(); for (int i = 0; i < jRev.length(); i++) { jRev.getJSONObject(i); GoogleReview gr = new GoogleReview(jRev.getJSONObject(i)); vecGr.add(gr); } } } Parm parm = getParm(GoogleReview.P_GOOGLE_REVIEW_DATE); parm.setDataParm(getToday()); parm.save(); parm = getParm(GoogleReview.P_GOOGLE_REVIEW_RATING); parm.setNumero(res.getRating()); parm.save(); parm = getParm(GoogleReview.P_GOOGLE_REVIEW_USER_RATING_TOTALS); parm.setNumero((double)res.getUserRatingsTotal()); parm.save(); getApFull().resetCurrentApParms(); return res; } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); res.setStatus(false); res.setMsg(e.getMessage()); return res; } } res.setRating(getParm(GoogleReview.P_GOOGLE_REVIEW_RATING).getNumeroDouble()); res.setUserRatingsTotal(getParm(GoogleReview.P_GOOGLE_REVIEW_USER_RATING_TOTALS).getNumeroLong()); return res; } public String getGoogleApiKey() { return (this.googleApiKey == null) ? "" : this.googleApiKey.trim(); } public void setGoogleApiKey(String googleApiKey) { this.googleApiKey = googleApiKey; } public String getGoogleSiteId() { return (this.googleSiteId == null) ? "" : this.googleSiteId.trim(); } public void setGoogleSiteId(String googleSiteId) { this.googleSiteId = googleSiteId; } public long getFlgAmz() { return this.flgAmz; } public void setFlgAmz(long flgAmz) { this.flgAmz = flgAmz; } public long getId_listinoAmz() { return this.id_listinoAmz; } public void setId_listinoAmz(long id_listinoAnz) { this.id_listinoAmz = id_listinoAnz; setListinoAmz(null); } public Listino getListinoAmz() { this.listinoAmz = (Listino)getSecondaryObject(this.listinoAmz, Listino.class, getId_listinoAmz()); return this.listinoAmz; } public void setListinoAmz(Listino listinoAmz) { this.listinoAmz = listinoAmz; } public long getFlgTrovaprezzi() { return this.flgTrovaprezzi; } public void setFlgTrovaprezzi(long flgTrovaprezzi) { this.flgTrovaprezzi = flgTrovaprezzi; } public boolean isTrovaprezzi() { if (getFlgTrovaprezzi() <= 0L) return false; return true; } public boolean isIdealo() { if (getFlgIdealo() <= 0L) return false; return true; } public String getTrovaprezziTrustedProgramScript() { return (this.trovaprezziTrustedProgramScript == null) ? "" : this.trovaprezziTrustedProgramScript.trim(); } public String getTrovaprezziTrustedProgramScript(Documento doc) { String temp = getTrovaprezziTrustedProgramScript(); temp = temp.replace("IDORDINE", String.valueOf(doc.getProgOrdineWww())); temp = temp.replace("EMAILCLIENTE", doc.getClifor().getEMail()); temp = temp.replace("TOTALECARRELLO", String.valueOf(doc.getTotaleDocumento())); StringBuilder items = new StringBuilder(); String item = getTrovaprezziTrustedProgramScriptItem(); Vectumerator vec = doc.findRigheDocumento(0, 0, 0); while (vec.hasMoreElements()) { RigaDocumento row = (RigaDocumento)vec.nextElement(); item = item.replace("SKU", row.getArticolo().getCodice()); item = item.replace("NOMEPRODOTTO", row.getArticolo().getNome()); items.append(" "); items.append(item); item = getTrovaprezziTrustedProgramScriptItem(); } temp = temp.replace("ITEMS", items.toString()); return temp; } public void setTrovaprezziTrustedProgramScript(String trovaprezziTrustedProgramScript) { this.trovaprezziTrustedProgramScript = trovaprezziTrustedProgramScript; } public String getTrovaprezziTrustedProgramScriptItem() { return (this.trovaprezziTrustedProgramScriptItem == null) ? "" : this.trovaprezziTrustedProgramScriptItem.trim(); } public void setTrovaprezziTrustedProgramScriptItem(String trovaprezziTrustedProgramScriptItem) { this.trovaprezziTrustedProgramScriptItem = trovaprezziTrustedProgramScriptItem; } public double getCheckCartPercScontoMax() { return this.checkCartPercScontoMax; } public void setCheckCartPercScontoMax(double checkCartPercScontoMax) { this.checkCartPercScontoMax = checkCartPercScontoMax; } public String getCookiePolicyTheme() { return (this.cookiePolicyTheme == null) ? "" : this.cookiePolicyTheme.trim(); } public void setCookiePolicyTheme(String cookiePolicyTheme) { this.cookiePolicyTheme = cookiePolicyTheme; } public long getFlgIdealo() { return this.flgIdealo; } public void setFlgIdealo(long flgIdealo) { this.flgIdealo = flgIdealo; } public String getIdealoTag() { return (this.idealoTag == null) ? "" : this.idealoTag.trim(); } public void setIdealoTag(String idealoTag) { this.idealoTag = idealoTag; } public double getPCCRicaricoMinimoOfferte() { return this.pCCRicaricoMinimoOfferte; } public void setPCCRicaricoMinimoOfferte(double pCCRicaricoMinimoOfferte) { this.pCCRicaricoMinimoOfferte = pCCRicaricoMinimoOfferte; } public String getPGoogleSigninClientId() { return (this.pGoogleSigninClientId == null) ? "" : this.pGoogleSigninClientId.trim(); } public void setPGoogleSigninClientId(String pGoogleSigninClientId) { this.pGoogleSigninClientId = pGoogleSigninClientId; } public long getFlgGoogleSignin() { return this.flgGoogleSignin; } public void setFlgGoogleSignin(long flgGoogleSignin) { this.flgGoogleSignin = flgGoogleSignin; } public boolean isGoogleSignIn() { if (getFlgGoogleSignin() <= 0L || getPGoogleSigninClientId().isEmpty()) return false; return true; } public boolean isSocialSignIn() { return (isGoogleSignIn() || isFacebookSignIn()); } public boolean isFacebookSignIn() { if (getFlgFacebookSignin() <= 0L || getPFacebookSigninClientId().isEmpty() || getPFacebookSigninSecretKey().isEmpty()) return false; return true; } public String getPFacebookSigninClientId() { return this.pFacebookSigninClientId; } public void setPFacebookSigninClientId(String pFacebookSigninClientId) { this.pFacebookSigninClientId = pFacebookSigninClientId; } public long getFlgFacebookSignin() { return this.flgFacebookSignin; } public void setFlgFacebookSignin(long flgFacebookSignin) { this.flgFacebookSignin = flgFacebookSignin; } public String getMainPageOrganizationStructData() { String ORG_STRUCT_DATA_TEMPLATE = ""; String result = "".replace("#URL", getWwwAddress()); result = result.replace("#LOGO", getWwwAddress() + getWwwAddress()); result = result.replace("#TEL", getTelefonoAttivita()); return result; } public String getNomeAttivitaSeo() { return (this.nomeAttivitaSeo == null) ? "" : this.nomeAttivitaSeo.trim(); } public void setNomeAttivitaSeo(String nomeAttivitaSeo) { this.nomeAttivitaSeo = nomeAttivitaSeo; } public String getPaypalRateScriptHead() { return (this.paypalRateScriptHead == null) ? "" : this.paypalRateScriptHead.trim(); } public void setPaypalRateScriptHead(String paypalRateScriptHead) { this.paypalRateScriptHead = paypalRateScriptHead; } public String getPaypalRateScriptBodyDett() { return (this.paypalRateScriptBodyDett == null) ? "" : this.paypalRateScriptBodyDett.trim(); } public String getPaypalRateScriptBodyDett(double importo) { return getPaypalRateScriptBodyDett().replace("#", String.valueOf(importo)); } public void setPaypalRateScriptBodyDett(String paypalRateScriptBody) { this.paypalRateScriptBodyDett = paypalRateScriptBody; } public String getPaypalRateScriptBodyCat() { return (this.paypalRateScriptBodyCat == null) ? "" : this.paypalRateScriptBodyCat.trim(); } public void setPaypalRateScriptBodyCat(String paypalRateScriptBodyCat) { this.paypalRateScriptBodyCat = paypalRateScriptBodyCat; } public double getPGooglePrezzoPubblicoMinimoXExport() { return this.pGooglePrezzoPubblicoMinimoXExport; } public void setPGooglePrezzoPubblicoMinimoXExport(double pGooglePrezzoPubblicoMinimoXExport) { this.pGooglePrezzoPubblicoMinimoXExport = pGooglePrezzoPubblicoMinimoXExport; } public long getPGoogleQtaMinimaXExport() { return this.pGoogleQtaMinimaXExport; } public void setPGoogleQtaMinimaXExport(long pGoogleQtaMinimaXExport) { this.pGoogleQtaMinimaXExport = pGoogleQtaMinimaXExport; } public boolean isLingueAttiveHref(String canonical, HttpServletRequest req) { boolean debug = false; if (isLingueAttive()) { String uriEnd; if (debug) { System.out.println("canonical:" + canonical); System.out.println("request uri: " + req.getRequestURI()); } if (req.getAttribute("javax.servlet.forward.request_uri") != null) { if (debug) System.out.println("forward uri:" + req.getAttribute("javax.servlet.forward.request_uri").toString()); uriEnd = req.getAttribute("javax.servlet.forward.request_uri").toString(); } else { uriEnd = req.getRequestURI(); } if (debug) System.out.println("uriend:" + uriEnd); if (canonical.endsWith(uriEnd)) return true; return false; } return false; } public String getIndexNowApiKey() { return (this.indexNowApiKey == null) ? "" : this.indexNowApiKey.trim(); } public String getIndexNowKeyLocation() { if (getIndexNowApiKey().isEmpty()) return ""; return getWwwAddress() + getWwwAddress() + ".txt"; } public void setIndexNowApiKey(String indexNowApiKey) { this.indexNowApiKey = indexNowApiKey; } public long getIndexNowUrlQuota() { return (this.indexNowUrlQuota == 0L) ? 100L : this.indexNowUrlQuota; } public void setIndexNowUrlQuota(long indexNowUrlQuota) { this.indexNowUrlQuota = indexNowUrlQuota; } public Date getIndexNowDay() { return this.indexNowDay; } public void setIndexNowDay(Date indexNowDay) { this.indexNowDay = indexNowDay; } public long getIndexNowDayCount() { return this.indexNowDayCount; } public void setIndexNowDayCount(long indexNowDayCount) { this.indexNowDayCount = indexNowDayCount; } public long getSitemapHashcode() { return (long)getWwwAddress().hashCode(); } public String getNoCacheTs() { Calendar cal = Calendar.getInstance(); StringBuilder temp = new StringBuilder(String.valueOf(cal.getTimeInMillis()).substring(4)); return temp.toString().trim(); } public String getPStripePublicKey() { return (this.pStripePublicKey == null) ? "" : this.pStripePublicKey.trim(); } public void setPStripePublicKey(String pStripePublicKey) { this.pStripePublicKey = pStripePublicKey; } public String getPStripePrivateKey() { return (this.pStripePrivateKey == null) ? "" : this.pStripePrivateKey.trim(); } public void setPStripePrivateKey(String pStripePrivateKey) { this.pStripePrivateKey = pStripePrivateKey; } public String getPStripeReturnUrl() { return (this.pStripeReturnUrl == null) ? "" : this.pStripeReturnUrl.trim(); } public void setPStripeReturnUrl(String pStripeReturnUrl) { this.pStripeReturnUrl = pStripeReturnUrl; } public long getFlgPaypalRate() { return this.flgPaypalRate; } public void setFlgPaypalRate(long flgPaypalRate) { this.flgPaypalRate = flgPaypalRate; } public boolean isAmz() { if (getFlgAmz() <= 0L) return false; return true; } public String getPFacebookSigninSecretKey() { return this.pFacebookSigninSecretKey; } public void setPFacebookSigninSecretKey(String pFacebookSigninSecretKey) { this.pFacebookSigninSecretKey = pFacebookSigninSecretKey; } public String getAmzLwaClientId() { return (this.amzLwaClientId == null) ? "" : this.amzLwaClientId.trim(); } public void setAmzLwaClientId(String amzLwaClientId) { this.amzLwaClientId = amzLwaClientId; } public String getAmzLwaClientSecret() { return (this.amzLwaClientSecret == null) ? "" : this.amzLwaClientSecret.trim(); } public void setAmzLwaClientSecret(String amzLwaClientSecret) { this.amzLwaClientSecret = amzLwaClientSecret; } public String getAmzLwaAuthToken() { return (this.amzLwaAuthToken == null) ? "" : this.amzLwaAuthToken.trim(); } public void setAmzLwaAuthToken(String amzLwaAuthToken) { this.amzLwaAuthToken = amzLwaAuthToken; } public String getAmzLwaAccessToken() { return (this.amzLwaAccessToken == null) ? "" : this.amzLwaAccessToken.trim(); } public void setAmzLwaAccessToken(String amzLwaAccessToken) { this.amzLwaAccessToken = amzLwaAccessToken; } public String getAmzLwaRefreshToken() { return (this.amzLwaRefreshToken == null) ? "" : this.amzLwaRefreshToken.trim(); } public void setAmzLwaRefreshToken(String amzLwaRefreshToken) { this.amzLwaRefreshToken = amzLwaRefreshToken; } public Timestamp getAmzLwaAccessTokenExpireTS() { return this.amzLwaAccessTokenExpireTS; } public void setAmzLwaAccessTokenExpireTS(Timestamp amzLwaAccessTokenExpireTS) { this.amzLwaAccessTokenExpireTS = amzLwaAccessTokenExpireTS; } public String getAmzStsAccessKeyId() { return (this.amzStsAccessKeyId == null) ? "" : this.amzStsAccessKeyId.trim(); } public void setAmzStsAccessKeyId(String amzStsAccessKeyId) { this.amzStsAccessKeyId = amzStsAccessKeyId; } public String getAmzStsSecretAccessKey() { return (this.amzStsSecretAccessKey == null) ? "" : this.amzStsSecretAccessKey.trim(); } public void setAmzStsSecretAccessKey(String amzStsSecretAccessKey) { this.amzStsSecretAccessKey = amzStsSecretAccessKey; } public String getAmzStsSessionToken() { return (this.amzStsSessionToken == null) ? "" : this.amzStsSessionToken.trim(); } public void setAmzStsSessionToken(String amzStsSessionToken) { this.amzStsSessionToken = amzStsSessionToken; } public Timestamp getAmzStsSessionTokenTS() { return this.amzStsSessionTokenTS; } public void setAmzStsSessionTokenTS(Timestamp amzStsSessionTokenTS) { this.amzStsSessionTokenTS = amzStsSessionTokenTS; } public String getAmzIamRoleARN() { return (this.amzIamRoleARN == null) ? "" : this.amzIamRoleARN.trim(); } public void setAmzIamRoleARN(String amzIamRoleARN) { this.amzIamRoleARN = amzIamRoleARN; } public String getAmzIamAccessKey() { return (this.amzIamAccessKey == null) ? "" : this.amzIamAccessKey.trim(); } public void setAmzIamAccessKey(String amzIamAccessKey) { this.amzIamAccessKey = amzIamAccessKey; } public String getAmzIamSecretKey() { return (this.amzIamSecretKey == null) ? "" : this.amzIamSecretKey.trim(); } public void setAmzIamSecretKey(String amzIamSecretKey) { this.amzIamSecretKey = amzIamSecretKey; } public String getAmzMarketplaces() { return (this.amzMarketplaces == null) ? "" : this.amzMarketplaces.trim(); } public void setAmzMarketplaces(String amzMarketplaces) { this.amzMarketplaces = amzMarketplaces; } public String getAmzSellerid() { return (this.amzSellerid == null) ? "" : this.amzSellerid.trim(); } public void setAmzSellerid(String amzSellerid) { this.amzSellerid = amzSellerid; } public ResParm amzUpdateTokens(boolean force) { ResParm rp = new ResParm(); AmzSellerApi asa = new AmzSellerApi(this); if (force) { asa.setLwaAccessTokenExpireTS(null); asa.setStsSessionTokenTS(null); } AmzResult res = asa.amzGetMarketplaces(); rp.setMsg(res.getMsg()); rp.setStatus(res.isOk()); return rp; } public String getAmzMerchantShippingGroupFree() { return (this.amzMerchantShippingGroupFree == null) ? "" : this.amzMerchantShippingGroupFree.trim(); } public void setAmzMerchantShippingGroupFree(String amzMerchantShippingGroupFree) { this.amzMerchantShippingGroupFree = amzMerchantShippingGroupFree; } public String getPathImg() { return "_img/_imgAttivita/"; } public double getDeliveryCostPudo() { return this.deliveryCostPudo; } public void setDeliveryCostPudo(double deliveryCostPudo) { this.deliveryCostPudo = deliveryCostPudo; } public double getDeliveryCostPudoConIva() { long l_id_ivaV = getParm("CODICE_IVA_STD_VEND").getNumeroLong(); if (l_id_ivaV == 0L) return getDeliveryCostPudo(); Iva iva = new Iva(getApFull()); iva.findByPrimaryKey(l_id_ivaV); return conIva(getDeliveryCostPudo(), (double)iva.getAliquota()); } public String getImgFaviconAdmin() { String faviconDir = getDocBase() + getDocBase(); DBAdapter.checkAndMakeDir(faviconDir); String nomeFileIcoFull = faviconDir + faviconDir; if (!new File(nomeFileIcoFull).exists()) try { ResParm rp = new ResParm(true); String fileOrig = getDocBase() + getDocBase() + getPathImg(); ScaleImage si = new ScaleImage(fileOrig, "32/", 0L, 32, 0, true, false); rp = si.scaleIt(); fileOrig = si.getTheScaledImageName(); if (rp.getStatus()) { BufferedImage bi = ImageIO.read(new File(fileOrig)); DBAdapter.mkDirs(nomeFileIcoFull); ICOEncoder.write(bi, new File(nomeFileIcoFull)); } } catch (Exception e) { logDebug(true, e.getMessage()); } if (new File(nomeFileIcoFull).exists()) return getPathImg() + getPathImg(); return "admin/_V4/_logo/favicon.ico"; } public Attivita() {} }