|
Author: hansbak
Date: Fri Sep 9 06:40:28 2011 New Revision: 1167015 URL: http://svn.apache.org/viewvc?rev=1167015&view=rev Log: New product type: Fixed Asset Usage For Rental of an asset which is shipped from and returned to inventory. Including Junit test and demo data. More explanation will follow in a blog on the 'what is new page' Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml ofbiz/trunk/applications/order/config/OrderUiLabels.xml ofbiz/trunk/applications/order/data/OrderTypeData.xml ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingCartTests.xml ofbiz/trunk/applications/order/servicedef/secas.xml ofbiz/trunk/applications/order/servicedef/services.xml ofbiz/trunk/applications/order/servicedef/services_return.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/trunk/applications/order/testdef/ShoppingCartTests.xml ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItemInc.ftl ofbiz/trunk/applications/product/data/ProductTypeData.xml ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml ofbiz/trunk/framework/images/webapp/images/ecommain.css ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Fri Sep 9 06:40:28 2011 @@ -4069,4 +4069,12 @@ under the License. <key-map field-name="finAccountId"/> </view-link> </view-entity> + + <!-- Extend Entity Inventory Item for relation Fix Asset --> + <extend-entity entity-name="InventoryItem"> + <field name="fixedAssetId" type="id"></field> + <relation type="one" fk-name="FIXED_ASSET" title="FixedAsset" rel-entity-name="InventoryItem"> + <key-map field-name="fixedAssetId" rel-field-name="inventoryItemId"/> + </relation> + </extend-entity> </entitymodel> Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original) +++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Fri Sep 9 06:40:28 2011 @@ -12885,4 +12885,7 @@ <property key="QuoteEditNote"> <value xml:lang="en">Update Note</value> </property> + <property key="OrderRent"> + <value xml:lang="en">Rent</value> + </property> </resource> Modified: ofbiz/trunk/applications/order/data/OrderTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderTypeData.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/data/OrderTypeData.xml (original) +++ ofbiz/trunk/applications/order/data/OrderTypeData.xml Fri Sep 9 06:40:28 2011 @@ -322,6 +322,8 @@ under the License. <ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="SURCHARGE_ADJUSTMENT" returnItemTypeId="RET_SURCHARGE_ADJ"/> <ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="ADDITIONAL_FEATURE" returnItemTypeId="RET_ADD_FEATURE_ADJ"/> <ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="WARRANTY_ADJUSTMENT" returnItemTypeId="RET_WARRANTY_ADJ"/> + <ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="RENTAL_ORDER_ITEM" returnItemTypeId="RET_FPROD_ITEM" /> + <ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="ASSET_USAGE_OUT_IN" returnItemTypeId="RET_FPROD_ITEM" /> <ReturnItemTypeMap returnHeaderTypeId="CUSTOMER_RETURN" returnItemMapKey="SERVICE_PRODUCT" returnItemTypeId="RET_SPROD_ITEM"/> <ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="FINISHED_GOOD" returnItemTypeId="RET_FPROD_ITEM"/> <ReturnItemTypeMap returnHeaderTypeId="VENDOR_RETURN" returnItemMapKey="MARKETING_PKG_AUTO" returnItemTypeId="RET_FPROD_ITEM"/> @@ -349,6 +351,7 @@ under the License. <ReturnReason sequenceId="04" returnReasonId="RTN_DIG_FILL_FAIL" description="Digital Fulfillment Failed"/> <ReturnReason sequenceId="05" returnReasonId="RTN_COD_REJECT" description="COD Payment Rejected"/> <ReturnReason sequenceId="06" returnReasonId="RTN_SIZE_EXCHANGE" description="Size Exchange"/> + <ReturnReason sequenceId="07" returnReasonId="RTN_NORMAL_RETURN" description="Normal Return"/> <!-- Return Types --> <ReturnType sequenceId="01" returnTypeId="RTN_CREDIT" description="Store Credit"/> <ReturnType sequenceId="02" returnTypeId="RTN_REFUND" description="Refund"/> @@ -358,6 +361,7 @@ under the License. <ReturnType sequenceId="06" returnTypeId="RTN_WAIT_REPLACE_RES" description="Wait Replacement Reserved"/> <ReturnType sequenceId="07" returnTypeId="RTN_REPLACE_IMMEDIAT" description="Replace Immediately"/> <ReturnType sequenceId="08" returnTypeId="RTN_REFUND_IMMEDIATE" description="Refund immediately"/> + <ReturnType sequenceId="09" returnTypeId="RTN_RENTAL" description="Rental"/> <WorkReqFulfType description="Implements" workReqFulfTypeId="WRF_IMPLEMENTS"/> <WorkReqFulfType description="Fixes" workReqFulfTypeId="WRF_FIXES"/> Modified: ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml (original) +++ ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml Fri Sep 9 06:40:28 2011 @@ -1684,7 +1684,7 @@ under the License. <key-map field-name="orderId"/> </view-link> </view-entity> - + <view-entity entity-name="OrderItemBillingAndInvoiceAndItem" package-name="org.ofbiz.order.order" title="OrderItemBilling and Invoice and InvoiceItem View Entity"> @@ -1707,7 +1707,22 @@ under the License. <key-map field-name="invoiceId"/> <key-map field-name="invoiceItemSeqId"/> </relation> - </view-entity> - + + <view-entity entity-name="OrderItemAndProduct" + package-name="org.ofbiz.order.order" + never-cache="true" + title="OrderItem And Product View Entity"> + <member-entity entity-alias="OI" entity-name="OrderItem"/> + <member-entity entity-alias="PR" entity-name="Product"/> + <alias-all entity-alias="OI"/> + <alias-all entity-alias="PR"/> + <view-link entity-alias="OI" rel-entity-alias="PR"> + <key-map field-name="productId"/> + </view-link> + <relation type="one-nofk" rel-entity-name="Product"> + <key-map field-name="productId"/> + </relation> + </view-entity> + </entitymodel> Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml Fri Sep 9 06:40:28 2011 @@ -1143,4 +1143,64 @@ under the License. </if-empty> <store-value value-field="returnContactMechMap"/> </simple-method> + + <simple-method method-name="createReturnItemForRental" short-description="Create the return item for rental (which items has product type is ASSET_USAGE_OUT_IN)"> + <entity-one entity-name="OrderHeader" value-field="orderHeader"> + <field-map field-name="orderId" from-field="parameters.orderId"/> + </entity-one> + + <if-compare operator="equals" value="SALES_ORDER" field="orderHeader.orderTypeId"> + <entity-condition entity-name="OrderRole" list="orderRoles"> + <condition-list combine="and"> + <condition-expr field-name="orderId" operator="equals" from-field="orderHeader.orderId"/> + <condition-expr field-name="roleTypeId" operator="equals" value="BILL_TO_CUSTOMER"/> + </condition-list> + </entity-condition> + <first-from-list entry="orderRole" list="orderRoles"/> + + <get-related-one relation-name="ProductStore" value-field="orderHeader" to-value-field="productStore"/> + + <if-not-empty field="productStore.inventoryFacilityId"> + <set field="createReturnCtx.destinationFacilityId" from-field="productStore.inventoryFacilityId"/> + </if-not-empty> + + <if-not-empty field="productStore.reqReturnInventoryReceive"> + <set field="updateHeaderCtx.needsInventoryReceive" from-field="productStore.reqReturnInventoryReceive"/> + <else> + <set field="updateHeaderCtx.needsInventoryReceive" value="N"/> + </else> + </if-not-empty> + + <set field="createReturnCtx.orderId" from-field="orderHeader.orderId"/> + <set field="createReturnCtx.currencyUomId" from-field="orderHeader.currencyUom"/> + <set field="createReturnCtx.fromPartyId" from-field="orderRole.partyId"/> + <set field="createReturnCtx.toPartyId" from-field="productStore.payToPartyId"/> + <set field="createReturnCtx.returnHeaderTypeId" value="CUSTOMER_RETURN"/> + <set field="createReturnCtx.returnReasonId" value="RTN_NORMAL_RETURN"/> + <set field="createReturnCtx.returnTypeId" value="RTN_RENTAL"/> + <set field="createReturnCtx.returnItemTypeId" value="RET_FDPROD_ITEM"/> + <set field="createReturnCtx.expectedItemStatus" value="INV_RETURNED"/> + <set field="createReturnCtx.returnPrice" value="0.00" type="BigDecimal"/> + + <entity-condition entity-name="OrderItemAndProduct" list="orderItems"> + <condition-list combine="and"> + <condition-expr field-name="orderId" operator="equals" from-field="orderHeader.orderId"/> + <condition-expr field-name="statusId" operator="equals" value="ITEM_COMPLETED"/> + <condition-expr field-name="productTypeId" operator="equals" value="ASSET_USAGE_OUT_IN"/> + </condition-list> + </entity-condition> + <iterate entry="orderItem" list="orderItems"> + <set field="createReturnCtx.productId" from-field="orderItem.productId"/> + <set field="createReturnCtx.orderItemSeqId" from-field="orderItem.orderItemSeqId"/> + <set field="createReturnCtx.description" from-field="orderItem.itemDescription"/> + <set field="createReturnCtx.returnQuantity" from-field="orderItem.quantity"/> + <call-service service-name="createReturnAndItemOrAdjustment" in-map-name="createReturnCtx" include-user-login="true"> + <result-to-field result-name="returnId" field="returnId"/> + </call-service> + <if-not-empty field="returnId"> + <set field="createReturnCtx.returnId" from-field="returnId"/> + </if-not-empty> + </iterate> + </if-compare> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingCartTests.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingCartTests.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingCartTests.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingCartTests.xml Fri Sep 9 06:40:28 2011 @@ -261,6 +261,137 @@ under the License. <check-errors/> </simple-method> + <simple-method method-name="testCreateOrderRentalProduct" short-description="Test create order rental of product" login-required="false"> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="DemoCustomer"/> + </entity-one> + + <!-- Shopping Cart new Instance --> + <set field="delegator" from-field="parameters.delegator" type="Object"/> + <set field="dispatcher" from-field="parameters.dispatcher" type="Object"/> + <set field="locale" from-field="parameters.locale" type="Object" /> + <set field="productStoreId" value="9000" type="String"/> + <set field="currencyUom" value="USD" type="String"/> + <set field="salesChannel" value="WEB_SALES_CHANNEL" type="String"/> + + <set field="partyId" value="DemoCustomer" type="String"/> + + <create-object class-name="org.ofbiz.order.shoppingcart.ShoppingCart" field="shoppingCart"> + <field field="delegator" type="org.ofbiz.entity.Delegator"/> + <field field="productStoreId" type="String"/> + <field field="locale" type="java.util.Locale"/> + <field field="currencyUom" type="String"/> + </create-object> + + <set field="orderType" value="SALES_ORDER" type="String"/> + <call-object-method method-name="setOrderType" obj-field="shoppingCart"> + <field field="orderType" type="String"/> + </call-object-method> + + <call-object-method method-name="setChannelType" obj-field="shoppingCart"> + <field field="salesChannel" type="String"/> + </call-object-method> + + <call-object-method method-name="setProductStoreId" obj-field="shoppingCart"> + <field field="productStoreId" type="String"/> + </call-object-method> + + <!-- Shopping Cart Set Billing and Ship to customers --> + <call-object-method method-name="setBillToCustomerPartyId" obj-field="shoppingCart"> + <field field="partyId" type="String"/> + </call-object-method> + + <call-object-method method-name="setPlacingCustomerPartyId" obj-field="shoppingCart"> + <field field="partyId" type="String"/> + </call-object-method> + + <call-object-method method-name="setShipToCustomerPartyId" obj-field="shoppingCart"> + <field field="partyId" type="String"/> + </call-object-method> + + <call-object-method method-name="setEndUserCustomerPartyId" obj-field="shoppingCart"> + <field field="partyId" type="String"/> + </call-object-method> + + <call-object-method method-name="setUserLogin" obj-field="shoppingCart"> + <field field="userLogin" type="org.ofbiz.entity.GenericValue"/> + <field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/> + </call-object-method> + + <!-- Add Product Item to Shopping Cart --> + <set field="nextDate" value="${groovy:org.ofbiz.base.util.UtilDateTime.addDaysToTimestamp(org.ofbiz.base.util.UtilDateTime.nowTimestamp(), +1)}" type="Timestamp"/> + <set field="prodCatalogId" value="DemoCatalog" type="String"/> + <set field="productId" value="RentalShip" type="String"/> + <set field="reservStart" from-field="nextDate" type="Timestamp"/> + <set field="reservLength" value="3" type="BigDecimal"/> + <set field="reservPersons" value="1" type="BigDecimal"/> + <set field="quantity" value="1" type="BigDecimal"/> + <set field="unitPrice" value="15.99" type="BigDecimal"/> + <set field="itemType" value="RENTAL_ORDER_ITEM" type="String"/> + + <call-object-method method-name="addOrIncreaseItem" obj-field="shoppingCart"> + <field field="productId" type="String"/> + <field field="selectedAmount" type="BigDecimal"/> + <field field="quantity" type="BigDecimal"/> + <field field="reservStart" type="Timestamp"/> + <field field="reservLength" type="BigDecimal"/> + <field field="reservPersons" type="BigDecimal"/> + <field field="accommodationMapId" type="String"/> + <field field="accommodationSpotId" type="String"/> + <field field="shipBeforeDate" type="Timestamp"/> + <field field="shipAfterDate" type="Timestamp"/> + <field field="features" type="Map"/> + <field field="attributes" type="Map"/> + <field field="prodCatalogId" type="String"/> + <field field="configWrapper" type="org.ofbiz.product.config.ProductConfigWrapper"/> + <field field="itemType" type="String"/> + <field field="itemGroupNumber" type="String"/> + <field field="parentProductId" type="String"/> + <field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/> + </call-object-method> + + <call-object-method method-name="setDefaultCheckoutOptions" obj-field="shoppingCart"> + <field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/> + </call-object-method> + + <!-- Create order --> + <create-object class-name="org.ofbiz.order.shoppingcart.CheckOutHelper" field="checkOutHelper"> + <field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/> + <field field="delegator" type="org.ofbiz.entity.Delegator"/> + <field field="shoppingCart" type="org.ofbiz.order.shoppingcart.ShoppingCart"/> + </create-object> + + <call-object-method method-name="createOrder" obj-field="checkOutHelper" ret-field="orderCreateResult"> + <field field="userLogin" type="org.ofbiz.entity.GenericValue"/> + </call-object-method> + + <set field="orderId" from-field="orderCreateResult.orderId" type="String"/> + <if-not-empty field="orderId"> + <log level="info" message="------------ ORDERID : [${orderId}] ------------"/> + + <!-- Change order status to approved --> + <call-class-method method-name="approveOrder" class-name="org.ofbiz.order.order.OrderChangeHelper" ret-field="approved"> + <field field="dispatcher" type="org.ofbiz.service.LocalDispatcher"/> + <field field="userLogin" type="org.ofbiz.entity.GenericValue"/> + <field field="orderId" type="String"/> + </call-class-method> + <log level="info" message="----Test order with id: [${orderId}] has been approved: [${approved}]----"/> + + <entity-one entity-name="UserLogin" value-field="userLoginSystem"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + + <!-- Quick Ship Entire Order --> + <set field="quickShipEntireOrderMap.orderId" from-field="orderId"/> + <set field="quickShipEntireOrderMap.userLogin" from-field="userLoginSystem"/> + <call-service service-name="quickShipEntireOrder" in-map-name="quickShipEntireOrderMap"/> + <log level="info" message="----Test sales order with id: [${orderId}] has been shipped----"/> + </if-not-empty> + + <assert><not><if-empty field="orderId"/></not></assert> + <check-errors/> + </simple-method> + <simple-method method-name="testCreateOrderServiceProduct" short-description="Test create an order using a service product" login-required="false"> <entity-one entity-name="UserLogin" value-field="userLogin"> <field-map field-name="userLoginId" value="DemoCustomer"/> Modified: ofbiz/trunk/applications/order/servicedef/secas.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/secas.xml (original) +++ ofbiz/trunk/applications/order/servicedef/secas.xml Fri Sep 9 06:40:28 2011 @@ -93,6 +93,7 @@ under the License. <action service="createInvoiceFromOrder" mode="sync"/> <action service="resetGrandTotal" mode="sync"/> <action service="sendOrderCompleteNotification" mode="async" persist="true"/> + <action service="createReturnItemForRental" mode="sync"/> </eca> <eca service="changeOrderStatus" event="commit" run-on-error="false"> <condition field-name="orderTypeId" operator="equals" value="PURCHASE_ORDER"/> Modified: ofbiz/trunk/applications/order/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services.xml Fri Sep 9 06:40:28 2011 @@ -1122,4 +1122,9 @@ under the License. <description>Create Order Payment Application</description> <attribute name="paymentId" type="String" mode="IN" optional="false"/> </service> + + <service name="createTestOrderRentalProduct" engine="simple" auth="true" + location="component://order/script/org/ofbiz/order/test/ShoppingCartTests.xml" invoke="testCreateOrderRentalProduct"> + <description>Create Test Order Rental of an asset which is shipped from and returned to inventory</description> + </service> </services> Modified: ofbiz/trunk/applications/order/servicedef/services_return.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_return.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services_return.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services_return.xml Fri Sep 9 06:40:28 2011 @@ -369,4 +369,12 @@ under the License. <description>Delete a ReturnContactMech</description> <auto-attributes include="pk" mode="IN" optional="false"/> </service> + + <!-- Item Return Service --> + <service name="createReturnItemForRental" engine="simple" + location="component://order/script/org/ofbiz/order/order/OrderReturnServices.xml" invoke="createReturnItemForRental"> + <description>Create the return item for rental (which items has product type is ASSET_USAGE_OUT_IN)</description> + <attribute name="orderId" type="String" mode="IN" optional="false"/> + <attribute name="returnId" type="String" mode="OUT" optional="false"/> + </service> </services> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Fri Sep 9 06:40:28 2011 @@ -1346,6 +1346,105 @@ public class OrderServices { resErrorMessages.add(errMsg); } } + + // rent item + if (UtilValidate.isNotEmpty(orderItem.getString("productId")) && "RENTAL_ORDER_ITEM".equals(orderItem.getString("orderItemTypeId"))) { + try { + // get the product of the order item + GenericValue product = orderItem.getRelatedOne("Product"); + if (product == null) { + Debug.logError("Error when looking up product in reserveInventory service", module); + resErrorMessages.add("Error when looking up product in reserveInventory service"); + continue; + } + + // check product type for rent + String productType = (String) product.get("productTypeId"); + if ("ASSET_USAGE_OUT_IN".equals(productType)) { + if (reserveInventory) { + // for MARKETING_PKG_PICK reserve the components + if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_PICK")) { + Map<String, Object> componentsRes = dispatcher.runSync("getAssociatedProducts", UtilMisc.toMap("productId", orderItem.getString("productId"), "type", "PRODUCT_COMPONENT")); + if (ServiceUtil.isError(componentsRes)) { + resErrorMessages.add((String)componentsRes.get(ModelService.ERROR_MESSAGE)); + continue; + } else { + List<GenericValue> assocProducts = UtilGenerics.checkList(componentsRes.get("assocProducts")); + Iterator<GenericValue> assocProductsIter = assocProducts.iterator(); + while (assocProductsIter.hasNext()) { + GenericValue productAssoc = assocProductsIter.next(); + BigDecimal quantityOrd = productAssoc.getBigDecimal("quantity"); + BigDecimal quantityKit = orderItemShipGroupAssoc.getBigDecimal("quantity"); + BigDecimal quantity = quantityOrd.multiply(quantityKit); + Map<String, Object> reserveInput = new HashMap<String, Object>(); + reserveInput.put("productStoreId", productStoreId); + reserveInput.put("productId", productAssoc.getString("productIdTo")); + reserveInput.put("orderId", orderItem.getString("orderId")); + reserveInput.put("orderItemSeqId", orderItem.getString("orderItemSeqId")); + reserveInput.put("shipGroupSeqId", orderItemShipGroupAssoc.getString("shipGroupSeqId")); + reserveInput.put("quantity", quantity); + reserveInput.put("userLogin", userLogin); + reserveInput.put("facilityId", shipGroupFacilityId); + Map<String, Object> reserveResult = dispatcher.runSync("reserveStoreInventory", reserveInput); + + if (ServiceUtil.isError(reserveResult)) { + String invErrMsg = "The product "; + if (product != null) { + invErrMsg += getProductName(product, orderItem); + } + invErrMsg += " with ID " + orderItem.getString("productId") + " is no longer in stock. Please try reducing the quantity or removing the product from this order."; + resErrorMessages.add(invErrMsg); + } + } + } + } else { + // reserve the product + Map<String, Object> reserveInput = new HashMap<String, Object>(); + reserveInput.put("productStoreId", productStoreId); + reserveInput.put("productId", orderItem.getString("productId")); + reserveInput.put("orderId", orderItem.getString("orderId")); + reserveInput.put("orderItemSeqId", orderItem.getString("orderItemSeqId")); + reserveInput.put("shipGroupSeqId", orderItemShipGroupAssoc.getString("shipGroupSeqId")); + reserveInput.put("facilityId", shipGroupFacilityId); + // use the quantity from the orderItemShipGroupAssoc, NOT the orderItem, these are reserved by item-group assoc + reserveInput.put("quantity", orderItemShipGroupAssoc.getBigDecimal("quantity")); + reserveInput.put("userLogin", userLogin); + Map<String, Object> reserveResult = dispatcher.runSync("reserveStoreInventory", reserveInput); + + if (ServiceUtil.isError(reserveResult)) { + String invErrMsg = "The product "; + if (product != null) { + invErrMsg += getProductName(product, orderItem); + } + invErrMsg += " with ID " + orderItem.getString("productId") + " is no longer in stock. Please try reducing the quantity or removing the product from this order."; + resErrorMessages.add(invErrMsg); + } + } + } + + if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_AUTO")) { + GenericValue permUserLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); + Map<String, Object> inputMap = new HashMap<String, Object>(); + if (UtilValidate.isNotEmpty(shipGroupFacilityId)) { + inputMap.put("facilityId", shipGroupFacilityId); + } else { + inputMap.put("facilityId", productStore.getString("inventoryFacilityId")); + } + inputMap.put("orderId", orderItem.getString("orderId")); + inputMap.put("orderItemSeqId", orderItem.getString("orderItemSeqId")); + inputMap.put("userLogin", permUserLogin); + Map<String, Object> prunResult = dispatcher.runSync("createProductionRunForMktgPkg", inputMap); + if (ServiceUtil.isError(prunResult)) { + Debug.logError(ServiceUtil.getErrorMessage(prunResult) + " for input:" + inputMap, module); + } + } + } + } catch (GenericServiceException e) { + String errMsg = "Fatal error calling reserveStoreInventory service: " + e.toString(); + Debug.logError(e, errMsg, module); + resErrorMessages.add(errMsg); + } + } } } } 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=1167015&r1=1167014&r2=1167015&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 06:40:28 2011 @@ -301,7 +301,7 @@ public class ShoppingCartEvents { } // get the renting data - if ("ASSET_USAGE".equals(ProductWorker.getProductTypeId(delegator, productId))) { + if ("ASSET_USAGE".equals(ProductWorker.getProductTypeId(delegator, productId)) || "ASSET_USAGE_OUT_IN".equals(ProductWorker.getProductTypeId(delegator, productId))) { if (paramMap.containsKey("reservStart")) { reservStartStr = (String) paramMap.remove("reservStart"); if (reservStartStr.length() == 10) // only date provided, no time string? Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Fri Sep 9 06:40:28 2011 @@ -419,7 +419,7 @@ public class ShoppingCartItem implements ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, GenericValue parentProduct, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException { ShoppingCartItem newItem = new ShoppingCartItem(product, additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper, cart.getLocale(), itemType, itemGroup, parentProduct); - + selectedAmount = selectedAmount == null ? BigDecimal.ZERO : selectedAmount; unitPrice = unitPrice == null ? BigDecimal.ZERO : unitPrice; reservLength = reservLength == null ? BigDecimal.ZERO : reservLength; @@ -497,7 +497,7 @@ public class ShoppingCartItem implements } // check to see if the product is a rental item - if ("ASSET_USAGE".equals(product.getString("productTypeId"))) { + if ("ASSET_USAGE".equals(product.getString("productTypeId")) || "ASSET_USAGE_OUT_IN".equals(product.getString("productTypeId"))) { if (reservStart == null) { String excMsg = UtilProperties.getMessage(resource_error, "item.missing_reservation_starting_date", cart.getLocale()); @@ -750,6 +750,8 @@ public class ShoppingCartItem implements if (UtilValidate.isNotEmpty(_product.getString("productTypeId"))) { if ("ASSET_USAGE".equals(_product.getString("productTypeId"))) { this.itemType = "RENTAL_ORDER_ITEM"; // will create additional workeffort/asset usage records + } else if ("ASSET_USAGE_OUT_IN".equals(_product.getString("productTypeId"))) { + this.itemType = "RENTAL_ORDER_ITEM"; } else { this.itemType = "PRODUCT_ORDER_ITEM"; } Modified: ofbiz/trunk/applications/order/testdef/ShoppingCartTests.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/testdef/ShoppingCartTests.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/testdef/ShoppingCartTests.xml (original) +++ ofbiz/trunk/applications/order/testdef/ShoppingCartTests.xml Fri Sep 9 06:40:28 2011 @@ -25,6 +25,11 @@ under the License. <test-case case-name="shoppingCart-test"> <simple-method-test location="component://order/script/org/ofbiz/order/test/ShoppingCartTests.xml" name="testCreateShoppingCart"/> </test-case> + + <test-case case-name="productRentalOrder-test"> + <simple-method-test location="component://order/script/org/ofbiz/order/test/ShoppingCartTests.xml" name="testCreateOrderRentalProduct"/> + </test-case> + <test-case case-name="productServiceOrder-test"> <simple-method-test location="component://order/script/org/ofbiz/order/test/ShoppingCartTests.xml" name="testCreateOrderServiceProduct"/> </test-case> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl Fri Sep 9 06:40:28 2011 @@ -56,6 +56,8 @@ under the License. <#-- check to see if it is a rental item; will enter parameters on the detail screen--> <#elseif product.productTypeId?if_exists == "ASSET_USAGE"/> <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderMakeBooking}...</a> + <#elseif product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"/> + <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderRent}...</a> <#-- check to see if it is an aggregated or configurable product; will enter parameters on the detail screen--> <#elseif product.productTypeId?if_exists == "AGGREGATED"/> <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderConfigure}...</a> @@ -158,6 +160,8 @@ under the License. <#-- check to see if it is a rental item; will enter parameters on the detail screen--> <#elseif product.productTypeId?if_exists == "ASSET_USAGE"/> <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderMakeBooking}...</a> + <#elseif product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"/> + <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderRent}...</a> <#-- check to see if it is an aggregated or configurable product; will enter parameters on the detail screen--> <#elseif product.productTypeId?if_exists == "AGGREGATED"/> <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderConfigure}...</a> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl Fri Sep 9 06:40:28 2011 @@ -212,7 +212,7 @@ ${virtualJavaScript?if_exists} } function additemSubmit(){ - <#if product.productTypeId?if_exists == "ASSET_USAGE"> + <#if product.productTypeId?if_exists == "ASSET_USAGE" || product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> newdatevalue = validate(document.addform.reservStart.value); if (newdatevalue == false) { document.addform.reservStart.focus(); @@ -226,7 +226,7 @@ ${virtualJavaScript?if_exists} } function addShoplistSubmit(){ - <#if product.productTypeId?if_exists == "ASSET_USAGE"> + <#if product.productTypeId?if_exists == "ASSET_USAGE" || product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> if (document.addToShoppingList.reservStartStr.value == "") { document.addToShoppingList.submit(); } else { @@ -358,7 +358,7 @@ ${virtualJavaScript?if_exists} <#assign priceStyle = "regularPrice"> </#if> ${uiLabelMap.OrderYourPrice}: <#if "Y" = product.isVirtual?if_exists> ${uiLabelMap.CommonFrom} </#if><span class="${priceStyle}"><@ofbizCurrency amount=price.price isoCode=price.currencyUsed/></span> - <#if product.productTypeId?if_exists == "ASSET_USAGE"> + <#if product.productTypeId?if_exists == "ASSET_USAGE" || product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> <#if product.reserv2ndPPPerc?exists && product.reserv2ndPPPerc != 0><br /><span class="${priceStyle}">${uiLabelMap.ProductReserv2ndPPPerc}<#if !product.reservNthPPPerc?exists || product.reservNthPPPerc == 0>${uiLabelMap.CommonUntil} ${product.reservMaxPersons}</#if> <@ofbizCurrency amount=product.reserv2ndPPPerc*price.price/100 isoCode=price.currencyUsed/></span></#if> <#if product.reservNthPPPerc?exists &&product.reservNthPPPerc != 0><br /><span class="${priceStyle}">${uiLabelMap.ProductReservNthPPPerc} <#if !product.reserv2ndPPPerc?exists || product.reserv2ndPPPerc == 0>${uiLabelMap.ProductReservSecond} <#else> ${uiLabelMap.ProductReservThird} </#if> ${uiLabelMap.CommonUntil} ${product.reservMaxPersons}, ${uiLabelMap.ProductEach}: <@ofbizCurrency amount=product.reservNthPPPerc*price.price/100 isoCode=price.currencyUsed/></span></#if> <#if (!product.reserv2ndPPPerc?exists || product.reserv2ndPPPerc == 0) && (!product.reservNthPPPerc?exists || product.reservNthPPPerc == 0)><br />${uiLabelMap.ProductMaximum} ${product.reservMaxPersons} ${uiLabelMap.ProductPersons}.</#if> @@ -529,7 +529,7 @@ ${virtualJavaScript?if_exists} <span style="white-space: nowrap;"><b>${uiLabelMap.CommonAmount}:</b></span> <input type="text" size="5" name="add_amount" value=""/> </div> - <#if product.productTypeId?if_exists == "ASSET_USAGE"> + <#if product.productTypeId?if_exists == "ASSET_USAGE" || product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> <table width="100%"><tr> <@htmlTemplate.renderDateTimeField name="reservStart" event="" action="" value="" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" size="25" maxlength="30" id="startDate1" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/> <@htmlTemplate.renderDateTimeField name="reservEnd" event="" action="" value="" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" size="25" maxlength="30" id="endDate1" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/> @@ -566,7 +566,7 @@ ${virtualJavaScript?if_exists} <option value="">${uiLabelMap.OrderNewShoppingList}</option> </select> - <#if product.productTypeId?if_exists == "ASSET_USAGE"> + <#if product.productTypeId?if_exists == "ASSET_USAGE" || product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> <table><tr><td> </td><td align="right">${uiLabelMap.CommonStartDate} (yyyy-mm-dd)</td><td><input type="text" size="10" name="reservStartStr" /></td><td>Number of days</td><td><input type="text" size="4" name="reservLength" /></td><td> </td><td align="right">Number of persons</td><td><input type="text" size="4" name="reservPersons" value="1" /></td><td align="right">Qty </td><td><input type="text" size="5" name="quantity" value="1" /></td></tr></table> <#else> <input type="text" size="5" name="quantity" value="1"/> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl Fri Sep 9 06:40:28 2011 @@ -109,6 +109,8 @@ ${virtualJavaScript?if_exists} <#-- check to see if the product requires an amount --> <#elseif product.requireAmount?exists && product.requireAmount == "Y"> <a href="${productUrl}" class="buttontext">${uiLabelMap.OrderChooseAmount}...</a> + <#elseif product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> + <a href="${productUrl}" class="buttontext">${uiLabelMap.OrderRent}...</a> <#else> <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}form" style="margin: 0;"> <input type="hidden" name="add_product_id" value="${product.productId}"/> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItemInc.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItemInc.ftl?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItemInc.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/return/returnItemInc.ftl Fri Sep 9 06:40:28 2011 @@ -122,7 +122,14 @@ under the License. <div><@ofbizCurrency amount=orderItem.unitPrice isoCode=orderHeader.currencyUom/></div> </td> <td> - <input type="text" size="8" name="returnPrice_o_${rowCount}" value="${returnableItems.get(orderItem).get("returnablePrice")?string("##0.00")}"/> + <#if orderItem.productId?exists> + <#assign product = orderItem.getRelatedOne("Product")/> + <#if product.productTypeId == "ASSET_USAGE_OUT_IN"> + <input type="text" size="8" name="returnPrice_o_${rowCount}" value="0.00"/> + <#else> + <input type="text" size="8" name="returnPrice_o_${rowCount}" value="${returnableItems.get(orderItem).get("returnablePrice")?string("##0.00")}"/> + </#if> + </#if> </td> <td> <select name="returnReasonId_o_${rowCount}"> Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original) +++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Fri Sep 9 06:40:28 2011 @@ -498,8 +498,9 @@ under the License. <ProductType description="Marketing Package: Pick Assembly" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="MARKETING_PKG" productTypeId="MARKETING_PKG_PICK"/> <ProductType description="Work In Process" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="GOOD" productTypeId="WIP"/> <ProductType description="Configurable Good Configuration" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="AGGREGATED" productTypeId="AGGREGATED_CONF"/> + <ProductType description="Fixed Asset Usage For Rental of an asset which is shipped from and returned to inventory" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="" productTypeId="ASSET_USAGE_OUT_IN"/> <ProductType description="Service a product which is received to- and shipped from inventory" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="" productTypeId="SERVICE_PRODUCT"/> - + <EnumerationType description="Product Requirement Method" enumTypeId="PROD_REQ_METHOD" hasTable="N" parentTypeId=""/> <!-- NONE: no requirement is created (default) --> <Enumeration description="No Requirement Created" enumCode="NONE" enumId="PRODRQM_NONE" sequenceId="01" enumTypeId="PROD_REQ_METHOD"/> Modified: ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml Fri Sep 9 06:40:28 2011 @@ -471,7 +471,10 @@ under the License. </menu-item> <menu-item name="EditProductAssetUsage" title="${uiLabelMap.ProductAssetUsage}"> <condition> - <if-compare field="product.productTypeId" operator="equals" value="ASSET_USAGE"/> + <or> + <if-compare field="product.productTypeId" operator="equals" value="ASSET_USAGE"/> + <if-compare field="product.productTypeId" operator="equals" value="ASSET_USAGE_OUT_IN"/> + </or> </condition> <link target="EditProductAssetUsage"> <parameter param-name="productId"/> Modified: ofbiz/trunk/framework/images/webapp/images/ecommain.css URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/ecommain.css?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/ecommain.css (original) +++ ofbiz/trunk/framework/images/webapp/images/ecommain.css Fri Sep 9 06:40:28 2011 @@ -1815,3 +1815,14 @@ button.ui-button::-moz-focus-inner { bor */ .ui-progressbar { height:2em; text-align: left; } .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } + + +.view-calendar button { + background: url("/images/cal.gif") no-repeat scroll 0 0 transparent !important; + border: medium none !important; + display: inline-block; + height: 22px; + margin-top: 3px; + vertical-align: top; + width: 22px; +} Modified: ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml Fri Sep 9 06:40:28 2011 @@ -1562,4 +1562,16 @@ under the License. <ContentAssoc contentId="WG-1111-BX4-ALT" contentIdTo="CWG-1111-BX4-ALTEN" contentAssocTypeId="ALTERNATE_LOCALE" fromDate="2011-04-26 12:00:00.0"/> <ProductContent productId="WG-1111-BX2" contentId="WG-1111-BX2-ALT" productContentTypeId="ALTERNATIVE_URL" fromDate="2001-05-13 12:00:00.0"/> <ProductContent productId="WG-1111-BX4" contentId="WG-1111-BX4-ALT" productContentTypeId="ALTERNATIVE_URL" fromDate="2001-05-13 12:00:00.0"/> + + <!-- Demo product for rental shipping --> + <Product productId="RentalShip" productTypeId="ASSET_USAGE_OUT_IN" primaryProductCategoryId="201" productName="Rental Shipping" internalName="Rental Shipping" description="The Product For Test Rental of an asset which is shipped from and returned to inventory" reservMaxPersons="1" taxable="Y" chargeShipping="N" autoCreateKeywords="Y" isVirtual="N" isVariant="N" createdDate="2011-09-01 12:00:00.0" createdByUserLogin="admin"/> + <FixedAsset fixedAssetId="RentalShip" fixedAssetTypeId="PROPERTY" productionCapacity="10"/> + <FixedAssetProduct productId="RentalShip" fixedAssetId="RentalShip" fixedAssetProductTypeId="FAPT_USE" fromDate="2011-09-01 12:00:00.0"/> + <ProductPrice productId="RentalShip" productPricePurposeId="PURCHASE" productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD" productStoreGroupId="_NA_" fromDate="2011-09-01 12:00:00.0" price="15.99" createdDate="2011-09-01 12:00:00.0" createdByUserLogin="admin" lastModifiedByUserLogin="admin"/> + <ProductPrice productId="RentalShip" productPricePurposeId="PURCHASE" productPriceTypeId="LIST_PRICE" currencyUomId="USD" productStoreGroupId="_NA_" fromDate="2011-09-01 12:00:00.0" price="15.0" createdDate="2011-09-01 12:00:00.0" createdByUserLogin="admin" lastModifiedByUserLogin="admin"/> + <ProductCategoryMember productCategoryId="201" productId="RentalShip" fromDate="2011-09-01 12:00:00.0"/> + <ProductFacility productId="RentalShip" facilityId="WebStoreWarehouse" minimumStock="2" reorderQuantity="10" daysToShip="15"/> + <ProductFacilityLocation productId="RentalShip" facilityId="WebStoreWarehouse" locationSeqId="TLTLTLUL01" minimumStock="5" moveQuantity="20"/> + <InventoryItem facilityId="WebStoreWarehouse" inventoryItemId="InventoryRentalShip" inventoryItemTypeId="NON_SERIAL_INV_ITEM" datetimeReceived="2008-08-01 08:00:00.000" productId="RentalShip" ownerPartyId="Company" currencyUomId="USD" unitCost="2.4"/> + <InventoryItemDetail inventoryItemId="InventoryRentalShip" inventoryItemDetailSeqId="0001" effectiveDate="2011-09-01 12:00:00.0" availableToPromiseDiff="10" quantityOnHandDiff="10" accountingQuantityDiff="10"/> </entity-engine-xml> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy Fri Sep 9 06:40:28 2011 @@ -93,7 +93,7 @@ if (shoppingListId) { price = calcPriceOutMap.price; totalPrice = price * shoppingListItem.quantity; // similar code at ShoppingCartItem.java getRentalAdjustment - if ("ASSET_USAGE".equals(product.productTypeId)) { + if ("ASSET_USAGE".equals(product.productTypeId) || "ASSET_USAGE_OUT_IN".equals(product.productTypeId)) { persons = shoppingListItem.reservPersons ?: 0; reservNthPPPerc = product.reservNthPPPerc ?: 0; reserv2ndPPPerc = product.reserv2ndPPPerc ?: 0; Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/cart/showcart.ftl Fri Sep 9 06:40:28 2011 @@ -117,7 +117,7 @@ function setAlternateGwp(field) { <fieldset> ${uiLabelMap.EcommerceProductNumber}<input type="text" class="inputBox" name="add_product_id" value="${requestParameters.add_product_id?if_exists}" /> <#-- check if rental data present insert extra fields in Quick Add--> - <#if product?exists && product.getString("productTypeId") == "ASSET_USAGE"> + <#if (product?exists && product.getString("productTypeId") == "ASSET_USAGE") || (product?exists && product.getString("productTypeId") == "ASSET_USAGE_OUT_IN")> ${uiLabelMap.EcommerceStartDate}: <input type="text" class="inputBox" size="10" name="reservStart" value=${requestParameters.reservStart?default("")} /> ${uiLabelMap.EcommerceLength}: <input type="text" class="inputBox" size="2" name="reservLength" value=${requestParameters.reservLength?default("")} /> </div> @@ -182,8 +182,22 @@ function setAlternateGwp(field) { <#else> <th scope="row"> </th> </#if> - <#if fixedAssetExist == true><td><table><tr><td class="tabletext">- ${uiLabelMap.EcommerceStartDate} -</td><td class="tabletext">- ${uiLabelMap.EcommerceNbrOfDays} -</td></tr><tr><td class="tabletext" >- ${uiLabelMap.EcommerceNbrOfPersons} -</td><td class="tabletext" >- ${uiLabelMap.CommonQuantity} -</td></tr></table></td> - <#else><th scope="row">${uiLabelMap.CommonQuantity}</th></#if> + <#if fixedAssetExist == true> + <td> + <table> + <tr> + <td class="tabletext">- ${uiLabelMap.EcommerceStartDate} -</td> + <td class="tabletext">- ${uiLabelMap.EcommerceNbrOfDays} -</td> + </tr> + <tr> + <td class="tabletext" >- ${uiLabelMap.EcommerceNbrOfPersons} -</td> + <td class="tabletext" >- ${uiLabelMap.CommonQuantity} -</td> + </tr> + </table> + </td> + <#else> + <th scope="row">${uiLabelMap.CommonQuantity}</th> + </#if> <th scope="row">${uiLabelMap.EcommerceUnitPrice}</th> <th scope="row">${uiLabelMap.EcommerceAdjustments}</th> <th scope="row">${uiLabelMap.EcommerceItemTotal}</th> @@ -304,8 +318,27 @@ function setAlternateGwp(field) { <td> <#if cartLine.getIsPromo() || cartLine.getShoppingListId()?exists> - <#if fixedAssetExist == true><#if cartLine.getReservStart()?exists><table ><tr><td> </td><td class="tabletext">${cartLine.getReservStart()?string("yyyy-mm-dd")}</td><td class="tabletext">${cartLine.getReservLength()?string.number}</td></tr><tr><td> </td><td class="tabletext">${cartLine.getReservPersons()?string.number}</td><td class="tabletext"><#else> - <table ><tr><td >--</td><td>--</td></tr><tr><td>--</td><td class="tabletext"> </#if> + <#if fixedAssetExist == true> + <#if cartLine.getReservStart()?exists> + <table > + <tr> + <td> </td> + <td class="tabletext">${cartLine.getReservStart()?string("yyyy-mm-dd")}</td> + <td class="tabletext">${cartLine.getReservLength()?string.number}</td></tr> + <tr> + <td> </td> + <td class="tabletext">${cartLine.getReservPersons()?string.number}</td> + <td class="tabletext"> + <#else> + <table > + <tr> + <td >--</td> + <td>--</td> + </tr> + <tr> + <td>--</td> + <td class="tabletext"> + </#if> ${cartLine.getQuantity()?string.number}</td></tr></table> <#else><#-- fixedAssetExist --> ${cartLine.getQuantity()?string.number} Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl Fri Sep 9 06:40:28 2011 @@ -219,7 +219,7 @@ ${virtualVariantJavaScript?if_exists} } function additemSubmit(){ - <#if product.productTypeId?if_exists == "ASSET_USAGE"> + <#if product.productTypeId?if_exists == "ASSET_USAGE" || product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> newdatevalue = validate(document.addform.reservStart.value); if (newdatevalue == false) { document.addform.reservStart.focus(); @@ -233,7 +233,7 @@ ${virtualVariantJavaScript?if_exists} } function addShoplistSubmit(){ - <#if product.productTypeId?if_exists == "ASSET_USAGE"> + <#if product.productTypeId?if_exists == "ASSET_USAGE" || product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> if (document.addToShoppingList.reservStartStr.value == "") { document.addToShoppingList.submit(); } else { @@ -456,7 +456,7 @@ ${virtualVariantJavaScript?if_exists} <#assign priceStyle = "regularPrice" /> </#if> ${uiLabelMap.OrderYourPrice}: <#if "Y" = product.isVirtual?if_exists> ${uiLabelMap.CommonFrom} </#if><span class="${priceStyle}"><@ofbizCurrency amount=price.price isoCode=price.currencyUsed /></span> - <#if product.productTypeId?if_exists == "ASSET_USAGE"> + <#if product.productTypeId?if_exists == "ASSET_USAGE" || product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> <#if product.reserv2ndPPPerc?exists && product.reserv2ndPPPerc != 0><br /><span class="${priceStyle}">${uiLabelMap.ProductReserv2ndPPPerc}<#if !product.reservNthPPPerc?exists || product.reservNthPPPerc == 0>${uiLabelMap.CommonUntil} ${product.reservMaxPersons?if_exists}</#if> <@ofbizCurrency amount=product.reserv2ndPPPerc*price.price/100 isoCode=price.currencyUsed /></span></#if> <#if product.reservNthPPPerc?exists &&product.reservNthPPPerc != 0><br /><span class="${priceStyle}">${uiLabelMap.ProductReservNthPPPerc} <#if !product.reserv2ndPPPerc?exists || product.reserv2ndPPPerc == 0>${uiLabelMap.ProductReservSecond} <#else> ${uiLabelMap.ProductReservThird} </#if> ${uiLabelMap.CommonUntil} ${product.reservMaxPersons?if_exists}, ${uiLabelMap.ProductEach}: <@ofbizCurrency amount=product.reservNthPPPerc*price.price/100 isoCode=price.currencyUsed /></span></#if> <#if (!product.reserv2ndPPPerc?exists || product.reserv2ndPPPerc == 0) && (!product.reservNthPPPerc?exists || product.reservNthPPPerc == 0)><br />${uiLabelMap.ProductMaximum} ${product.reservMaxPersons?if_exists} ${uiLabelMap.ProductPersons}.</#if> @@ -629,7 +629,7 @@ ${virtualVariantJavaScript?if_exists} <span style="white-space: nowrap;"><strong>${uiLabelMap.CommonAmount}:</strong></span> <input type="text" size="5" name="add_amount" value=""/> </div> - <#if product.productTypeId?if_exists == "ASSET_USAGE"> + <#if product.productTypeId?if_exists == "ASSET_USAGE" || product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> <div class="inline"> <label>Start Date(yyyy-mm-dd)</label><@htmlTemplate.renderDateTimeField event="" action="" name="reservStart" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" value="" size="25" maxlength="30" id="reservStart1" dateType="date" shortDateInput=true timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/> <label>End Date(yyyy-mm-dd)</label><@htmlTemplate.renderDateTimeField event="" action="" name="reservEnd" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" value="" size="25" maxlength="30" id="reservEnd1" dateType="date" shortDateInput=true timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/> @@ -689,8 +689,12 @@ ${virtualVariantJavaScript?if_exists} <option value="">${uiLabelMap.OrderNewShoppingList}</option> </select> + <#assign nowDate = Static["org.ofbiz.base.util.UtilDateTime"].nowDateString("yyyy-MM-dd")> <#if product.productTypeId?if_exists == "ASSET_USAGE"> - ${uiLabelMap.CommonStartDate} (yyyy-mm-dd)<input type="text" size="10" name="reservStartStr" />Number of days<input type="text" size="4" name="reservLength" /> Number of persons<input type="text" size="4" name="reservPersons" value="1" />Qty <input type="text" size="5" name="quantity" value="1" /> + ${uiLabelMap.CommonStartDate} (yyyy-mm-dd)<@htmlTemplate.renderDateTimeField name="reservStartStr" event="" action="" value="${nowDate}" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" size="15" maxlength="30" id="reservStartStr" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/> Number of days <input type="text" size="4" name="reservLength" /> <br/>Number of persons <input type="text" size="4" name="reservPersons" value="1" /> Qty <input type="text" size="5" name="quantity" value="1" /> + <#elseif product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"> + ${uiLabelMap.CommonStartDate} (yyyy-mm-dd) <@htmlTemplate.renderDateTimeField name="reservStartStr" event="" action="" value="${nowDate}" className="" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" size="15" maxlength="30" id="reservStartStr" dateType="date" shortDateInput=false timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/> Number of days <input type="text" size="4" name="reservLength" /><input type="hidden" size="4" name="reservPersons" value="1" /><br/> + Qty <input type="text" size="5" name="quantity" value="1" /> <#else> <input type="text" size="5" name="quantity" value="1" /> <input type="hidden" name="reservStartStr" value= "" /> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/shoppinglist/editShoppingList.ftl Fri Sep 9 06:40:28 2011 @@ -406,8 +406,31 @@ under the License. <input type="hidden" name="shoppingListItemSeqId" value="${shoppingListItem.shoppingListItemSeqId}"/> <input type="hidden" name="reservStart"/> <div class="tabletext"> - <#if product.productTypeId == "ASSET_USAGE"><table border="0" width="100%"><tr><td width="1%"> </td><td><input type="text" class="inputBox" size="10" name="reservStartStr" value="${shoppingListItem.reservStart?if_exists}"/></td><td><input type="text" class="inputBox" size="2" name="reservLength" value="${shoppingListItem.reservLength?if_exists}"/></td></tr><tr><td> </td><td><input type="text" class="inputBox" size="3" name="reservPersons" value="${shoppingListItem.reservPersons?if_exists}"/></td><td class="tabletext"><#else> - <table width="100%"><tr><td width="62%" align="center">--</td><td align="center">--</td></tr><tr><td align="center">--</td><td class="tabletext"><input type="hidden" name="reservStartStr" value=""/> + <#if product.productTypeId == "ASSET_USAGE" || product.productTypeId == "ASSET_USAGE_OUT_IN"> + <table border="0" width="100%"> + <tr> + <td width="1%"> </td> + <td><@htmlTemplate.renderDateTimeField event="" action="" name="reservStartStr" className="inputBox" alert="" title="Format: yyyy-MM-dd HH:mm:ss.SSS" value="${shoppingListItem.reservStart?if_exists}" size="15" maxlength="30" id="reservStartStr_${shoppingListItem.shoppingListItemSeqId}" dateType="date" shortDateInput=true timeDropdownParamName="" defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName="" classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour="" ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/></td> + <td><input type="text" class="inputBox" size="2" name="reservLength" value="${shoppingListItem.reservLength?if_exists}"/></td> + </tr> + <tr> + <#if product.productTypeId == "ASSET_USAGE"> + <td> </td> + <td><input type="text" class="inputBox" size="3" name="reservPersons" value="${shoppingListItem.reservPersons?if_exists}"/></td> + <#else> + <td> </td> + <td> </td> + </#if> + <td class="tabletext"> + <#else> + <table width="100%"> + <tr> + <td width="62%" align="center">--</td> + <td align="center">--</td> + </tr> + <tr> + <td align="center">--</td> + <td class="tabletext"><input type="hidden" name="reservStartStr" value=""/> </#if> <input size="6" class="inputBox" type="text" name="quantity" value="${shoppingListItem.quantity?string.number}"/> </td></tr></table> Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml?rev=1167015&r1=1167014&r2=1167015&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CommonScreens.xml Fri Sep 9 06:40:28 2011 @@ -40,7 +40,10 @@ under the License. <!-- The default (main) java scripts --> <!-- NOTE: this should be included on each screen that uses it to avoid including it in all screens: --> <set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true"/> - + + <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-0.9.3.min.js" global="true"/> + <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/js/jquery-ui-1.8.13.custom.min.js" global="true"/> + <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/development-bundle/ui/jquery.ui.datepicker.js" global="true"/> <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/validate/jquery.validate.min.js" global="true"/> <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.6.2.min.js" global="true"/> |
| Free forum by Nabble | Edit this page |
