IDEMPIERE-6294 default expression for multi-select fields (#2532)

* IDEMPIERE-6294 default expression for multi-select fields

* IDEMPIERE-6294 - Adjusts
This commit is contained in:
Vitor Henrique Dos Santos 2024-11-14 08:59:01 -03:00 committed by Carlos Ruiz
parent b4f89d9c0e
commit 157269644c
1 changed files with 11 additions and 1 deletions

View File

@ -881,6 +881,7 @@ public class GridField
if (m_vo.DefaultValue != null && !m_vo.DefaultValue.equals("") && !m_vo.DefaultValue.startsWith(MColumn.VIRTUAL_UI_COLUMN_PREFIX))
{
String defStr = ""; // problem is with texts like 'sss;sss'
String defStrMultipleSelect = "";
// It is one or more variables/constants
StringTokenizer st = new StringTokenizer(m_vo.DefaultValue, ",;", false);
while (st.hasMoreTokens())
@ -892,7 +893,16 @@ public class GridField
defStr = Env.parseContext(m_vo.ctx, m_vo.WindowNo, m_vo.TabNo, defStr.trim(), false, false);
else if (defStr.indexOf("'") != -1) // it is a 'String'
defStr = defStr.replace('\'', ' ').trim();
if (DisplayType.isChosenMultipleSelection(m_vo.displayType)) {
defStrMultipleSelect += defStr + ",";
if (!st.hasMoreTokens()) {
defStr = defStrMultipleSelect.substring(0, defStrMultipleSelect.length() - 1);
} else {
continue;
}
}
if (!defStr.equals(""))
{
if (log.isLoggable(Level.FINE)) log.fine("[DefaultValue] " + m_vo.ColumnName + "=" + defStr);