Merge bug fixes from release to trunk

merge 11921, 11990, 11991

Revision: 11921
Fix [2982890] Data corruption when void bank statement
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2982890

Revision: 11990
Fix [2982994] - Internal Use Inventory does not reverse Accts / thanks to Redhuan
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2982994

Revision: 11991
Fix [2951947] Fixed Assets -> String Index out of Range
ConvertPostgresql is sensitive to the way sql is written
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2951947

Tony
This commit is contained in:
tspc 2010-04-10 04:25:13 +00:00
parent 02250a06a3
commit a4ded83c4e
4 changed files with 19 additions and 3 deletions

View File

@ -36,6 +36,8 @@ import org.compiere.util.Env;
* @author Jorg Janke * @author Jorg Janke
* @author Armen Rizal, Goodwill Consulting * @author Armen Rizal, Goodwill Consulting
* <li>BF [ 1745154 ] Cost in Reversing Material Related Docs * <li>BF [ 1745154 ] Cost in Reversing Material Related Docs
* @author red1
* <li>BF [ 2982994 ] Internal Use Inventory does not reverse Accts
* @version $Id: Doc_Inventory.java,v 1.3 2006/07/30 00:53:33 jjanke Exp $ * @version $Id: Doc_Inventory.java,v 1.3 2006/07/30 00:53:33 jjanke Exp $
*/ */
public class Doc_Inventory extends Doc public class Doc_Inventory extends Doc
@ -175,7 +177,16 @@ public class Doc_Inventory extends Doc
// InventoryDiff DR CR // InventoryDiff DR CR
// or Charge // or Charge
MAccount invDiff = line.getChargeAccount(as, costs.negate()); MAccount invDiff = null;
if (m_DocStatus.equals(MInventory.DOCSTATUS_Reversed)
&& m_Reversal_ID != 0
&& line.getReversalLine_ID() != 0
&& line.getC_Charge_ID() != 0) {
invDiff = line.getChargeAccount(as, costs);
} else {
invDiff = line.getChargeAccount(as, costs.negate());
}
if (invDiff == null) if (invDiff == null)
invDiff = getAccount(Doc.ACCTTYPE_InvDifferences, as); invDiff = getAccount(Doc.ACCTTYPE_InvDifferences, as);
cr = fact.createLine(line, invDiff, cr = fact.createLine(line, invDiff,
@ -186,6 +197,7 @@ public class Doc_Inventory extends Doc
cr.setQty(line.getQty().negate()); cr.setQty(line.getQty().negate());
if (line.getC_Charge_ID() != 0) // explicit overwrite for charge if (line.getC_Charge_ID() != 0) // explicit overwrite for charge
cr.setAD_Org_ID(line.getAD_Org_ID()); cr.setAD_Org_ID(line.getAD_Org_ID());
if (m_DocStatus.equals(MInventory.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0) if (m_DocStatus.equals(MInventory.DOCSTATUS_Reversed) && m_Reversal_ID !=0 && line.getReversalLine_ID() != 0)
{ {
// Set AmtAcctCr from Original Phys.Inventory // Set AmtAcctCr from Original Phys.Inventory

View File

@ -51,6 +51,7 @@ public class CalloutBankStatement extends CalloutEngine
return ""; return "";
int C_BankAccount_ID = ((Integer)value).intValue(); int C_BankAccount_ID = ((Integer)value).intValue();
MBankAccount ba = MBankAccount.get(ctx, C_BankAccount_ID); MBankAccount ba = MBankAccount.get(ctx, C_BankAccount_ID);
ba.load(ba.get_TrxName());
mTab.setValue("BeginningBalance", ba.getCurrentBalance()); mTab.setValue("BeginningBalance", ba.getCurrentBalance());
return ""; return "";
} // bankAccount } // bankAccount

View File

@ -236,9 +236,10 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/ */
protected boolean beforeSave (boolean newRecord) protected boolean beforeSave (boolean newRecord)
{ {
if (getBeginningBalance().compareTo(Env.ZERO) == 0) if (! isProcessed() && getBeginningBalance().compareTo(Env.ZERO) == 0)
{ {
MBankAccount ba = getBankAccount(); MBankAccount ba = getBankAccount();
ba.load(get_TrxName());
setBeginningBalance(ba.getCurrentBalance()); setBeginningBalance(ba.getCurrentBalance());
} }
setEndingBalance(getBeginningBalance().add(getStatementDifference())); setEndingBalance(getBeginningBalance().add(getStatementDifference()));
@ -391,6 +392,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
} }
// Update Bank Account // Update Bank Account
MBankAccount ba = getBankAccount(); MBankAccount ba = getBankAccount();
ba.load(get_TrxName());
//BF 1933645 //BF 1933645
ba.setCurrentBalance(ba.getCurrentBalance().add(getStatementDifference())); ba.setCurrentBalance(ba.getCurrentBalance().add(getStatementDifference()));
ba.save(get_TrxName()); ba.save(get_TrxName());
@ -446,6 +448,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
//Added Lines by AZ Goodwill //Added Lines by AZ Goodwill
//Restore Bank Account Balance //Restore Bank Account Balance
MBankAccount ba = getBankAccount(); MBankAccount ba = getBankAccount();
ba.load(get_TrxName());
ba.setCurrentBalance(ba.getCurrentBalance().subtract(getStatementDifference())); ba.setCurrentBalance(ba.getCurrentBalance().subtract(getStatementDifference()));
ba.saveEx(); ba.saveEx();
//End of Added Lines //End of Added Lines