Fixed issue 30373: Added accounting date to Add Multiple Payments process
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Wed, 15 Jul 2015 17:49:30 +0200
changeset 27085 bbfccafd18ed
parent 27084 fbe4acffc34a
child 27086 06c15f9276a7
Fixed issue 30373: Added accounting date to Add Multiple Payments process

A new process parameter called Accounting Date has been added to the Add Multiple Payments process. The transaction(s) created by this process will have the entered Accounting Date (in a similar way we already do for the transaction date).
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddMultiplePaymentsHandler.java
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Thu Jul 16 11:28:43 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Wed Jul 15 17:49:30 2015 +0200
@@ -151,6 +151,31 @@
 <!--0E18ACB41550424A83A62E33C2D83FB3-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
 <!--0E18ACB41550424A83A62E33C2D83FB3--></OBUIAPP_PARAMETER>
 
+<!--0F44A3B0971F47A1B509A50377BEB383--><OBUIAPP_PARAMETER>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <OBUIAPP_PARAMETER_ID><![CDATA[0F44A3B0971F47A1B509A50377BEB383]]></OBUIAPP_PARAMETER_ID>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <NAME><![CDATA[Accounting Date]]></NAME>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <DESCRIPTION><![CDATA[The date this transaction is recorded for in the general ledger.]]></DESCRIPTION>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <HELP><![CDATA[The date this transaction is recorded on in the general ledger. This date also indicates which accounting period within the fiscal year this transaction will be part of.]]></HELP>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <AD_REFERENCE_ID><![CDATA[15]]></AD_REFERENCE_ID>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <COLUMNNAME><![CDATA[dateAcct]]></COLUMNNAME>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <DEFAULTVALUE><![CDATA[OB.getSession().getAttribute('#DATE')]]></DEFAULTVALUE>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <AD_ELEMENT_ID><![CDATA[263]]></AD_ELEMENT_ID>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <OBUIAPP_PROCESS_ID><![CDATA[4CE463C04CA0412CAC57EF58FE0F8498]]></OBUIAPP_PROCESS_ID>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--0F44A3B0971F47A1B509A50377BEB383-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--0F44A3B0971F47A1B509A50377BEB383--></OBUIAPP_PARAMETER>
+
 <!--111000BF6C4445E785AA08331A268E1B--><OBUIAPP_PARAMETER>
 <!--111000BF6C4445E785AA08331A268E1B-->  <OBUIAPP_PARAMETER_ID><![CDATA[111000BF6C4445E785AA08331A268E1B]]></OBUIAPP_PARAMETER_ID>
 <!--111000BF6C4445E785AA08331A268E1B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -811,7 +836,7 @@
 <!--74479AE073FF4FA5A527DC79EC0A1C82-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--74479AE073FF4FA5A527DC79EC0A1C82-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--74479AE073FF4FA5A527DC79EC0A1C82-->  <NAME><![CDATA[Payment]]></NAME>
-<!--74479AE073FF4FA5A527DC79EC0A1C82-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--74479AE073FF4FA5A527DC79EC0A1C82-->  <SEQNO><![CDATA[30]]></SEQNO>
 <!--74479AE073FF4FA5A527DC79EC0A1C82-->  <AD_REFERENCE_ID><![CDATA[FF80818132D8F0F30132D9BC395D0038]]></AD_REFERENCE_ID>
 <!--74479AE073FF4FA5A527DC79EC0A1C82-->  <AD_REFERENCE_VALUE_ID><![CDATA[D9B6068A6D3E4B7487470E7D2F033A54]]></AD_REFERENCE_VALUE_ID>
 <!--74479AE073FF4FA5A527DC79EC0A1C82-->  <COLUMNNAME><![CDATA[payments]]></COLUMNNAME>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddMultiplePaymentsHandler.java	Thu Jul 16 11:28:43 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddMultiplePaymentsHandler.java	Wed Jul 15 17:49:30 2015 +0200
@@ -52,6 +52,7 @@
       final JSONArray selectedPayments = jsonparams.getJSONObject("payments").getJSONArray(
           "_selection");
       final Date statementDate = jsDateFormat.parse(jsonparams.getString("statementDate"));
+      final Date dateAcct = jsDateFormat.parse(jsonparams.getString("dateAcct"));
       final String strAccountId = jsonData.getString("Fin_Financial_Account_ID");
 
       int selectedPaymentsLength = selectedPayments.length();
@@ -62,7 +63,7 @@
 
       for (int i = 0; i < selectedPaymentsLength; i++) {
         final JSONObject paymentJS = selectedPayments.getJSONObject(i);
-        createAndProcessTransactionFromPayment(paymentJS, statementDate, strAccountId);
+        createAndProcessTransactionFromPayment(paymentJS, statementDate, dateAcct, strAccountId);
       }
       // Success Message
       return getSuccessMessage(String.format(
@@ -87,7 +88,7 @@
    * Creates a new transaction from the payment and then it processes the transaction
    */
   private void createAndProcessTransactionFromPayment(final JSONObject paymentJS,
-      final Date transactionDate, String strAccountId) throws JSONException {
+      final Date transactionDate, final Date acctDate, String strAccountId) throws JSONException {
 
     try {
       OBContext.setAdminMode(true);
@@ -100,6 +101,7 @@
       if (payment != null) {
         final FIN_FinaccTransaction transaction = TransactionsDao.createFinAccTransaction(payment);
         transaction.setTransactionDate(transactionDate);
+        transaction.setDateAcct(acctDate);
         transaction.setAccount(account);
         FIN_TransactionProcess.doTransactionProcess(ACTION_PROCESS_TRANSACTION, transaction);
       }