The UtilDateTime.addDaysToTimestamp() method should not be used. Use
> Author: hansbak
> Date: Fri Sep 9 10:09:36 2011
> New Revision: 1167071
>
> URL:
http://svn.apache.org/viewvc?rev=1167071&view=rev> Log:
> be able to put new rental item dirctly into shopping cart
>
> Modified:
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1167071&r1=1167070&r2=1167071&view=diff> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Fri Sep 9 10:09:36 2011
> @@ -148,6 +148,7 @@ public class ShoppingCartEvents {
> String shipAfterDateStr = null;
> Timestamp shipBeforeDate = null;
> Timestamp shipAfterDate = null;
> + String numberOfDay = null;
>
> // not used right now: Map attributes = null;
> String catalogId = CatalogWorker.getCurrentCatalogId(request);
> @@ -299,7 +300,15 @@ public class ShoppingCartEvents {
> if (priceStr == null) {
> priceStr = "0"; // default price is 0
> }
> -
> +
> + if ("ASSET_USAGE_OUT_IN".equals(ProductWorker.getProductTypeId(delegator, productId))) {
> + if (paramMap.containsKey("numberOfDay")) {
> + numberOfDay = (String) paramMap.remove("numberOfDay");
> + reservStart = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), 1);
> + reservEnd = UtilDateTime.addDaysToTimestamp(reservStart, Integer.valueOf(numberOfDay));
> + }
> + }
> +
> // get the renting data
> if ("ASSET_USAGE".equals(ProductWorker.getProductTypeId(delegator, productId)) || "ASSET_USAGE_OUT_IN".equals(ProductWorker.getProductTypeId(delegator, productId))) {
> if (paramMap.containsKey("reservStart")) {
>
>