예제 #1
0
  public void sendShippingQuoteEmail(ServletContext servletContext) throws Exception {
    SiteDomain siteDomain = orderHeader.getSiteDomain();
    Long siteProfileClassId =
        orderHeader.getSiteProfile().getSiteProfileClass().getSiteProfileClassId();
    SiteDomainLanguage siteDomainLanguage = siteDomain.getSiteDomainLanguage();
    if (siteProfileClassId.equals(
        siteDomain.getSiteDomainLanguage().getSiteProfileClass().getSiteProfileClassId())) {
      for (SiteDomainLanguage language : siteDomain.getSiteDomainLanguages()) {
        if (language.getSiteProfileClass().getSiteProfileClassId().equals(siteProfileClassId)) {
          siteDomainLanguage = language;
          break;
        }
      }
    }
    SiteDomainParamBean siteDomainParamBean =
        SiteDomainDAO.getSiteDomainParamBean(
            siteDomain.getSiteDomainLanguage(), siteDomainLanguage);
    Site site = siteDomain.getSite();

    TemplateEngine engine = TemplateEngine.getInstance();
    engine.init(
        orderHeader.getSiteDomain(),
        orderHeader.getSiteProfile(),
        orderHeader.getSiteCurrency(),
        servletContext);
    engine.setParameter("orderHeaderId", orderHeader.getOrderHeaderId());
    String body = engine.mergeData("mail/shippingQuote.vm", "template", engine);
    Mailer mailer = new Mailer(site);

    String mailFrom = siteDomainParamBean.getMailFromShippingQuote();
    String subject = siteDomainParamBean.getSubjectShippingQuote();
    String mailTo = orderHeader.getCustEmail();
    if (mailFrom == null) {
      mailFrom = "";
    }
    if (subject == null) {
      subject = "";
    }
    if (Format.isNullOrEmpty(mailFrom) || Format.isNullOrEmpty(mailTo)) {
      logger.error("Unable to send customer sales email");
      logger.error("mailFrom = " + mailFrom);
      logger.error("mailTo = " + mailTo);
      logger.error("subject = " + subject);
    }
    mailer.sendMail(mailFrom, mailTo, subject, body, "text/html");
  }
예제 #2
0
  public OrderHeader clone(OrderHeader header) {
    OrderHeader orderHeader = new OrderHeader();
    orderHeader.setOrderHeaderId(header.getOrderHeaderId());
    orderHeader.setOrderNum(header.getOrderNum());
    orderHeader.setCustEmail(header.getCustEmail());
    orderHeader.setShippingTotal(header.getShippingTotal());
    orderHeader.setShippingDiscountTotal(header.getShippingDiscountTotal());
    orderHeader.setOrderTotal(header.getOrderTotal());
    orderHeader.setPaymentGatewayProvider(header.getPaymentGatewayProvider());
    orderHeader.setCreditCardDesc(header.getCreditCardDesc());
    orderHeader.setCustCreditCardNum(header.getCustCreditCardNum());
    orderHeader.setShippingMethodName(header.getShippingMethodName());
    orderHeader.setOrderStatus(header.getOrderStatus());
    orderHeader.setOrderDate(header.getOrderDate());
    orderHeader.setRecUpdateBy(header.getRecUpdateBy());
    orderHeader.setRecUpdateDatetime(header.getRecUpdateDatetime());
    orderHeader.setRecCreateBy(header.getRecCreateBy());
    orderHeader.setRecCreateDatetime(header.getRecCreateDatetime());
    orderHeader.setSiteDomain(header.getSiteDomain());
    orderHeader.setSiteProfile(header.getSiteProfile());
    orderHeader.setSiteCurrency(header.getSiteCurrency());

    return orderHeader;
  }