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'

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@1167015 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2011-09-09 06:40:28 +00:00
parent ab76d93411
commit f1a6aa2ef8
6 changed files with 89 additions and 14 deletions
+12
View File
@@ -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>
@@ -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;
+38 -5
View File
@@ -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">&nbsp;</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>&nbsp;</td><td class="tabletext">${cartLine.getReservStart()?string("yyyy-mm-dd")}</td><td class="tabletext">${cartLine.getReservLength()?string.number}</td></tr><tr><td>&nbsp;</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>&nbsp;</td>
<td class="tabletext">${cartLine.getReservStart()?string("yyyy-mm-dd")}</td>
<td class="tabletext">${cartLine.getReservLength()?string.number}</td></tr>
<tr>
<td>&nbsp;</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}
@@ -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>&nbsp;
<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>
&nbsp;&nbsp;
<#assign nowDate = Static["org.ofbiz.base.util.UtilDateTime"].nowDateString("yyyy-MM-dd")>
<#if product.productTypeId?if_exists == "ASSET_USAGE">
&nbsp;${uiLabelMap.CommonStartDate} (yyyy-mm-dd)<input type="text" size="10" name="reservStartStr" />Number of&nbsp;days<input type="text" size="4" name="reservLength" />&nbsp;Number of&nbsp;persons<input type="text" size="4" name="reservPersons" value="1" />Qty&nbsp;<input type="text" size="5" name="quantity" value="1" />
&nbsp;${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=""/>&nbsp;Number of&nbsp;days&nbsp;&nbsp;<input type="text" size="4" name="reservLength" />&nbsp;<br/>Number of&nbsp;persons&nbsp;&nbsp;<input type="text" size="4" name="reservPersons" value="1" />&nbsp;&nbsp;Qty&nbsp;&nbsp;<input type="text" size="5" name="quantity" value="1" />
<#elseif product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN">
&nbsp;${uiLabelMap.CommonStartDate} (yyyy-mm-dd)&nbsp;&nbsp;&nbsp;<@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=""/>&nbsp;&nbsp;Number of&nbsp;days&nbsp;&nbsp;<input type="text" size="4" name="reservLength" /><input type="hidden" size="4" name="reservPersons" value="1" /><br/>
Qty&nbsp;<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= "" />
@@ -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%">&nbsp;</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>&nbsp;</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%">&nbsp;</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>&nbsp;</td>
<td><input type="text" class="inputBox" size="3" name="reservPersons" value="${shoppingListItem.reservPersons?if_exists}"/></td>
<#else>
<td>&nbsp;</td>
<td>&nbsp;</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>
+4 -1
View File
@@ -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"/>