[pal-cvs 2886] [630] send order notification mail.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 10月 16日 (火) 16:54:33 JST


Revision: 630
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=630
Author:   shinsuke
Date:     2007-10-16 16:54:33 +0900 (Tue, 16 Oct 2007)

Log Message:
-----------
send order notification mail.

Modified Paths:
--------------
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/OrderServiceImpl.java
    pompei/portlets/pompei-core/trunk/src/main/resources/PCMessages.properties


-------------- next part --------------
Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/OrderServiceImpl.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/OrderServiceImpl.java	2007-10-14 13:13:00 UTC (rev 629)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/service/impl/OrderServiceImpl.java	2007-10-16 07:54:33 UTC (rev 630)
@@ -74,7 +74,6 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
 import org.seasar.framework.log.Logger;
 
 public class OrderServiceImpl implements OrderService {
@@ -147,7 +146,7 @@
                             .getAdministratorEmail(), orderNotification
                             .getTemplateName());
                 } catch (Exception e) {
-                    logger.log("EPA0004", new Object[] {}, e);
+                    logger.log("EPC0004", new Object[] {}, e);
                     errors.add(orderNotification.getTemplateName() + "(" + to
                             + ")");
                 }
@@ -615,7 +614,36 @@
             getCustomerBasketBhv().delete(customerBasket);
         }
 
-        // TODO send mail
+        // send mail
+        OrderStatus orderStatus = getOrderStatus(orderForm.getOrderStatusId());
+        if (orderStatus != null
+                && PompeiConstants.NEW_ORDER_STATUS_TYPE.equals(orderStatus
+                        .getType())) {
+            OrderNotificationCB cb = new OrderNotificationCB();
+            cb.setupSelect_OrderStatus();
+            cb.query().queryOrderStatus().setOrderStatusId_Equal(
+                    orderStatus.getOrderStatusId());
+            List<OrderNotification> orderNotificationList = getOrderNotificationBhv()
+                    .selectList(cb);
+            if (orderNotificationList != null
+                    && !orderNotificationList.isEmpty()) {
+                BigDecimal[] orderNotificationIds = new BigDecimal[orderNotificationList
+                        .size()];
+                int count = 0;
+                for (OrderNotification orderNotification : orderNotificationList) {
+                    orderNotificationIds[count] = orderNotification
+                            .getOrderNotificationId();
+                    count++;
+                }
+                try {
+                    sendOrderNotifications(orderForm.getOrderFormId(),
+                            orderNotificationIds);
+                } catch (Exception e) {
+                    // TODO should throw it to page?
+                    logger.log("EPC0005", new Object[] {}, e);
+                }
+            }
+        }
 
         return orderFormNumber;
     }

Modified: pompei/portlets/pompei-core/trunk/src/main/resources/PCMessages.properties
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/resources/PCMessages.properties	2007-10-14 13:13:00 UTC (rev 629)
+++ pompei/portlets/pompei-core/trunk/src/main/resources/PCMessages.properties	2007-10-16 07:54:33 UTC (rev 630)
@@ -1,4 +1,5 @@
-EPA0001=Could not read a term of service.
-EPA0002=Could not read a term of service.
-EPA0003=Could not read a term of service.
-EPA0004=Could not send order notification.
+EPC0001=Could not read a term of service.
+EPC0002=Could not read a term of service.
+EPC0003=Could not read a term of service.
+EPC0004=Could not send order notification.
+EPC0005=Could not send order notification when order occurs.
\ No newline at end of file


pal-cvs メーリングリストの案内
Back to archive index