IDEMPIERE-2453 peer review

This commit is contained in:
Carlos Ruiz 2015-02-25 16:02:10 -05:00
parent 79b5854a22
commit f8d7e6bc26
1 changed files with 3 additions and 2 deletions

View File

@ -3943,8 +3943,9 @@ public abstract class PO
StringBuilder countSql = new StringBuilder("SELECT COUNT(*) FROM ")
.append(MTree_Base.getNodeTableName(treeType))
.append(" WHERE Parent_ID=?");
if(DB.getSQLValue( get_TrxName(), countSql.toString(), id) > 0)
throw new AdempiereException("CannotDeleteParent");
int cnt = DB.getSQLValue( get_TrxName(), countSql.toString(), id);
if (cnt > 0)
throw new AdempiereException(Msg.getMsg(Env.getCtx(),"NoParentDelete", new Object[] {cnt}));
StringBuilder sb = new StringBuilder ("DELETE FROM ")
.append(MTree_Base.getNodeTableName(treeType))