You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/06/15 18:18:43 UTC

svn commit: r1493387 - in /ofbiz/trunk/applications: order/servicedef/ order/src/org/ofbiz/order/order/ order/webapp/ordermgr/WEB-INF/actions/order/ order/webapp/ordermgr/order/ product/config/

Author: jleroux
Date: Sat Jun 15 16:18:42 2013
New Revision: 1493387

URL: http://svn.apache.org/r1493387
Log:
A slightly enhanced path from Sergei Biletnikov for "Search orders by good identification" https://issues.apache.org/jira/browse/OFBIZ-5031

I propose to extend the search mask for the search orders forms with the "Good identification" field.
A thing which can be improved is :
<option value="">Any good identification</option>   (in "applications/order/webapp/ordermgr/order/findOrders.ftl")
adding : "Any good identification" to the resource bundle.


Also, I found a bug which exists from 10.04 at least:
search orders by shipment method does not work properly, because:
{noformat}
applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy

 currentCarrierShipmentMethod = delegator.findByAnd("CarrierShipmentMethod", [partyId : carrierPartyId, shipmentMethodTypeId : shipmentMethodTypeId], null, false);

is not correct, the result is the list, so the remedy is simple:

 currentCarrierShipmentMethod = EntityUtil.getFirst(delegator.findByAnd("CarrierShipmentMethod", [partyId : carrierPartyId, shipmentMethodTypeId : shipmentMethodTypeId], null, false));

{noformat}
My patch has this fix, but it is necessary to make this fix for other OFBiz version.

jleroux: I simply added the ProductAnyGoodIdentification label, I will commit the groovy fix apart for easier backport

Modified:
    ofbiz/trunk/applications/order/servicedef/services.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy
    ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl
    ofbiz/trunk/applications/product/config/ProductUiLabels.xml

Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=1493387&r1=1493386&r2=1493387&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Sat Jun 15 16:18:42 2013
@@ -820,6 +820,10 @@ under the License.
         <attribute name="budgetId" type="String" mode="IN" optional="true"/>
         <attribute name="quoteId" type="String" mode="IN" optional="true"/>
 
+        <!-- Product identification -->
+        <attribute name="goodIdentificationTypeId" type="String" mode="IN" optional="true"/>
+        <attribute name="goodIdentificationIdValue" type="String" mode="IN" optional="true"/>
+
         <attribute name="billingAccountId" type="String" mode="IN" optional="true"/>
         <attribute name="finAccountId" type="String" mode="IN" optional="true"/>
         <attribute name="cardNumber" type="String" mode="IN" optional="true"/>

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java?rev=1493387&r1=1493386&r2=1493387&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java Sat Jun 15 16:18:42 2013
@@ -342,7 +342,11 @@ public class OrderLookupServices {
         String budgetId = (String) context.get("budgetId");
         String quoteId = (String) context.get("quoteId");
 
-        if (correspondingPoId != null || subscriptionId != null || productId != null || budgetId != null || quoteId != null) {
+        String goodIdentificationTypeId = (String) context.get("goodIdentificationTypeId");
+        String goodIdentificationIdValue = (String) context.get("goodIdentificationIdValue");
+        boolean hasGoodIdentification = UtilValidate.isNotEmpty(goodIdentificationTypeId) && UtilValidate.isNotEmpty(goodIdentificationIdValue);
+
+        if (correspondingPoId != null || subscriptionId != null || productId != null || budgetId != null || quoteId != null || hasGoodIdentification) {
             dve.addMemberEntity("OI", "OrderItem");
             dve.addAlias("OI", "correspondingPoId");
             dve.addAlias("OI", "subscriptionId");
@@ -350,6 +354,17 @@ public class OrderLookupServices {
             dve.addAlias("OI", "budgetId");
             dve.addAlias("OI", "quoteId");
             dve.addViewLink("OH", "OI", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderId", "orderId")));
+
+            if (hasGoodIdentification) {
+                dve.addMemberEntity("GOODID", "GoodIdentification");
+                dve.addAlias("GOODID", "goodIdentificationTypeId");
+                dve.addAlias("GOODID", "idValue");
+                dve.addViewLink("OI", "GOODID", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("productId", "productId")));
+                paramList.add("goodIdentificationTypeId=" + goodIdentificationTypeId);
+                conditions.add(makeExpr("goodIdentificationTypeId", goodIdentificationTypeId));
+                paramList.add("goodIdentificationIdValue=" + goodIdentificationIdValue);
+                conditions.add(makeExpr("idValue", goodIdentificationIdValue));
+            }
         }
 
         if (UtilValidate.isNotEmpty(correspondingPoId)) {

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy?rev=1493387&r1=1493386&r2=1493387&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy Sat Jun 15 16:18:42 2013
@@ -56,6 +56,10 @@ context.carrierShipmentMethods = carrier
 paymentStatusList = delegator.findByAnd("StatusItem", [statusTypeId : "PAYMENT_PREF_STATUS"], ["description"], false);
 context.paymentStatusList = paymentStatusList;
 
+// get the good identification types
+goodIdentificationTypes = delegator.findList("GoodIdentificationType", null, null, ["goodIdentificationTypeId", "description"], null, false);
+context.goodIdentificationTypes = goodIdentificationTypes;
+
 // current role type
 currentRoleTypeId = request.getParameter("roleTypeId");
 if (currentRoleTypeId) {
@@ -108,6 +112,13 @@ if (currentSalesChannelId) {
     context.currentSalesChannel = currentSalesChannel;
 }
 
+// current good identification type
+currentGoodIdentificationTypeId = request.getParameter("goodIdentificationTypeId");
+if (currentGoodIdentificationTypeId) {
+    currentGoodIdentificationType = delegator.findByPrimaryKey("GoodIdentificationType", ["goodIdentificationTypeId" : currentGoodIdentificationTypeId]);
+    context.currentGoodIdentificationType = currentGoodIdentificationType;
+}
+
 // create the fromDate for calendar
 fromCal = Calendar.getInstance();
 fromCal.setTime(new java.util.Date());

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl?rev=1493387&r1=1493386&r2=1493387&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl Sat Jun 15 16:18:42 2013
@@ -87,6 +87,8 @@ function toggleOrderIdList() {
   <input type='hidden' name='correspondingPoId' value='${requestParameters.correspondingPoId?if_exists}'/>
   <input type='hidden' name='internalCode' value='${requestParameters.internalCode?if_exists}'/>
   <input type='hidden' name='productId' value='${requestParameters.productId?if_exists}'/>
+  <input type='hidden' name='goodIdentificationTypeId' value='${requestParameters.goodIdentificationTypeId?if_exists}'/>
+  <input type='hidden' name='goodIdentificationIdValue' value='${requestParameters.goodIdentificationIdValue?if_exists}'/>
   <input type='hidden' name='inventoryItemId' value='${requestParameters.inventoryItemId?if_exists}'/>
   <input type='hidden' name='serialNumber' value='${requestParameters.serialNumber?if_exists}'/>
   <input type='hidden' name='softIdentifier' value='${requestParameters.softIdentifier?if_exists}'/>
@@ -166,6 +168,29 @@ function toggleOrderIdList() {
                 <td width='5%'>&nbsp;</td>
                 <td align='left'><input type='text' name='productId' value='${requestParameters.productId?if_exists}'/></td>
               </tr>
+              <#if goodIdentificationTypes?has_content>
+              <tr>
+                  <td width='25%' align='right' class='label'>${uiLabelMap.ProductGoodIdentificationType}</td>
+                  <td width='5%'>&nbsp;</td>
+                  <td align='left'>
+                      <select name='goodIdentificationTypeId'>
+                          <#if currentGoodIdentificationType?has_content>
+                              <option value="${currentGoodIdentificationType.goodIdentificationTypeId}">${currentGoodIdentificationType.get("description", locale)}</option>
+                              <option value="${currentGoodIdentificationType.goodIdentificationTypeId}">---</option>
+                          </#if>
+                          <option value="">${uiLabelMap.ProductAnyGoodIdentification}</option>
+                          <#list goodIdentificationTypes as goodIdentificationType>
+                              <option value="${goodIdentificationType.goodIdentificationTypeId}">${goodIdentificationType.get("description", locale)}</option>
+                          </#list>
+                      </select>
+                  </td>
+              </tr>
+              <tr>
+                  <td width='25%' align='right' class='label'>${uiLabelMap.ProductGoodIdentification}</td>
+                  <td width='5%'>&nbsp;</td>
+                  <td align='left'><input type='text' name='goodIdentificationIdValue' value='${requestParameters.goodIdentificationIdValue?if_exists}'/></td>
+              </tr>
+              </#if>
               <tr>
                 <td width='25%' align='right' class='label'>${uiLabelMap.ProductInventoryItemId}</td>
                 <td width='5%'>&nbsp;</td>
@@ -188,7 +213,6 @@ function toggleOrderIdList() {
                   <select name='roleTypeId' id='roleTypeId' multiple="multiple">
                     <#if currentRole?has_content>
                     <option value="${currentRole.roleTypeId}">${currentRole.get("description", locale)}</option>
-                    <option value="${currentRole.roleTypeId}">---</option>
                     </#if>
                     <option value="">${uiLabelMap.CommonAnyRoleType}</option>
                     <#list roleTypes as roleType>

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=1493387&r1=1493386&r2=1493387&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Sat Jun 15 16:18:42 2013
@@ -12204,6 +12204,10 @@
         <value xml:lang="zh">任一分类</value>
         <value xml:lang="zh_TW">任一分類</value>
     </property>
+    <property key="ProductAnyGoodIdentification">
+        <value xml:lang="en">Any good identification</value>
+        <value xml:lang="fr">Tous Identifiants</value>
+    </property>
     <property key="ProductAnyFacility">
         <value xml:lang="de">Beliebige Einrichtung</value>
         <value xml:lang="en">Any Facility</value>