Author: doogie
Date: Tue Apr 20 22:46:14 2010 New Revision: 936100 URL: http://svn.apache.org/viewvc?rev=936100&view=rev Log: Add a releaseDate to a product, mostly informational, intended to mean when the product was first assembled for purchase, or, for books, when it was published initially. Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml ofbiz/trunk/applications/product/servicedef/services_view.xml ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml ofbiz/trunk/framework/common/config/CommonUiLabels.xml Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=936100&r1=936099&r2=936100&view=diff ============================================================================== --- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Tue Apr 20 22:46:14 2010 @@ -2640,6 +2640,7 @@ under the License. <field name="manufacturerPartyId" type="id"></field> <field name="facilityId" type="id"></field> <field name="introductionDate" type="date-time"></field> + <field name="releaseDate" type="date-time"></field> <field name="supportDiscontinuationDate" type="date-time"></field> <field name="salesDiscontinuationDate" type="date-time"></field> <field name="salesDiscWhenNotAvail" type="indicator"></field> Modified: ofbiz/trunk/applications/product/servicedef/services_view.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=936100&r1=936099&r2=936100&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services_view.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services_view.xml Tue Apr 20 22:46:14 2010 @@ -123,6 +123,7 @@ under the License. <attribute name="productId" type="String" mode="IN"/> <attribute name="activeOnly" type="Boolean" mode="IN" optional="true"/> <attribute name="introductionDateLimit" type="java.sql.Timestamp" mode="IN" optional="true"/> + <attribute name="releaseDateLimit" type="java.sql.Timestamp" mode="IN" optional="true"/> <attribute name="orderByFields" type="List" mode="IN" optional="true"/> <attribute name="category" type="org.ofbiz.entity.GenericValue" mode="OUT" optional="true"/> <attribute name="previousProductId" type="String" mode="OUT" optional="true"/> @@ -141,6 +142,7 @@ under the License. <attribute name="useCacheForMembers" type="Boolean" mode="IN" optional="true"/> <attribute name="activeOnly" type="Boolean" mode="IN" optional="true"/> <attribute name="introductionDateLimit" type="java.sql.Timestamp" mode="IN" optional="true"/> + <attribute name="releaseDateLimit" type="java.sql.Timestamp" mode="IN" optional="true"/> <attribute name="orderByFields" type="List" mode="IN" optional="true"/> <attribute name="productCategory" type="org.ofbiz.entity.GenericValue" mode="OUT" optional="true"/> <attribute name="productCategoryMembers" type="java.util.Collection" mode="OUT" optional="true"/> <!-- this list will only contain the limited members if limitView=true --> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=936100&r1=936099&r2=936100&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java Tue Apr 20 22:46:14 2010 @@ -78,6 +78,7 @@ public class CategoryServices { boolean activeOnly = (context.get("activeOnly") != null ? ((Boolean) context.get("activeOnly")).booleanValue() : true); Integer index = (Integer) context.get("index"); Timestamp introductionDateLimit = (Timestamp) context.get("introductionDateLimit"); + Timestamp releaseDateLimit = (Timestamp) context.get("releaseDateLimit"); if (index == null && productId == null) { return ServiceUtil.returnError("Both Index and ProductID cannot be null."); @@ -85,7 +86,7 @@ public class CategoryServices { List<String> orderByFields = UtilGenerics.checkList(context.get("orderByFields")); if (orderByFields == null) orderByFields = FastList.newInstance(); - String entityName = getCategoryFindEntityName(delegator, orderByFields, introductionDateLimit); + String entityName = getCategoryFindEntityName(delegator, orderByFields, introductionDateLimit, releaseDateLimit); GenericValue productCategory; List<GenericValue> productCategoryMembers; @@ -100,9 +101,17 @@ public class CategoryServices { if (activeOnly) { productCategoryMembers = EntityUtil.filterByDate(productCategoryMembers, true); } + List<EntityCondition> filterConditions = FastList.newInstance(); if (introductionDateLimit != null) { EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("introductionDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("introductionDate", EntityOperator.LESS_THAN_EQUAL_TO, introductionDateLimit)); - productCategoryMembers = EntityUtil.filterByCondition(productCategoryMembers, condition); + filterConditions.add(condition); + } + if (releaseDateLimit != null) { + EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("releaseDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("releaseDate", EntityOperator.LESS_THAN_EQUAL_TO, releaseDateLimit)); + filterConditions.add(condition); + } + if (!filterConditions.isEmpty()) { + productCategoryMembers = EntityUtil.filterByCondition(productCategoryMembers, EntityCondition.makeCondition(filterConditions, EntityOperator.AND)); } if (productId != null && index == null) { @@ -142,9 +151,9 @@ public class CategoryServices { return result; } - private static String getCategoryFindEntityName(Delegator delegator, List<String> orderByFields, Timestamp introductionDateLimit) { + private static String getCategoryFindEntityName(Delegator delegator, List<String> orderByFields, Timestamp introductionDateLimit, Timestamp releaseDateLimit) { // allow orderByFields to contain fields from the Product entity, if there are such fields - String entityName = introductionDateLimit == null ? "ProductCategoryMember" : "ProductAndCategoryMember"; + String entityName = introductionDateLimit == null || releaseDateLimit != null ? "ProductCategoryMember" : "ProductAndCategoryMember"; if (orderByFields == null) { return entityName; } @@ -194,10 +203,11 @@ public class CategoryServices { boolean limitView = ((Boolean) context.get("limitView")).booleanValue(); int defaultViewSize = ((Integer) context.get("defaultViewSize")).intValue(); Timestamp introductionDateLimit = (Timestamp) context.get("introductionDateLimit"); + Timestamp releaseDateLimit = (Timestamp) context.get("releaseDateLimit"); List<String> orderByFields = UtilGenerics.checkList(context.get("orderByFields")); if (orderByFields == null) orderByFields = FastList.newInstance(); - String entityName = getCategoryFindEntityName(delegator, orderByFields, introductionDateLimit); + String entityName = getCategoryFindEntityName(delegator, orderByFields, introductionDateLimit, releaseDateLimit); String prodCatalogId = (String) context.get("prodCatalogId"); @@ -258,9 +268,17 @@ public class CategoryServices { if (activeOnly) { productCategoryMembers = EntityUtil.filterByDate(productCategoryMembers, true); } + List<EntityCondition> filterConditions = FastList.newInstance(); if (introductionDateLimit != null) { EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("introductionDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("introductionDate", EntityOperator.LESS_THAN_EQUAL_TO, introductionDateLimit)); - productCategoryMembers = EntityUtil.filterByCondition(productCategoryMembers, condition); + filterConditions.add(condition); + } + if (releaseDateLimit != null) { + EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("releaseDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("releaseDate", EntityOperator.LESS_THAN_EQUAL_TO, releaseDateLimit)); + filterConditions.add(condition); + } + if (!filterConditions.isEmpty()) { + productCategoryMembers = EntityUtil.filterByCondition(productCategoryMembers, EntityCondition.makeCondition(filterConditions, EntityOperator.AND)); } // filter out the view allow before getting the sublist @@ -294,6 +312,9 @@ public class CategoryServices { if (introductionDateLimit != null) { mainCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("introductionDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("introductionDate", EntityOperator.LESS_THAN_EQUAL_TO, introductionDateLimit))); } + if (releaseDateLimit != null) { + mainCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("releaseDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("releaseDate", EntityOperator.LESS_THAN_EQUAL_TO, releaseDateLimit))); + } EntityCondition mainCond = EntityCondition.makeCondition(mainCondList, EntityOperator.AND); // set distinct on Modified: ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml?rev=936100&r1=936099&r2=936100&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml Tue Apr 20 22:46:14 2010 @@ -73,8 +73,9 @@ under the License. <field name="comments" title="${uiLabelMap.CommonComments}"><text size="60" maxlength="250"/></field> <field position="1" name="introductionDate" title="${uiLabelMap.CommonIntroductionDate}" red-when="after-now"><date-time/></field> - <field position="2" name="salesDiscontinuationDate" title="${uiLabelMap.ProductSalesThruDate}" red-when="before-now"><date-time/></field> - <field position="3" name="supportDiscontinuationDate" title="${uiLabelMap.ProductSupportThruDate}" red-when="before-now"><date-time/></field> + <field position="2" name="releaseDate" title="${uiLabelMap.CommonReleaseDate}" red-when="after-now"><date-time/></field> + <field position="3" name="salesDiscontinuationDate" title="${uiLabelMap.ProductSalesThruDate}" red-when="before-now"><date-time/></field> + <field position="4" name="supportDiscontinuationDate" title="${uiLabelMap.ProductSupportThruDate}" red-when="before-now"><date-time/></field> <field name="salesDiscWhenNotAvail" title="${uiLabelMap.ProductSalesDiscontinuationNotAvailable}"> <drop-down allow-empty="true"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down> @@ -248,6 +249,7 @@ under the License. </field-group> <field-group title="${uiLabelMap.CommonDates}" collapsible="true" initially-collapsed="true"> <sort-field name="introductionDate"/> + <sort-field name="releaseDate"/> <sort-field name="salesDiscontinuationDate"/> <sort-field name="supportDiscontinuationDate"/> </field-group> Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=936100&r1=936099&r2=936100&view=diff ============================================================================== --- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original) +++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Tue Apr 20 22:46:14 2010 @@ -3420,6 +3420,9 @@ <value xml:lang="zh">æ¨ä»æ¥æ</value> <value xml:lang="zh_CN">å¼å ¥æ¥æ</value> </property> + <property key="CommonReleaseDate"> + <value xml:lang="en">Release Date</value> + </property> <property key="CommonInventory"> <value xml:lang="en">Inventory</value> <value xml:lang="fr">Stockage</value> |
Free forum by Nabble | Edit this page |