From 43c78b3018a94c8daa5a35c4f219b265da871a52 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:27:31 +0200 Subject: [PATCH] IDEMPIERE-6257: WListbox cannot add total line for Integer (#2470) * IDEMPIERE-6257: WListbox cannot add total line for Integer * IDEMPIERE-6257: WListbox cannot add total line for Integer implement Carlos's suggestion (to reduce number of lines) Co-Authored-By: Carlos Ruiz --------- Co-authored-by: Carlos Ruiz --- .../adempiere/webui/component/WListbox.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java index 665a703671..8d8ef7ec62 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java @@ -1234,7 +1234,19 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis if(amt == null ) amt = Double.valueOf(0); total[col] = subtotal + amt; + } + else if (c == Integer.class) + { + Integer subtotal = Integer.valueOf(0); + if(total[col] != null) + subtotal = (Integer)(total[col]); + Integer amt = (Integer) data; + if(subtotal == null) + subtotal = Integer.valueOf(0); + if(amt == null ) + amt = Integer.valueOf(0); + total[col] = subtotal + amt; } } } @@ -1246,14 +1258,10 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis for (int col = 0; col < layout.length; col++) { Class c = layout[col].getColClass(); - if (c == BigDecimal.class) + if (c == BigDecimal.class || c == Double.class || c == Integer.class) { setValueAt(total[col] , row - 1, col); } - else if (c == Double.class) - { - setValueAt(total[col] , row -1 , col); - } else { if(col == 0 )