IDEMPIERE-4863 : Enable save column width in WListBox - fix when panel has lots of columns (#1311)

This commit is contained in:
Nicolas Micoud 2022-05-06 04:27:57 +02:00 committed by GitHub
parent a8958bf29d
commit 440b9c27a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 2 deletions

View File

@ -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)
;

View File

@ -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)
;

View File

@ -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