[aprm-windows] DOCBASETYPE param default value and display logic
authorUnai Martirena <unai.martirena@openbravo.com>
Fri, 06 Jun 2014 13:53:22 +0200
changeset 23729 5ad5a46c4fe8
parent 23728 ff3b8b23e622
child 23730 f54083a7cb9b
[aprm-windows] DOCBASETYPE param default value and display logic
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesExpression.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Fri Jun 06 13:09:45 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Fri Jun 06 13:53:22 2014 +0200
@@ -627,12 +627,13 @@
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
-<!--8B738077BBF041E88B843AB9D98B12B0-->  <DEFAULTVALUE><![CDATA['ARR']]></DEFAULTVALUE>
+<!--8B738077BBF041E88B843AB9D98B12B0-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentDefaultValuesExpression")]]></DEFAULTVALUE>
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <AD_ELEMENT_ID><![CDATA[865]]></AD_ELEMENT_ID>
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <ISFIXED><![CDATA[N]]></ISFIXED>
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--8B738077BBF041E88B843AB9D98B12B0-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--8B738077BBF041E88B843AB9D98B12B0--></OBUIAPP_PARAMETER>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesExpression.java	Fri Jun 06 13:09:45 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesExpression.java	Fri Jun 06 13:53:22 2014 +0200
@@ -93,6 +93,8 @@
           return handler.getDefaultStandardPrecision(requestMap);
         case GenerateCredit:
           return handler.getDefaultGeneratedCredit(requestMap);
+        case DocumentCategory:
+          return handler.getDefaultDocumentCategory(requestMap);
         }
       } catch (Exception e) {
         log.error("Error trying to get default value of " + strCurrentParam + e.getMessage(), e);
@@ -136,7 +138,7 @@
         "fin_paymentmethod_id"), TransactionType("transaction_type"), CustomerCredit(
         "customer_credit"), IsSOTrx("issotrx"), Payment("fin_payment_id"), Invoice("c_invoice_id"), Order(
         "c_order_id"), ConversionRate("conversion_rate"), ConvertedAmount("converted_amount"), StandardPrecision(
-        "StdPrecision"), GenerateCredit("generateCredit");
+        "StdPrecision"), GenerateCredit("generateCredit"), DocumentCategory("DOCBASETYPE");
 
     private String columnname;
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java	Fri Jun 06 13:09:45 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java	Fri Jun 06 13:53:22 2014 +0200
@@ -203,4 +203,14 @@
     BigDecimal generateCredit = BigDecimal.ZERO;
     return generateCredit.toPlainString();
   }
+
+  String getDefaultDocumentCategory(Map<String, String> requestMap) throws JSONException {
+    boolean isSOTrx = "Y".equals(getDefaultIsSOTrx(requestMap));
+    if (isSOTrx) {
+      return "ARR";
+    } else if (!isSOTrx) {
+      return "APP";
+    }
+    return null;
+  }
 }