We should discourage the use of requestParameters inside ftl files & use of
request.getParameter inside groovy files.
Instead of it we should use parameters.${fetching_value}.

There were some healthy discussion on this in past days and lot of code has
been migrated to use the parameters.${fetching_value} pattern.

Thanks !

--
Ashish

On Thu, May 21, 2009 at 5:24 PM, <[email protected]> wrote:

> Author: mor
> Date: Thu May 21 11:54:35 2009
> New Revision: 777084
>
> URL: http://svn.apache.org/viewvc?rev=777084&view=rev
> Log:
> Added few more search filters on find order page. They are shipping method,
> order viewed and PaymentGatewayResponse - gatewayAvsResult,
> gatewayScoreResult.
> Applied modified patch from Arpit Singh Pandya, part of OFBIZ-2496 (
> https://issues.apache.org/jira/browse/OFBIZ-2496)
>
> 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
>
> Modified: ofbiz/trunk/applications/order/servicedef/services.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=777084&r1=777083&r2=777084&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/applications/order/servicedef/services.xml (original)
> +++ ofbiz/trunk/applications/order/servicedef/services.xml Thu May 21
> 11:54:35 2009
> @@ -798,7 +798,12 @@
>         <attribute name="filterPOsWithRejectedItems" type="String"
> mode="IN" optional="true"/>
>         <attribute name="filterPOsOpenPastTheirETA" type="String" mode="IN"
> optional="true"/>
>         <attribute name="filterPartiallyReceivedPOs" type="String"
> mode="IN" optional="true"/>
> -
> +
> +        <attribute name="isViewed" type="String" mode="IN"
> optional="true"/> <!-- show orders with viewed Y/N -->
> +        <attribute name="shipmentMethod" type="String" mode="IN"
> optional="true"/>
> +        <attribute name="gatewayAvsResult" type="String" mode="IN"
> optional="true"/>
> +        <attribute name="gatewayScoreResult" type="String" mode="IN"
> optional="true"/>
> +
>         <!-- ship to country fields -->
>         <attribute name="countryGeoId" type="String" mode="IN"
> optional="true"/>
>         <attribute name="includeCountry" 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=777084&r1=777083&r2=777084&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
> Thu May 21 11:54:35 2009
> @@ -260,6 +260,55 @@
>             }
>         }
>
> +        String isViewed = (String) context.get("isViewed");
> +        if (UtilValidate.isNotEmpty(isViewed)) {
> +            paramList.add("isViewed=" + isViewed);
> +            conditions.add(makeExpr("isViewed", isViewed));
> +        }
> +
> +        // Shipment Method
> +        String shipmentMethod = (String) context.get("shipmentMethod");
> +        if (UtilValidate.isNotEmpty(shipmentMethod)) {
> +            String carrierPartyId = (String) shipmentMethod.substring(0,
> shipmentMethod.indexOf("@"));
> +            String ShippingMethodTypeId = (String)
> shipmentMethod.substring(shipmentMethod.indexOf("@")+1);
> +            dve.addMemberEntity("OISG", "OrderItemShipGroup");
> +            dve.addAlias("OISG", "shipmentMethodTypeId");
> +            dve.addAlias("OISG", "carrierPartyId");
> +            dve.addViewLink("OH", "OISG", Boolean.FALSE,
> UtilMisc.toList(new ModelKeyMap("orderId", "orderId")));
> +
> +            if (UtilValidate.isNotEmpty(carrierPartyId )) {
> +                paramList.add("carrierPartyId=" + carrierPartyId);
> +                conditions.add(makeExpr("carrierPartyId",
> carrierPartyId));
> +            }
> +
> +            if (UtilValidate.isNotEmpty(ShippingMethodTypeId)) {
> +                paramList.add("ShippingMethodTypeId=" +
> ShippingMethodTypeId);
> +                conditions.add(makeExpr("shipmentMethodTypeId",
> ShippingMethodTypeId));
> +            }
> +        }
> +        // PaymentGatewayResponse
> +        String gatewayAvsResult = (String)
> context.get("gatewayAvsResult");
> +        String gatewayScoreResult = (String)
> context.get("gatewayScoreResult");
> +        if (UtilValidate.isNotEmpty(gatewayAvsResult) ||
> UtilValidate.isNotEmpty(gatewayScoreResult)) {
> +            dve.addMemberEntity("OPP", "OrderPaymentPreference");
> +            dve.addMemberEntity("PGR", "PaymentGatewayResponse");
> +            dve.addAlias("OPP", "orderPaymentPreferenceId");
> +            dve.addAlias("PGR", "gatewayAvsResult");
> +            dve.addAlias("PGR", "gatewayScoreResult");
> +            dve.addViewLink("OH", "OPP", Boolean.FALSE,
> UtilMisc.toList(new ModelKeyMap("orderId", "orderId")));
> +            dve.addViewLink("OPP", "PGR", Boolean.FALSE,
> UtilMisc.toList(new ModelKeyMap("orderPaymentPreferenceId",
> "orderPaymentPreferenceId")));
> +        }
> +
> +        if (UtilValidate.isNotEmpty(gatewayAvsResult)) {
> +            paramList.add("gatewayAvsResult=" + gatewayAvsResult);
> +
>  conditions.add(EntityCondition.makeCondition("gatewayAvsResult",
> gatewayAvsResult));
> +        }
> +
> +        if (UtilValidate.isNotEmpty(gatewayScoreResult)) {
> +            paramList.add("gatewayScoreResult=" + gatewayScoreResult);
> +
>  conditions.add(EntityCondition.makeCondition("gatewayScoreResult",
> gatewayScoreResult));
> +        }
> +
>         // add the role data to the view
>         if (roleTypeList != null || partyId != null) {
>             dve.addMemberEntity("OT", "OrderRole");
>
> 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=777084&r1=777083&r2=777084&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
> Thu May 21 11:54:35 2009
> @@ -48,6 +48,10 @@
>  channels = delegator.findByAnd("Enumeration", [enumTypeId :
> "ORDER_SALES_CHANNEL"], ["sequenceId"]);
>  context.salesChannels = channels;
>
> +// get the Shipping Methods
> +carrierShipmentMethods = delegator.findList("CarrierShipmentMethod", null,
> null, null, null, false);
> +context.carrierShipmentMethods = carrierShipmentMethods;
> +
>  // current role type
>  currentRoleTypeId = request.getParameter("roleTypeId");
>  if (currentRoleTypeId) {
> @@ -82,6 +86,17 @@
>     context.currentProductStore = currentProductStore;
>  }
>
> +// current Shipping Method
> +shipmentMethod = request.getParameter("shipmentMethod");
> +if (shipmentMethod) {
> +    carrierPartyId = shipmentMethod.substring(0,
> shipmentMethod.indexOf("@"));
> +    ShippingMethodTypeId =
> shipmentMethod.substring(shipmentMethod.indexOf("@")+1);
> +    if (carrierPartyId && shipmentMethodTypeId) {
> +        currentCarrierShipmentMethod =
> delegator.findByAnd("CarrierShipmentMethod", [carrierPartyId :
> carrierPartyId, shipmentMethodTypeId : shipmentMethodTypeId]);
> +        context.currentCarrierShipmentMethod =
> currentCarrierShipmentMethod;
> +    }
> +}
> +
>  // current channel
>  currentSalesChannelId = request.getParameter("salesChannelEnumId");
>  if (currentSalesChannelId) {
>
> 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=777084&r1=777083&r2=777084&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl
> (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl Thu
> May 21 11:54:35 2009
> @@ -96,6 +96,10 @@
>   <input type='hidden' name='filterPOsWithRejectedItems'
> value='${requestParameters.filterPOsWithRejectedItems?if_exists}'/>
>   <input type='hidden' name='countryGeoId'
> value='${requestParameters.countryGeoId?if_exists}'/>
>   <input type='hidden' name='includeCountry'
> value='${requestParameters.includeCountry?if_exists}'/>
> +  <input type='hidden' name='isViewed'
> value='${requestParameters.isViewed?if_exists}'/>
> +  <input type='hidden' name='shipmentMethod'
> value='${requestParameters.shipmentMethod?if_exists}'/>
> +  <input type='hidden' name='gatewayAvsResult'
> value='${requestParameters.gatewayAvsResult?if_exists}'/>
> +  <input type='hidden' name='gatewayScoreResult'
> value='${requestParameters.gatewayScoreResult?if_exists}'/>
>  </form>
>  </#if>
>  <form method="post" name="lookuporder"
> action="<@ofbizUrl>searchorders</@ofbizUrl>"
> onsubmit="javascript:lookupOrders();">
> @@ -300,6 +304,49 @@
>                 </td>
>               </tr>
>               <tr>
> +                <td width='25%' align='right'
> class='label'>${uiLabelMap.OrderSelectShippingMethod}</td>
> +                <td width='5%'>&nbsp;</td>
> +                <td align='left'>
> +                  <select name="shipmentMethod">
> +                    <#if currentCarrierShipmentMethod?has_content>
> +                      <#assign currentShipmentMethodType =
> currentCarrierShipmentMethod.getRelatedOne("ShipmentMethodType")>
> +                      <option
> value="${currentcarriershipmentmethod.party...@${currentcarriershipmentmethod.shipmentmethodtypeid}">${currentCarrierShipmentMethod.partyId?if_exists}
> ${currentShipmentMethodType.description?if_exists}</option>
> +                      <option
> value="${currentCarrierShipmentMethod.partyId}@
> ${currentCarrierShipmentMethod.shipmentMethodTypeId}">---</option>
> +                    </#if>
> +                    <option
> value="">${uiLabelMap.OrderSelectShippingMethod}</option>
> +                    <#list carrierShipmentMethods as
> carrierShipmentMethod>
> +                      <#assign shipmentMethodType =
> carrierShipmentMethod.getRelatedOne("ShipmentMethodType")>
> +                      <option 
> value="${carriershipmentmethod.party...@${carriershipmentmethod.shipmentmethodtypeid}">${carrierShipmentMethod.partyId?if_exists}
> ${shipmentMethodType.description?if_exists}</option>
> +                    </#list>
> +                  </select>
> +                </td>
> +              </tr>
> +              <tr>
> +                <td width='25%' align='right'
> class='label'>${uiLabelMap.OrderViewed}</td>
> +                <td width='5%'>&nbsp;</td>
> +                <td align='left'>
> +                  <select name="isViewed">
> +                    <#if requestParameters.isViewed?has_content>
> +                      <#assign isViewed = requestParameters.isViewed>
> +                      <option value="${isViewed}"><#if "Y" ==
> isViewed>${uiLabelMap.CommonYes}<#elseif "N" ==
> isViewed>${uiLabelMap.CommonNo}</#if></option>
> +                    </#if>
> +                    <option value=""></option>
> +                    <option value="Y">${uiLabelMap.CommonYes}</option>
> +                    <option value="N">${uiLabelMap.CommonNo}</option>
> +                  </select>
> +                </td>
> +              </tr>
> +              <tr>
> +                <td width='25%' align='right'
> class='label'>${uiLabelMap.OrderAddressVerification}</td>
> +                <td width='5%'>&nbsp;</td>
> +                <td align='left'><input type='text'
> name='gatewayAvsResult'
> value='${requestParameters.gatewayAvsResult?if_exists}'/></td>
> +              </tr>
> +              <tr>
> +                <td width='25%' align='right'
> class='label'>${uiLabelMap.OrderScore}</td>
> +                <td width='5%'>&nbsp;</td>
> +                <td align='left'><input type='text'
> name='gatewayScoreResult'
> value='${requestParameters.gatewayScoreResult?if_exists}'/></td>
> +              </tr>
> +              <tr>
>                 <td width='25%' align='right'
> class='label'>${uiLabelMap.CommonDateFilter}</td>
>                 <td width='5%'>&nbsp;</td>
>                 <td align='left'>
>
>
>

Reply via email to