Fixes issue 33884: Warning is shown using "Manage Reservation" feature
authorAlejandro <alekosmp86@gmail.com>
Fri, 16 Dec 2016 10:32:07 -0500
changeset 31020 ccb0950a7446
parent 31019 90270de92845
child 31021 9209a29903bc
child 31022 92ddb12457b2
Fixes issue 33884: Warning is shown using "Manage Reservation" feature

When using the Manage Reservation feature, shown through "Enable Stock Reservation"
preference, the following warning message was shown:
"WARN org.openbravo.client.application.process.BaseProcessActionHandler - Process
Manage Reservation Pick and Edit is marked as Grid Legacy, you should consider
migrating it to prevent parameter conversion". The problem is that this process is
flagged as "islegacygrid" which is an option to support backward compatibility with
old processes. Currently, the Manage Reservation feature and the other ones requested
in the issue description have been adapted to receive parameters in the new format,
this means that they have been unflagged, and the way to get the values from the grid
in its respective ActionHandler class has been updated. Before the change, the grid lines'
data was taken from the "_selection" array in the json sent to the actionhandler, now
the method was changed so the data is now taken from the "_params" object, which
has a "grid" property, in which is stored the "_selection" array, which effectively
have the selected lines of the grid. The following processes have been adapted:
CopyProcessPlanVersion
Create Purchase Order Lines
Doubtful Debt Pick and Edit
Grant Portal Access
Manage Prereservation Pick and Edit
Manage Reservation Pick and Edit
Manage Stock Reservation Pick and Edit
Manage Variants
Modify Payment In Plan
Modify Payment Out Plan
Open Close Periods
Reserved Good Movement Pick and Edit
RM Receipt Pick and Edit Lines
RM Shipment Pick and Edit Lines
Set New Currency
UpdateInvariants
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/DoubtFulDebtPickEditLines.java
src-db/database/sourcedata/OBUIAPP_PROCESS.xml
src/org/openbravo/common/actionhandler/ManagePrereservationActionHandler.java
src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java
src/org/openbravo/common/actionhandler/OrderCreatePOLines.java
src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java
src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java
src/org/openbravo/common/actionhandler/ReservedGoodMovementActionHandler.java
src/org/openbravo/materialmgmt/actionhandler/ManageVariants.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/DoubtFulDebtPickEditLines.java	Tue Dec 20 10:28:08 2016 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/DoubtFulDebtPickEditLines.java	Fri Dec 16 10:32:07 2016 -0500
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2012-2013 Openbravo SLU 
+ * All portions are Copyright (C) 2012-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -98,7 +98,8 @@
 
   private JSONObject createDoubtfulDebt(DoubtfulDebtRun doubtfulDebtRun, JSONObject jsonRequest,
       List<String> idList) throws JSONException {
-    final JSONArray selectedLines = jsonRequest.getJSONArray("_selection");
+    final JSONArray selectedLines = jsonRequest.getJSONObject("_params").getJSONObject("grid")
+        .getJSONArray("_selection");
     DocumentType documentType = null;
     Currency currency = null;
     JSONObject message = new JSONObject();
--- a/src-db/database/sourcedata/OBUIAPP_PROCESS.xml	Tue Dec 20 10:28:08 2016 +0000
+++ b/src-db/database/sourcedata/OBUIAPP_PROCESS.xml	Fri Dec 16 10:32:07 2016 -0500
@@ -106,7 +106,7 @@
 <!--41644B58FB034B62A63D2A40F69D2664-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--41644B58FB034B62A63D2A40F69D2664-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--41644B58FB034B62A63D2A40F69D2664-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--41644B58FB034B62A63D2A40F69D2664-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--41644B58FB034B62A63D2A40F69D2664-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--41644B58FB034B62A63D2A40F69D2664-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--41644B58FB034B62A63D2A40F69D2664--></OBUIAPP_PROCESS>
 
@@ -145,7 +145,7 @@
 <!--4AD70293357245AB96E59C2CDB43A35D-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--4AD70293357245AB96E59C2CDB43A35D-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--4AD70293357245AB96E59C2CDB43A35D-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--4AD70293357245AB96E59C2CDB43A35D-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--4AD70293357245AB96E59C2CDB43A35D-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--4AD70293357245AB96E59C2CDB43A35D-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--4AD70293357245AB96E59C2CDB43A35D--></OBUIAPP_PROCESS>
 
@@ -203,7 +203,7 @@
 <!--5E9F9D7EECC24E4FBB2C60840FF613BE-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--5E9F9D7EECC24E4FBB2C60840FF613BE-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--5E9F9D7EECC24E4FBB2C60840FF613BE-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--5E9F9D7EECC24E4FBB2C60840FF613BE-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--5E9F9D7EECC24E4FBB2C60840FF613BE-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--5E9F9D7EECC24E4FBB2C60840FF613BE-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--5E9F9D7EECC24E4FBB2C60840FF613BE--></OBUIAPP_PROCESS>
 
@@ -221,7 +221,7 @@
 <!--5F547560D3DE401AA0B570F22E2C6C06-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--5F547560D3DE401AA0B570F22E2C6C06-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--5F547560D3DE401AA0B570F22E2C6C06-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--5F547560D3DE401AA0B570F22E2C6C06-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--5F547560D3DE401AA0B570F22E2C6C06-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--5F547560D3DE401AA0B570F22E2C6C06-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--5F547560D3DE401AA0B570F22E2C6C06--></OBUIAPP_PROCESS>
 
@@ -257,7 +257,7 @@
 <!--653F9E5D2CCB48E081D98D000EE7CBCF-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--653F9E5D2CCB48E081D98D000EE7CBCF-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--653F9E5D2CCB48E081D98D000EE7CBCF-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--653F9E5D2CCB48E081D98D000EE7CBCF-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--653F9E5D2CCB48E081D98D000EE7CBCF-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--653F9E5D2CCB48E081D98D000EE7CBCF-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--653F9E5D2CCB48E081D98D000EE7CBCF--></OBUIAPP_PROCESS>
 
@@ -275,7 +275,7 @@
 <!--6995A4C2592D434A9E16B71E1694CBCA-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--6995A4C2592D434A9E16B71E1694CBCA-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--6995A4C2592D434A9E16B71E1694CBCA-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--6995A4C2592D434A9E16B71E1694CBCA-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--6995A4C2592D434A9E16B71E1694CBCA-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--6995A4C2592D434A9E16B71E1694CBCA-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--6995A4C2592D434A9E16B71E1694CBCA--></OBUIAPP_PROCESS>
 
@@ -311,7 +311,7 @@
 <!--70E42AD47E5F4698A9ACCCAF3EB72B9E-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--70E42AD47E5F4698A9ACCCAF3EB72B9E-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--70E42AD47E5F4698A9ACCCAF3EB72B9E-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--70E42AD47E5F4698A9ACCCAF3EB72B9E-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--70E42AD47E5F4698A9ACCCAF3EB72B9E-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--70E42AD47E5F4698A9ACCCAF3EB72B9E-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--70E42AD47E5F4698A9ACCCAF3EB72B9E--></OBUIAPP_PROCESS>
 
@@ -354,7 +354,7 @@
 <!--7372662B059D4E01A80E5599B500A2D2-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--7372662B059D4E01A80E5599B500A2D2-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--7372662B059D4E01A80E5599B500A2D2-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--7372662B059D4E01A80E5599B500A2D2-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--7372662B059D4E01A80E5599B500A2D2-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--7372662B059D4E01A80E5599B500A2D2-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--7372662B059D4E01A80E5599B500A2D2--></OBUIAPP_PROCESS>
 
@@ -428,7 +428,7 @@
 <!--97FFD59B991D49BFB5153C309B009272-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--97FFD59B991D49BFB5153C309B009272-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--97FFD59B991D49BFB5153C309B009272-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--97FFD59B991D49BFB5153C309B009272-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--97FFD59B991D49BFB5153C309B009272-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--97FFD59B991D49BFB5153C309B009272-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--97FFD59B991D49BFB5153C309B009272--></OBUIAPP_PROCESS>
 
@@ -543,7 +543,7 @@
 <!--B5C942145F354ABEBC9F16235D80D776-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--B5C942145F354ABEBC9F16235D80D776-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
 <!--B5C942145F354ABEBC9F16235D80D776-->  <CLIENTSIDEVALIDATION><![CDATA[OB.CheckAvailableCredit.onProcess]]></CLIENTSIDEVALIDATION>
-<!--B5C942145F354ABEBC9F16235D80D776-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--B5C942145F354ABEBC9F16235D80D776-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--B5C942145F354ABEBC9F16235D80D776-->  <ON_LOAD_FUNCTION><![CDATA[OB.CheckAvailableCredit.onLoad]]></ON_LOAD_FUNCTION>
 <!--B5C942145F354ABEBC9F16235D80D776-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--B5C942145F354ABEBC9F16235D80D776--></OBUIAPP_PROCESS>
@@ -715,7 +715,7 @@
 <!--FACDBDDCB6F947CBBC9CA8034EBEBD87-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--FACDBDDCB6F947CBBC9CA8034EBEBD87-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--FACDBDDCB6F947CBBC9CA8034EBEBD87-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--FACDBDDCB6F947CBBC9CA8034EBEBD87-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--FACDBDDCB6F947CBBC9CA8034EBEBD87-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--FACDBDDCB6F947CBBC9CA8034EBEBD87-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--FACDBDDCB6F947CBBC9CA8034EBEBD87--></OBUIAPP_PROCESS>
 
@@ -733,7 +733,7 @@
 <!--FE3A8C134D41488DB3A69837BD54B56A-->  <UIPATTERN><![CDATA[OBUIAPP_PickAndExecute]]></UIPATTERN>
 <!--FE3A8C134D41488DB3A69837BD54B56A-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
 <!--FE3A8C134D41488DB3A69837BD54B56A-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
-<!--FE3A8C134D41488DB3A69837BD54B56A-->  <ISGRIDLEGACY><![CDATA[Y]]></ISGRIDLEGACY>
+<!--FE3A8C134D41488DB3A69837BD54B56A-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
 <!--FE3A8C134D41488DB3A69837BD54B56A-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--FE3A8C134D41488DB3A69837BD54B56A--></OBUIAPP_PROCESS>
 
--- a/src/org/openbravo/common/actionhandler/ManagePrereservationActionHandler.java	Tue Dec 20 10:28:08 2016 +0000
+++ b/src/org/openbravo/common/actionhandler/ManagePrereservationActionHandler.java	Fri Dec 16 10:32:07 2016 -0500
@@ -97,7 +97,8 @@
 
   private void managePrereservedStockLines(JSONObject jsonRequest, OrderLine pol,
       List<String> idList) throws JSONException {
-    JSONArray selectedLines = jsonRequest.getJSONArray("_selection");
+    JSONArray selectedLines = jsonRequest.getJSONObject("_params").getJSONObject("grid")
+        .getJSONArray("_selection");
     // if no lines selected don't do anything.
     if (selectedLines.length() == 0) {
       removeNonSelectedLines(idList, pol);
--- a/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java	Tue Dec 20 10:28:08 2016 +0000
+++ b/src/org/openbravo/common/actionhandler/ManageReservationActionHandler.java	Fri Dec 16 10:32:07 2016 -0500
@@ -133,7 +133,8 @@
 
   private void manageReservedStockLines(JSONObject jsonRequest, Reservation reservation,
       List<String> idList) throws JSONException {
-    JSONArray selectedLines = jsonRequest.getJSONArray("_selection");
+    JSONArray selectedLines = jsonRequest.getJSONObject("_params").getJSONObject("grid")
+        .getJSONArray("_selection");
     // if no lines selected don't do anything.
     if (selectedLines.length() == 0) {
       removeNonSelectedLines(idList, reservation);
--- a/src/org/openbravo/common/actionhandler/OrderCreatePOLines.java	Tue Dec 20 10:28:08 2016 +0000
+++ b/src/org/openbravo/common/actionhandler/OrderCreatePOLines.java	Fri Dec 16 10:32:07 2016 -0500
@@ -90,7 +90,8 @@
   }
 
   private void createOrderLines(JSONObject jsonRequest) throws JSONException, OBException {
-    JSONArray selectedLines = jsonRequest.getJSONArray("_selection");
+    JSONArray selectedLines = jsonRequest.getJSONObject("_params").getJSONObject("grid")
+        .getJSONArray("_selection");
     final String strOrderId = jsonRequest.getString("C_Order_ID");
     Order order = OBDal.getInstance().get(Order.class, strOrderId);
     // if no lines selected don't do anything.
--- a/src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java	Tue Dec 20 10:28:08 2016 +0000
+++ b/src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java	Fri Dec 16 10:32:07 2016 -0500
@@ -93,7 +93,8 @@
   }
 
   private void createInOutLines(JSONObject jsonRequest, List<String> idList) throws JSONException {
-    JSONArray selectedLines = jsonRequest.getJSONArray("_selection");
+    JSONArray selectedLines = jsonRequest.getJSONObject("_params").getJSONObject("grid")
+        .getJSONArray("_selection");
     final String strInOutId = jsonRequest.getString("M_InOut_ID");
     ShipmentInOut inOut = OBDal.getInstance().get(ShipmentInOut.class, strInOutId);
     // if no lines selected don't do anything.
--- a/src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java	Tue Dec 20 10:28:08 2016 +0000
+++ b/src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java	Fri Dec 16 10:32:07 2016 -0500
@@ -92,7 +92,8 @@
   }
 
   private void createInOutLines(JSONObject jsonRequest, List<String> idList) throws JSONException {
-    JSONArray selectedLines = jsonRequest.getJSONArray("_selection");
+    JSONArray selectedLines = jsonRequest.getJSONObject("_params").getJSONObject("grid")
+        .getJSONArray("_selection");
     final String strInOutId = jsonRequest.getString("M_InOut_ID");
     ShipmentInOut inOut = OBDal.getInstance().get(ShipmentInOut.class, strInOutId);
     // if no lines selected don't do anything.
--- a/src/org/openbravo/common/actionhandler/ReservedGoodMovementActionHandler.java	Tue Dec 20 10:28:08 2016 +0000
+++ b/src/org/openbravo/common/actionhandler/ReservedGoodMovementActionHandler.java	Fri Dec 16 10:32:07 2016 -0500
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -53,7 +53,8 @@
     try {
       jsonRequest = new JSONObject(content);
       log.debug("{}", jsonRequest);
-      JSONArray selectedLines = jsonRequest.getJSONArray("_selection");
+      JSONArray selectedLines = jsonRequest.getJSONObject("_params").getJSONObject("grid")
+          .getJSONArray("_selection");
       if (selectedLines.length() == 0) {
         return jsonRequest;
       }
--- a/src/org/openbravo/materialmgmt/actionhandler/ManageVariants.java	Tue Dec 20 10:28:08 2016 +0000
+++ b/src/org/openbravo/materialmgmt/actionhandler/ManageVariants.java	Fri Dec 16 10:32:07 2016 -0500
@@ -59,7 +59,8 @@
     OBContext.setAdminMode(true);
     try {
       jsonRequest = new JSONObject(content);
-      JSONArray selection = jsonRequest.getJSONArray("_selection");
+      JSONArray selection = jsonRequest.getJSONObject("_params").getJSONObject("grid")
+          .getJSONArray("_selection");
       String strProductId = jsonRequest.getString("M_Product_ID");
       final Product generic = OBDal.getInstance().get(Product.class, strProductId);
       log.debug("{}", jsonRequest);