diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java b/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
index c57f7f4e70..88f2400d89 100644
--- a/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
+++ b/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
@@ -512,6 +512,17 @@ public class ProductPromoWorker {
if (productPromoCode == null) {
return "The promotion code [" + productPromoCodeId + "] is not valid.";
}
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
+ if (productPromoCode.getTimestamp("thruDate") != null) {
+ if (nowTimestamp.after(productPromoCode.getTimestamp("thruDate"))) {
+ return "The promotion code [" + productPromoCodeId + "] is expired in: " + productPromoCode.getTimestamp("thruDate");
+ }
+ }
+ if (productPromoCode.getTimestamp("fromDate") != null) {
+ if (nowTimestamp.before(productPromoCode.getTimestamp("fromDate"))) {
+ return "The promotion code [" + productPromoCodeId + "] will be activated in: " + productPromoCode.getTimestamp("fromDate");
+ }
+ }
if ("Y".equals(productPromoCode.getString("requireEmailOrParty"))) {
boolean hasEmailOrParty = false;
@@ -524,7 +535,6 @@ public class ProductPromoWorker {
}
// check email address in ProductPromoCodeEmail
- Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
List validEmailCondList = new ArrayList();
validEmailCondList.add(new EntityExpr("partyId", EntityOperator.EQUALS, partyId));
validEmailCondList.add(new EntityExpr("productPromoCodeId", EntityOperator.EQUALS, productPromoCodeId));
diff --git a/applications/product/entitydef/entitymodel.xml b/applications/product/entitydef/entitymodel.xml
index 390b0641cb..aad5eb157c 100644
--- a/applications/product/entitydef/entitymodel.xml
+++ b/applications/product/entitydef/entitymodel.xml
@@ -2794,6 +2794,8 @@ under the License.
+
+
diff --git a/applications/product/script/org/ofbiz/product/promo/PromoServices.xml b/applications/product/script/org/ofbiz/product/promo/PromoServices.xml
index 80b79e8ded..623a41d47f 100644
--- a/applications/product/script/org/ofbiz/product/promo/PromoServices.xml
+++ b/applications/product/script/org/ofbiz/product/promo/PromoServices.xml
@@ -160,6 +160,9 @@ under the License.
+
+
+