IDEMPIERE-3707 [Info Window] - Default Value for seqNoSelection

This commit is contained in:
Carlos Ruiz 2019-02-21 13:55:11 +01:00
parent 9ee5a3aa37
commit b875e4dc09
4 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,4 @@
UPDATE AD_Column SET SeqNoSelection=SeqNoSelection*10 WHERE SeqNoSelection>0 AND IsSelectionColumn='Y' AND IsActive='Y';
SELECT register_migration_script('201902211352_IDEMPIERE-3707.sql') FROM dual
;

View File

@ -0,0 +1,4 @@
UPDATE AD_Column SET SeqNoSelection=SeqNoSelection*10 WHERE SeqNoSelection>0 AND IsSelectionColumn='Y' AND IsActive='Y';
SELECT register_migration_script('201902211352_IDEMPIERE-3707.sql') FROM dual
;

View File

@ -424,6 +424,13 @@ public class MColumn extends X_AD_Column
}
}
if (isSelectionColumn() && getSeqNoSelection() <= 0) {
int next = DB.getSQLValueEx(get_TrxName(),
"SELECT ROUND((COALESCE(MAX(SeqNoSelection),0)+10)/10,0)*10 FROM AD_Column WHERE AD_Table_ID=? AND IsSelectionColumn='Y' AND IsActive='Y'",
getAD_Table_ID());
setSeqNoSelection(next);
}
return true;
} // beforeSave

View File

@ -22,6 +22,7 @@ import java.util.logging.Level;
import org.adempiere.model.IInfoColumn;
import org.compiere.model.AccessSqlParser.TableInfo;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Evaluatee;
import org.compiere.util.Evaluator;
@ -143,6 +144,14 @@ public class MInfoColumn extends X_AD_InfoColumn implements IInfoColumn
M_Element element = new M_Element (getCtx(), getAD_Element_ID (), get_TrxName());
setName (element.getName());
}
if (isQueryCriteria() && getSeqNoSelection() <= 0) {
int next = DB.getSQLValueEx(get_TrxName(),
"SELECT ROUND((COALESCE(MAX(SeqNoSelection),0)+10)/10,0)*10 FROM AD_InfoColumn WHERE AD_InfoWindow_ID=? AND IsQueryCriteria='Y' AND IsActive='Y'",
getAD_InfoWindow_ID());
setSeqNoSelection(next);
}
return true;
}