details: https://code.openbravo.com/erp/devel/pi/rev/ae663ef3e8c1 changeset: 31504:ae663ef3e8c1 user: Naroa Iriarte <naroa.iriarte <at> openbravo.com> date: Tue Feb 07 12:30:45 2017 +0100 summary: Fixed issue 35055: Buttons with list reference where not working fine.
When having a button with list reference and a process definition with a button list parameter, it was not taking the label values from the column, it was only taking them from the parameters. The code which was taking the labels of the parameters has been removed because the way of obtaining the parameters' lables is covered in the "ob-pick-and-execute-view-window.js.ftl". The problem with the removed piece of code was that, at first, all the parameters were processed and this caused having the "labelValue" variable filled with the label values of the parameters. As the "labelValue" variable was not empty, the code which handled the label values of the button was never reached, because it was inside an if (labelValues != null). diffstat: modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java | 3 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java | 19 +--------- 2 files changed, 3 insertions(+), 19 deletions(-) diffs (69 lines): diff -r 874f31389ea7 -r ae663ef3e8c1 modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java Tue Feb 07 09:44:39 2017 +0100 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationUtils.java Tue Feb 07 12:30:45 2017 +0100 @@ -48,6 +48,7 @@ public class ApplicationUtils { private static Logger log = Logger.getLogger(ApplicationUtils.class); + private static final String BUTTON_REFERENCE = "28"; static boolean showWindowInClassicMode(Window window) { List<String> reasonsToBeShownInClassic = new ArrayList<String>(); @@ -228,6 +229,6 @@ if (field.getColumn() == null) { return false; } - return "28".equals(field.getColumn().getReference().getId()); + return BUTTON_REFERENCE.equals(field.getColumn().getReference().getId()); } } diff -r 874f31389ea7 -r ae663ef3e8c1 modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java Tue Feb 07 09:44:39 2017 +0100 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java Tue Feb 07 12:30:45 2017 +0100 @@ -757,7 +757,6 @@ } public class ButtonField { - private static final String AD_DEF_ERROR = "AD definition error: process parameter (%s) is using %s reference without %s"; private String id; private String label; private String url; @@ -803,9 +802,6 @@ if ("OBUIAPP_PickAndExecute".equals(uiPattern)) { // TODO: modal should be a parameter in the process definition? modal = false; - for (org.openbravo.client.application.Parameter p : newProcess.getOBUIAPPParameterList()) { - processParameter(p); - } } } else if (column.getProcess() != null) { process = column.getProcess(); @@ -845,6 +841,7 @@ if (labelValues == null) { labelValues = new ArrayList<Value>(); + if (column.getReferenceSearchKey() != null) { for (org.openbravo.model.ad.domain.List valueList : column.getReferenceSearchKey() .getADListList()) { @@ -874,20 +871,6 @@ } } - private void processParameter(org.openbravo.client.application.Parameter p) { - if (p.getReference().getId().equals(ApplicationConstants.BUTTON_LIST_REFERENCE_ID)) { - labelValues = new ArrayList<Value>(); - for (org.openbravo.model.ad.domain.List valueList : p.getReferenceSearchKey() - .getADListList()) { - labelValues.add(new Value(valueList)); - } - if (labelValues.size() == 0) { - log.error(String.format(AD_DEF_ERROR, p.getId(), "Button List", "a list associated")); - } - return; - } - } - public boolean isAutosave() { return autosave; } ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits