You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2007/07/20 09:17:11 UTC

svn commit: r557899 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java

Author: jonesde
Date: Fri Jul 20 00:17:10 2007
New Revision: 557899

URL: http://svn.apache.org/viewvc?view=rev&rev=557899
Log:
Fixed bug where if there was an existing subscription with a thruDate in the future it would set the fromDate of the new subscription to null

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java?view=diff&rev=557899&r1=557898&r2=557899
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java Fri Jul 20 00:17:10 2007
@@ -92,6 +92,8 @@
         newSubscription.set("inventoryItemId", inventoryItemId);
 
         Timestamp thruDate = lastSubscription != null ? (Timestamp) lastSubscription.get("thruDate") : null;
+        
+        // set the fromDate, one way or another
         if (thruDate == null) {
             // no thruDate? start with NOW
             thruDate = nowTimestamp;
@@ -102,10 +104,10 @@
             // month and buy another month, we want that second month to start now and not last year
             if (thruDate.before(nowTimestamp)) {
                 thruDate = nowTimestamp;
-            } else {
-                newSubscription.set("fromDate", thruDate);
             }
+            newSubscription.set("fromDate", thruDate);
         }
+        
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(thruDate);
         int[] times = UomWorker.uomTimeToCalTime(useTimeUomId);