You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2010/04/21 00:46:14 UTC

svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

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>



Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "Adam Heath" <do...@brainfood.com>
> Scott Gray wrote:
>> On 21/04/2010, at 10:46 AM, doogie@apache.org wrote:
>> 
>>> 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.
>> 
>> You could always consider adding this description to the field definition.
> 
> Excellent point, my fine sir.

And then it may be used by https://issues.apache.org/jira/browse/OFBIZ-3702 ...

Jacques


Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Adam Heath <do...@brainfood.com>.
Scott Gray wrote:
> On 21/04/2010, at 10:46 AM, doogie@apache.org wrote:
> 
>> 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.
> 
> You could always consider adding this description to the field definition.

Excellent point, my fine sir.

Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> Adrian Crum wrote:
>> Scott Gray wrote:
>>> On 21/04/2010, at 10:46 AM, doogie@apache.org wrote:
>>>
>>>> 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.
>>> You could always consider adding this description to the field
>>> definition.
>> Wouldn't that make more sense in an inventory item? Our houses have
>> release dates (when they are ready to ship) but they are inventory items
>> - not products.
> 
> There's no inventory available to be purchased yet, so no inventory
> record can possibily exist.  This is a completely different situation
> then an book being under current publication, but out of stock.
> 
> We use this field to filter products from display, within a window of
> 4 months into the future, and allow users to back-order the product
> before it has been published.

That makes sense.


Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Adam Heath <do...@brainfood.com>.
Bob Morley wrote:
> 
> Adam Heath-2 wrote:
>> introductionDate is when the store actually added the product to their
>> catalog, and started making it available, which may be completely
>> different then when it was first published.
>>
> 
> What struck me about this is that products in all sorts of enterprise
> verticals may have a whole host of "dates" and other product metadata that
> may be pertinent.  As a result, I would have thought use of ProductFeature
> or perhaps a ProductAttribute might be have been a better fit from a
> business pov (ignoring benefits with a strongly typed field).
> 
> When selling books, is it not possible that you have a "publish date" which
> may be different from a "pre-order" date (which appears to be your use case
> here)?  I would want to look at the model but I would have thought that
> there is some control of what products may be back-ordered (aka a pre-order)
> already in place ... perhaps the only support is a boolean flag at this time
> ... hmmm

Here's what we  have discovered for this particular client feature.

I think that introductionDate should be the time that the store first
added the product, and the store itself started selling it.  This
would be completely different than the date the product was first
produced, wheverever it is from.  releaseDate may be listed at years
and years in the past, but introductionDate is set in the future.

In all honesty, releaseDate is just meant to be purely informational.
 I would love to not have to put this on Product, if someone else had
a suggestion.  However, I don't want to loose the typed-ness of
it(which is what would happen if it were in ProductAttribute).

> Definitely willing to be completely wrong here; but those things struck me
> when I read this a few hours ago ...


Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Bob Morley <rm...@emforium.com>.

Adam Heath-2 wrote:
> 
> introductionDate is when the store actually added the product to their
> catalog, and started making it available, which may be completely
> different then when it was first published.
> 

What struck me about this is that products in all sorts of enterprise
verticals may have a whole host of "dates" and other product metadata that
may be pertinent.  As a result, I would have thought use of ProductFeature
or perhaps a ProductAttribute might be have been a better fit from a
business pov (ignoring benefits with a strongly typed field).

When selling books, is it not possible that you have a "publish date" which
may be different from a "pre-order" date (which appears to be your use case
here)?  I would want to look at the model but I would have thought that
there is some control of what products may be back-ordered (aka a pre-order)
already in place ... perhaps the only support is a boolean flag at this time
... hmmm

Definitely willing to be completely wrong here; but those things struck me
when I read this a few hours ago ...
-- 
View this message in context: http://n4.nabble.com/Re-svn-commit-r936100-in-ofbiz-trunk-applications-product-entitydef-applications-product-servicedef--tp2018179p2018370.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Adam Heath <do...@brainfood.com>.
Scott Gray wrote:
> On 21/04/2010, at 10:59 AM, Adam Heath wrote:
> 
>> Adrian Crum wrote:
>>> Scott Gray wrote:
>>>> On 21/04/2010, at 10:46 AM, doogie@apache.org wrote:
>>>>
>>>>> 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.
>>>> You could always consider adding this description to the field
>>>> definition.
>>> Wouldn't that make more sense in an inventory item? Our houses have
>>> release dates (when they are ready to ship) but they are inventory items
>>> - not products.
>> There's no inventory available to be purchased yet, so no inventory
>> record can possibily exist.  This is a completely different situation
>> then an book being under current publication, but out of stock.
>>
>> We use this field to filter products from display, within a window of
>> 4 months into the future, and allow users to back-order the product
>> before it has been published.
> 
> So would it be correct to say that in your situation:
> introductionDate + 4months = releaseDate?
> 
> So you can buy a product as soon as the introductionDate has passed but the user is informed that it won't be shipped until at least the releaseDate?

introductionDate is when the store actually added the product to their
catalog, and started making it available, which may be completely
different then when it was first published.


Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 21/04/2010, at 10:59 AM, Adam Heath wrote:

> Adrian Crum wrote:
>> Scott Gray wrote:
>>> On 21/04/2010, at 10:46 AM, doogie@apache.org wrote:
>>> 
>>>> 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.
>>> 
>>> You could always consider adding this description to the field
>>> definition.
>> 
>> Wouldn't that make more sense in an inventory item? Our houses have
>> release dates (when they are ready to ship) but they are inventory items
>> - not products.
> 
> There's no inventory available to be purchased yet, so no inventory
> record can possibily exist.  This is a completely different situation
> then an book being under current publication, but out of stock.
> 
> We use this field to filter products from display, within a window of
> 4 months into the future, and allow users to back-order the product
> before it has been published.

So would it be correct to say that in your situation:
introductionDate + 4months = releaseDate?

So you can buy a product as soon as the introductionDate has passed but the user is informed that it won't be shipped until at least the releaseDate?


Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> Scott Gray wrote:
>> On 21/04/2010, at 10:46 AM, doogie@apache.org wrote:
>>
>>> 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.
>>
>> You could always consider adding this description to the field
>> definition.
> 
> Wouldn't that make more sense in an inventory item? Our houses have
> release dates (when they are ready to ship) but they are inventory items
> - not products.

There's no inventory available to be purchased yet, so no inventory
record can possibily exist.  This is a completely different situation
then an book being under current publication, but out of stock.

We use this field to filter products from display, within a window of
4 months into the future, and allow users to back-order the product
before it has been published.


Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Adrian Crum <ad...@hlmksw.com>.
Scott Gray wrote:
> On 21/04/2010, at 10:46 AM, doogie@apache.org wrote:
> 
>> 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.
> 
> You could always consider adding this description to the field definition.

Wouldn't that make more sense in an inventory item? Our houses have 
release dates (when they are ready to ship) but they are inventory items 
- not products.

-Adrian


Re: svn commit: r936100 - in /ofbiz/trunk: applications/product/entitydef/ applications/product/servicedef/ applications/product/src/org/ofbiz/product/category/ applications/product/widget/catalog/ framework/common/config/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 21/04/2010, at 10:46 AM, doogie@apache.org wrote:

> 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.

You could always consider adding this description to the field definition.

> 
> 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>
> 
>