Peer review for 11755, 11756

BIG ERRORS:
- changed the whereClause not equivalent
- moved the logic of Update Ratio within the loop when it was out of the loop
FR: [ 2214883 ] Remove SQL code and Replace for Query

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
Carlos Ruiz 2010-03-26 18:53:47 +00:00
parent 6e8d32a311
commit 21212ed383
2 changed files with 16 additions and 17 deletions

View File

@ -41,7 +41,6 @@ public class MDistribution extends X_GL_Distribution
*/
private static final long serialVersionUID = -906547096682610205L;
/**
* Get Distribution for combination
* @param acct account (ValidCombination)
@ -157,7 +156,7 @@ public class MDistribution extends X_GL_Distribution
MDistribution[] retValue = (MDistribution[])s_accounts.get(key);
if (retValue != null)
return retValue;
final String whereClause = I_GL_Distribution.COLUMNNAME_Account_ID;
final String whereClause = "Account_ID=?";
List<MDistribution> list = new Query(ctx,I_GL_Distribution.Table_Name,whereClause+"=?",null)
.setParameters(Account_ID)
@ -250,6 +249,7 @@ public class MDistribution extends X_GL_Distribution
hasNullRemainder = Env.ZERO.compareTo(dl.getPercent()) == 0;
}
dl.setParent(this);
}
// Update Ratio when saved and difference
if (hasNullRemainder)
PercentTotal = Env.ONEHUNDRED;
@ -258,7 +258,6 @@ public class MDistribution extends X_GL_Distribution
setPercentTotal(PercentTotal);
save();
}
}
// return
m_lines = new MDistributionLine[list.size ()];
list.toArray (m_lines);

View File

@ -22,7 +22,7 @@ import test.AdempiereTestCase;
/**
* @author Teo Sarca, www.arhipac.ro //red1 borrows from MInvoiceTest
*/
public class MDistributionListTest extends AdempiereTestCase
public class MDistributionTest extends AdempiereTestCase
{
@Override
protected void setUp() throws Exception