diff --git a/migration/i9/oracle/202205021837_IDEMPIERE-4863.sql b/migration/i9/oracle/202205021837_IDEMPIERE-4863.sql new file mode 100644 index 0000000000..ca661e2a77 --- /dev/null +++ b/migration/i9/oracle/202205021837_IDEMPIERE-4863.sql @@ -0,0 +1,14 @@ +-- IDEMPIERE-4863 +SELECT register_migration_script('202205021837_IDEMPIERE-4863.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 2, 2022, 6:37:46 PM CEST +UPDATE AD_Column SET FieldLength=4000,Updated=TO_TIMESTAMP('2022-05-02 18:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214540 +; + +-- May 2, 2022, 6:37:47 PM CEST +ALTER TABLE AD_Wlistbox_Customization MODIFY Custom VARCHAR2(4000 CHAR) +; + diff --git a/migration/i9/postgresql/202205021837_IDEMPIERE-4863.sql b/migration/i9/postgresql/202205021837_IDEMPIERE-4863.sql new file mode 100644 index 0000000000..01e04f235d --- /dev/null +++ b/migration/i9/postgresql/202205021837_IDEMPIERE-4863.sql @@ -0,0 +1,11 @@ +-- IDEMPIERE-4863 +SELECT register_migration_script('202205021837_IDEMPIERE-4863.sql') FROM dual; + +-- May 2, 2022, 6:37:46 PM CEST +UPDATE AD_Column SET FieldLength=4000,Updated=TO_TIMESTAMP('2022-05-02 18:37:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=214540 +; + +-- May 2, 2022, 6:37:47 PM CEST +INSERT INTO t_alter_column values('ad_wlistbox_customization','Custom','VARCHAR(4000)',null,null) +; + diff --git a/org.adempiere.base/src/org/adempiere/model/MWlistboxCustomization.java b/org.adempiere.base/src/org/adempiere/model/MWlistboxCustomization.java index 0d88ec5c8f..9c3f22206b 100644 --- a/org.adempiere.base/src/org/adempiere/model/MWlistboxCustomization.java +++ b/org.adempiere.base/src/org/adempiere/model/MWlistboxCustomization.java @@ -22,6 +22,7 @@ import java.util.Arrays; import java.util.List; import java.util.Properties; +import org.compiere.model.MColumn; import org.compiere.model.Query; import org.compiere.model.X_AD_Wlistbox_Customization; @@ -30,7 +31,7 @@ public class MWlistboxCustomization extends X_AD_Wlistbox_Customization { /** * */ - private static final long serialVersionUID = -3220641197739038436L; + private static final long serialVersionUID = -493650011622455985L; /** * @param ctx @@ -133,7 +134,16 @@ public class MWlistboxCustomization extends X_AD_Wlistbox_Customization { { orgColumnList.addAll(addColumn); } - WlistBoxCust.setCustom(orgColumnList.toString().substring(1, orgColumnList.toString().length() -1).replaceAll("\\s", "") ); + + int maxLength = MColumn.get(ctx, Table_Name, COLUMNNAME_Custom).getFieldLength(); + String custom = orgColumnList.toString().substring(1, orgColumnList.toString().length() -1).replaceAll("\\s", ""); + + if (custom.length() > maxLength) { + while (custom.length() > maxLength) + custom = custom.substring(0, custom.lastIndexOf(",")); + } + + WlistBoxCust.setCustom(custom); } } else