IDEMPIERE-3907 Enabling Mandatory flag on accounting dimension make account combination duplicate

This commit is contained in:
Carlos Ruiz 2019-03-02 12:15:31 +01:00
parent bb8aedc027
commit f959070adc
2 changed files with 5 additions and 7 deletions

View File

@ -32,8 +32,6 @@ import org.compiere.util.Env;
* @author Jorg Janke
* @author victor.perez@e-evolution.com, www.e-evolution.com
* <li>RF [ 2214883 ] Remove SQL code and Replace for Query http://sourceforge.net/tracker/index.php?func=detail&aid=2214883&group_id=176962&atid=879335
* @author Teo Sarca, www.arhipac.ro
* <li>FR [ 2694043 ] Query. first/firstOnly usage best practice
* @version $Id: MAccount.java,v 1.4 2006/07/30 00:58:04 jjanke Exp $
*/
public class MAccount extends X_C_ValidCombination
@ -217,7 +215,7 @@ public class MAccount extends X_C_ValidCombination
MAccount existingAccount = new Query(ctx, MAccount.Table_Name, whereClause.toString(), trxName)
.setParameters(params)
.setOnlyActiveRecords(true)
.firstOnly();
.first();
// Existing
if (existingAccount != null)
@ -265,7 +263,7 @@ public class MAccount extends X_C_ValidCombination
final String whereClause = "C_AcctSchema_ID=? AND Alias=?";
MAccount retValue = new Query(ctx,I_C_ValidCombination.Table_Name,whereClause,null)
.setParameters(C_AcctSchema_ID,alias)
.firstOnly();
.first();
return retValue;
} // get

View File

@ -520,9 +520,6 @@ public class MAcctSchemaElement extends X_C_AcctSchema_Element
*/
private void updateData (String element, int id)
{
StringBuilder msguvd = new StringBuilder(element).append("=").append(id);
MAccount.updateValueDescription(getCtx(),msguvd.toString(), get_TrxName());
//
StringBuilder sql = new StringBuilder("UPDATE C_ValidCombination SET ").append(element).append("=").append(id)
.append(" WHERE ").append(element).append(" IS NULL AND AD_Client_ID=").append(getAD_Client_ID());
int noC = DB.executeUpdate(sql.toString(), get_TrxName());
@ -532,6 +529,9 @@ public class MAcctSchemaElement extends X_C_AcctSchema_Element
int noF = DB.executeUpdate(sql.toString(), get_TrxName());
//
if (log.isLoggable(Level.FINE)) log.fine("ValidCombination=" + noC + ", Fact=" + noF);
//
StringBuilder msguvd = new StringBuilder(element).append("=").append(id);
MAccount.updateValueDescription(getCtx(),msguvd.toString(), get_TrxName());
} // updateData
@Override