details:   /erp/devel/pi/rev/017505232d44
changeset: 7081:017505232d44
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Sat Apr 17 14:33:31 2010 +0200
summary:   Fixes some typos in financial flows sources

details:   /erp/devel/pi/rev/48709a78f2b8
changeset: 7082:48709a78f2b8
user:      Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
date:      Sat Apr 17 14:35:45 2010 +0200
summary:   Fixes onCreateDefault of FIN_PAYMENT table fro column C_DocType_Id

diffstat:

 src-db/database/model/tables/FIN_FINACC_TRANSACTION.xml                   |    
1 -
 src-db/database/model/tables/FIN_PAYMENT.xml                              |    
2 +-
 src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java         |   
83 ++---
 src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransactionTemplate.java |    
2 +-
 src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java                   |  
156 ++++-----
 src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java            |   
74 +--
 src/org/openbravo/erpCommon/ad_forms/DocInvoiceTemplate.java              |    
8 +-
 src/org/openbravo/erpCommon/ad_forms/DocLine_FINFinAccTransaction.java    |   
15 -
 src/org/openbravo/erpCommon/ad_forms/DocLine_FINPayment.java              |   
41 +-
 src/org/openbravo/erpCommon/ad_forms/DocLine_FINReconciliation.java       |   
17 +-
 10 files changed, 165 insertions(+), 234 deletions(-)

diffs (truncated from 648 to 300 lines):

diff -r 05176da071e4 -r 48709a78f2b8 
src-db/database/model/tables/FIN_FINACC_TRANSACTION.xml
--- a/src-db/database/model/tables/FIN_FINACC_TRANSACTION.xml   Fri Apr 16 
12:19:56 2010 +0200
+++ b/src-db/database/model/tables/FIN_FINACC_TRANSACTION.xml   Sat Apr 17 
14:35:45 2010 +0200
@@ -79,7 +79,6 @@
       </column>
       <column name="POSTED" primaryKey="false" required="false" type="VARCHAR" 
size="60" autoIncrement="false">
         <default><![CDATA[N]]></default>
-        <onCreateDefault><![CDATA['N']]></onCreateDefault>
       </column>
       <column name="C_PROJECT_ID" primaryKey="false" required="false" 
type="VARCHAR" size="32" autoIncrement="false">
         <default/>
diff -r 05176da071e4 -r 48709a78f2b8 
src-db/database/model/tables/FIN_PAYMENT.xml
--- a/src-db/database/model/tables/FIN_PAYMENT.xml      Fri Apr 16 12:19:56 
2010 +0200
+++ b/src-db/database/model/tables/FIN_PAYMENT.xml      Sat Apr 17 14:35:45 
2010 +0200
@@ -95,7 +95,7 @@
       </column>
       <column name="C_DOCTYPE_ID" primaryKey="false" required="true" 
type="VARCHAR" size="32" autoIncrement="false">
         <default/>
-        <onCreateDefault><![CDATA[SELECT max(C_DocType_ID) from C_DocType 
WHERE c_doctype.ad_client_id = fin_payment_.ad_client_id AND 
AD_ISORGINCLUDED(FIN_Payment_.AD_Org_ID,C_DocType.AD_Org_ID, 
FIN_Payment_.AD_Client_ID) <> -1 AND C_DocType.DocBaseType IN ('APP', 'ARR') 
AND C_DocType.IsSOTrx=Fin_Payment_.isreceipt]]></onCreateDefault>
+        <onCreateDefault><![CDATA[SELECT max(C_DocType_ID) from C_DocType 
WHERE c_doctype.ad_client_id = fin_payment.ad_client_id AND 
AD_ISORGINCLUDED(FIN_Payment.AD_Org_ID,C_DocType.AD_Org_ID, 
FIN_Payment.AD_Client_ID) <> -1 AND C_DocType.DocBaseType IN ('APP', 'ARR') AND 
C_DocType.IsSOTrx=Fin_Payment.isreceipt]]></onCreateDefault>
       </column>
       <column name="C_PROJECT_ID" primaryKey="false" required="false" 
type="VARCHAR" size="32" autoIncrement="false">
         <default/>
diff -r 05176da071e4 -r 48709a78f2b8 
src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java Fri Apr 
16 12:19:56 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java Sat Apr 
17 14:35:45 2010 +0200
@@ -57,7 +57,7 @@
   public static final String TRXTYPE_BankFee = "BF";
 
   private static final long serialVersionUID = 1L;
-  static Logger log4jDocFINFinAccTransaction = 
Logger.getLogger(DocFINFinAccTransaction.class);
+  private static final Logger log4j = 
Logger.getLogger(DocFINFinAccTransaction.class);
 
   String SeqNo = "0";
 
@@ -150,29 +150,33 @@
   public FieldProviderFactory[] 
loadLinesGLItemFieldProvider(FIN_FinaccTransaction transaction) {
     FieldProviderFactory[] data = new FieldProviderFactory[1];
     boolean wasAdministrator = 
OBContext.getOBContext().setInAdministratorMode(true);
-    data[0] = new FieldProviderFactory(new HashMap());
-    FieldProviderFactory.setField(data[0], "FIN_Finacc_Transaction_ID", 
transaction.getId());
-    FieldProviderFactory.setField(data[0], "AD_Client_ID", 
transaction.getClient().getId());
-    FieldProviderFactory.setField(data[0], "adOrgId", 
transaction.getOrganization().getId());
-    FieldProviderFactory.setField(data[0], "cGlItemId", 
transaction.getGLItem().getId());
-    FieldProviderFactory.setField(data[0], "DepositAmount", 
transaction.getDepositAmount()
-        .toString());
-    FieldProviderFactory.setField(data[0], "PaymentAmount", 
transaction.getPaymentAmount()
-        .toString());
-    FieldProviderFactory.setField(data[0], "description", 
transaction.getDescription());
-    FieldProviderFactory.setField(data[0], "cCurrencyId", 
transaction.getCurrency().getId());
-    FieldProviderFactory
-        .setField(data[0], "cBpartnerId", (transaction.getFinPayment() == null 
|| transaction
-            .getFinPayment().getBusinessPartner() == null) ? "" : 
transaction.getFinPayment()
-            .getBusinessPartner().getId());
-    if (transaction.getActivity() != null)
-      FieldProviderFactory.setField(data[0], "cActivityId", 
transaction.getActivity().getId());
-    if (transaction.getProject() != null)
-      FieldProviderFactory.setField(data[0], "cProjectId", 
transaction.getProject().getId());
-    if (transaction.getSalesCampaign() != null)
-      FieldProviderFactory.setField(data[0], "cCampaignId", 
transaction.getSalesCampaign().getId());
-    FieldProviderFactory.setField(data[0], "lineno", 
transaction.getLineNo().toString());
-    OBContext.getOBContext().setInAdministratorMode(wasAdministrator);
+    try {
+      data[0] = new FieldProviderFactory(new HashMap());
+      FieldProviderFactory.setField(data[0], "FIN_Finacc_Transaction_ID", 
transaction.getId());
+      FieldProviderFactory.setField(data[0], "AD_Client_ID", 
transaction.getClient().getId());
+      FieldProviderFactory.setField(data[0], "adOrgId", 
transaction.getOrganization().getId());
+      FieldProviderFactory.setField(data[0], "cGlItemId", 
transaction.getGLItem().getId());
+      FieldProviderFactory.setField(data[0], "DepositAmount", 
transaction.getDepositAmount()
+          .toString());
+      FieldProviderFactory.setField(data[0], "PaymentAmount", 
transaction.getPaymentAmount()
+          .toString());
+      FieldProviderFactory.setField(data[0], "description", 
transaction.getDescription());
+      FieldProviderFactory.setField(data[0], "cCurrencyId", 
transaction.getCurrency().getId());
+      FieldProviderFactory
+          .setField(data[0], "cBpartnerId", (transaction.getFinPayment() == 
null || transaction
+              .getFinPayment().getBusinessPartner() == null) ? "" : 
transaction.getFinPayment()
+              .getBusinessPartner().getId());
+      if (transaction.getActivity() != null)
+        FieldProviderFactory.setField(data[0], "cActivityId", 
transaction.getActivity().getId());
+      if (transaction.getProject() != null)
+        FieldProviderFactory.setField(data[0], "cProjectId", 
transaction.getProject().getId());
+      if (transaction.getSalesCampaign() != null)
+        FieldProviderFactory.setField(data[0], "cCampaignId", 
transaction.getSalesCampaign()
+            .getId());
+      FieldProviderFactory.setField(data[0], "lineno", 
transaction.getLineNo().toString());
+    } finally {
+      OBContext.getOBContext().setInAdministratorMode(wasAdministrator);
+    }
     return data;
   }
 
@@ -183,7 +187,7 @@
       return null;
     for (int i = 0; i < data.length; i++) {
       String Line_ID = data[i].getField("FIN_Finacc_Transaction_ID");
-      DocLine_FINReconciliation docLine = new 
DocLine_FINReconciliation(DocumentType,
+      DocLine_FINFinAccTransaction docLine = new 
DocLine_FINFinAccTransaction(DocumentType,
           Record_ID, Line_ID);
       String strPaymentId = data[i].getField("FIN_Payment_ID");
       if (strPaymentId != null && !strPaymentId.equals(""))
@@ -199,7 +203,7 @@
       list.add(docLine);
     }
     // Return Array
-    DocLine_FINReconciliation[] dl = new 
DocLine_FINReconciliation[list.size()];
+    DocLine_FINFinAccTransaction[] dl = new 
DocLine_FINFinAccTransaction[list.size()];
     list.toArray(dl);
     return dl;
   } // loadLines
@@ -244,8 +248,8 @@
               .forName(strClassname).newInstance();
           return newTemplate.createFact(this, as, conn, con, vars);
         } catch (Exception e) {
-          log4jDocFINFinAccTransaction
-              .error("Error while creating new instance for 
DocFINFinAccTransactionTemplate - " + e);
+          log4j.error("Error while creating new instance for 
DocFINFinAccTransactionTemplate - "
+              + e);
         }
       }
     } finally {
@@ -253,7 +257,7 @@
     }
     Fact fact = new Fact(this, as, Fact.POST_Actual);
     for (int i = 0; p_lines != null && i < p_lines.length; i++) {
-      DocLine_FINReconciliation line = (DocLine_FINReconciliation) p_lines[i];
+      DocLine_FINFinAccTransaction line = (DocLine_FINFinAccTransaction) 
p_lines[i];
       FIN_FinaccTransaction transaction = 
OBDal.getInstance().get(FIN_FinaccTransaction.class,
           Record_ID);
       // 3 Scenarios: 1st Bank fee 2nd glitem transaction 3rd payment related 
transaction
@@ -270,7 +274,7 @@
   /*
    * Creates accounting related to a bank fee transaction
    */
-  public Fact createFactFee(DocLine_FINReconciliation line, 
FIN_FinaccTransaction transaction,
+  public Fact createFactFee(DocLine_FINFinAccTransaction line, 
FIN_FinaccTransaction transaction,
       AcctSchema as, ConnectionProvider conn, Fact fact) throws 
ServletException {
     String Fact_Acct_Group_ID = SequenceIdData.getUUID();
     fact.createLine(line, getAccountFee(as, transaction.getAccount(), conn), 
C_Currency_ID, line
@@ -283,7 +287,7 @@
     return fact;
   }
 
-  public Fact createFactPaymentDetails(DocLine_FINReconciliation line, 
AcctSchema as,
+  public Fact createFactPaymentDetails(DocLine_FINFinAccTransaction line, 
AcctSchema as,
       ConnectionProvider conn, Fact fact) throws ServletException {
     boolean isPrepayment = "Y".equals(line.getIsPrepayment());
     BigDecimal paymentAmount = new BigDecimal(line.getPaymentAmount());
@@ -318,7 +322,7 @@
   /*
    * Creates the accounting for a transaction related directly with a GLItem
    */
-  public Fact createFactGLItem(DocLine_FINReconciliation line, AcctSchema as,
+  public Fact createFactGLItem(DocLine_FINFinAccTransaction line, AcctSchema 
as,
       ConnectionProvider conn, Fact fact) throws ServletException {
     BigDecimal paymentAmount = new BigDecimal(line.getPaymentAmount());
     BigDecimal depositAmount = new BigDecimal(line.getDepositAmount());
@@ -555,19 +559,4 @@
     return account;
   }
 
-  /**
-   * @return the serialVersionUID
-   */
-  public static long getSerialVersionUID() {
-    return serialVersionUID;
-  }
-
-  public static Logger getLog4jDocAccDefPlan() {
-    return log4jDocFINFinAccTransaction;
-  }
-
-  public static void setLog4jDocFINFinAccTransaction(Logger 
log4jDocFINFinAccTransaction) {
-    DocFINFinAccTransaction.log4jDocFINFinAccTransaction = 
log4jDocFINFinAccTransaction;
-  }
-
 }
\ No newline at end of file
diff -r 05176da071e4 -r 48709a78f2b8 
src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransactionTemplate.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransactionTemplate.java 
Fri Apr 16 12:19:56 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransactionTemplate.java 
Sat Apr 17 14:35:45 2010 +0200
@@ -28,7 +28,7 @@
 
 public abstract class DocFINFinAccTransactionTemplate {
   private static final long serialVersionUID = 1L;
-  static Logger log4jDocFINFinAccTransactionTemplate = Logger
+  private static final Logger log4jDocFINFinAccTransactionTemplate = Logger
       .getLogger(DocFINFinAccTransactionTemplate.class);
 
   /**
diff -r 05176da071e4 -r 48709a78f2b8 
src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java   Fri Apr 16 
12:19:56 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java   Sat Apr 17 
14:35:45 2010 +0200
@@ -1,14 +1,21 @@
 /*
- 
************************************************************************************
- * Copyright (C) 2010 Openbravo S.L.U.
-
- * Licensed under the Openbravo Commercial License version 1.0
- * You may obtain a copy of the License at
-  http://www.openbravo.com/legal/obcl.html
-  <http://www.openbravo.com/legal/obcl.html>
- 
************************************************************************************
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2010 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
  */
-
 package org.openbravo.erpCommon.ad_forms;
 
 import java.math.BigDecimal;
@@ -42,7 +49,7 @@
 public class DocFINPayment extends AcctServer {
 
   private static final long serialVersionUID = 1L;
-  static Logger log4jDocFINPayment = Logger.getLogger(DocFINPayment.class);
+  static Logger log4j = Logger.getLogger(DocFINPayment.class);
 
   String SeqNo = "0";
 
@@ -69,29 +76,32 @@
 
     FieldProviderFactory[] data = new 
FieldProviderFactory[paymentDetails.size()];
     boolean wasAdministrator = 
OBContext.getOBContext().setInAdministratorMode(true);
-    for (int i = 0; i < data.length; i++) {
-      data[i] = new FieldProviderFactory(new HashMap());
-      FieldProviderFactory.setField(data[i], "AD_Client_ID", 
paymentDetails.get(i).getClient()
-          .getId());
-      FieldProviderFactory.setField(data[i], "AD_Org_ID", 
paymentDetails.get(i).getOrganization()
-          .getId());
-      FieldProviderFactory
-          .setField(data[i], "FIN_Payment_Detail_ID", 
paymentDetails.get(i).getId());
-      FieldProviderFactory
-          .setField(data[i], "Amount", 
paymentDetails.get(i).getAmount().toString());
-      FieldProviderFactory.setField(data[i], "isprepayment",
-          paymentDetails.get(i).isPrepayment() ? "Y" : "N");
-      FieldProviderFactory.setField(data[i], "WriteOffAmt", 
paymentDetails.get(i)
-          .getWriteoffAmount().toString());
-      FieldProviderFactory.setField(data[i], "C_GLItem_ID",
-          paymentDetails.get(i).getGLItem() != null ? 
paymentDetails.get(i).getGLItem().getId()
-              : "");
-      FieldProviderFactory
-          .setField(data[i], "Refund", paymentDetails.get(i).isRefund() ? "Y" 
: "N");
-      FieldProviderFactory.setField(data[i], "isprepayment",
-          paymentDetails.get(i).isPrepayment() ? "Y" : "N");
+    try {
+      for (int i = 0; i < data.length; i++) {
+        data[i] = new FieldProviderFactory(new HashMap());
+        FieldProviderFactory.setField(data[i], "AD_Client_ID", 
paymentDetails.get(i).getClient()
+            .getId());
+        FieldProviderFactory.setField(data[i], "AD_Org_ID", 
paymentDetails.get(i).getOrganization()
+            .getId());
+        FieldProviderFactory.setField(data[i], "FIN_Payment_Detail_ID", 
paymentDetails.get(i)
+            .getId());
+        FieldProviderFactory.setField(data[i], "Amount", 
paymentDetails.get(i).getAmount()
+            .toString());
+        FieldProviderFactory.setField(data[i], "isprepayment",
+            paymentDetails.get(i).isPrepayment() ? "Y" : "N");
+        FieldProviderFactory.setField(data[i], "WriteOffAmt", 
paymentDetails.get(i)
+            .getWriteoffAmount().toString());
+        FieldProviderFactory.setField(data[i], "C_GLItem_ID",
+            paymentDetails.get(i).getGLItem() != null ? 
paymentDetails.get(i).getGLItem().getId()
+                : "");
+        FieldProviderFactory.setField(data[i], "Refund", 
paymentDetails.get(i).isRefund() ? "Y"
+            : "N");
+        FieldProviderFactory.setField(data[i], "isprepayment",
+            paymentDetails.get(i).isPrepayment() ? "Y" : "N");
+      }
+    } finally {
+      OBContext.getOBContext().setInAdministratorMode(wasAdministrator);
     }
-    OBContext.getOBContext().setInAdministratorMode(wasAdministrator);
     return data;
   }
 
@@ -120,44 +130,47 @@
     String strClassname = "";
     final StringBuilder whereClause = new StringBuilder();
     boolean wasAdministrator = 
OBContext.getOBContext().setInAdministratorMode(true);
-    whereClause.append(" as astdt ");
-    whereClause.append(" where astdt.acctschemaTable.accountingSchema.id = '"
-        + as.m_C_AcctSchema_ID + "'");
-    whereClause.append(" and astdt.acctschemaTable.table.id = '" + AD_Table_ID 
+ "'");
-    whereClause.append(" and astdt.documentCategory = '" + DocumentType + "'");
+    try {
+      whereClause.append(" as astdt ");
+      whereClause.append(" where astdt.acctschemaTable.accountingSchema.id = '"

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to