details: https://code.openbravo.com/erp/devel/pi/rev/6e74c0a22769 changeset: 22054:6e74c0a22769 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Tue Feb 18 16:39:11 2014 +0100 summary: fixed bug 25741: widget admin failed in some circumstances
diffstat: modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java | 4 +- modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java | 23 +---- modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js | 47 ++++++--- 3 files changed, 36 insertions(+), 38 deletions(-) diffs (161 lines): diff -r 811a6d9a310e -r 6e74c0a22769 modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java --- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java Tue Feb 18 18:18:17 2014 +0530 +++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java Tue Feb 18 16:39:11 2014 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2011 Openbravo SLU + * All portions are Copyright (C) 2010-2014 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -175,7 +175,7 @@ if (widgets.length() == 0) { message.setType("Warning"); message.setMessage("OBKMO_NoInstancesFound"); - log.warn(">> No instances found."); + log.debug(">> No instances found."); } } diff -r 811a6d9a310e -r 6e74c0a22769 modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java --- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java Tue Feb 18 18:18:17 2014 +0530 +++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java Tue Feb 18 16:39:11 2014 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2013 Openbravo SLU + * All portions are Copyright (C) 2010-2014 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -36,7 +36,6 @@ import org.codehaus.jettison.json.JSONObject; import org.openbravo.base.exception.OBException; import org.openbravo.client.application.ApplicationUtils; -import org.openbravo.client.application.Parameter; import org.openbravo.client.kernel.BaseTemplateComponent; import org.openbravo.client.kernel.Template; import org.openbravo.dal.core.DalUtil; @@ -106,7 +105,6 @@ final List<JSONObject> definitions = new ArrayList<JSONObject>(); final List<String> tmp = new ArrayList<String>(); String classDef = ""; - boolean hasNullMandatory = false; final OBQuery<WidgetClass> widgetClassesQry = OBDal.getInstance().createQuery( WidgetClass.class, WidgetClass.PROPERTY_SUPERCLASS + " is false"); for (WidgetClass widgetClass : widgetClassesQry.list()) { @@ -115,23 +113,8 @@ if (!widgetProvider.validate()) { continue; } - // If fetching the widgets of the own workspace, there is no need - // to filter out the widgets with null mandatory parameters - if (!isAdminMode) { - definitions.add(widgetProvider.getWidgetClassDefinition()); - } else { - for (Parameter p : widgetClass.getOBUIAPPParameterEMObkmoWidgetClassIDList()) { - if (p.isMandatory() && p.getDefaultValue() == null) { - hasNullMandatory = true; - break; - } - } - if (!hasNullMandatory) { - definitions.add(widgetProvider.getWidgetClassDefinition()); - } else { - hasNullMandatory = false; - } - } + + definitions.add(widgetProvider.getWidgetClassDefinition()); try { classDef = widgetProvider.generate(); diff -r 811a6d9a310e -r 6e74c0a22769 modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js --- a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js Tue Feb 18 18:18:17 2014 +0530 +++ b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js Tue Feb 18 16:39:11 2014 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2013 Openbravo SLU + * All portions are Copyright (C) 2010-2014 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -760,6 +760,11 @@ } } } + + if (OB.MyOB.leftColumnLayout.addWigetSelector) { + // after updating cache lets reflect it in the drop down list if present + OB.MyOB.leftColumnLayout.addWigetSelector.refreshAvailableWidgets(); + } }, // ** {{{ updateWidgetsCache }} ** @@ -1013,21 +1018,21 @@ this.Super('destroy', arguments); }, + // ** {{{ refreshAvailableWidgets }} ** + // + // Is called when after refreshing the cache of available widget classes + // to reflect the available widgets in the drop down list + // + refreshAvailableWidgets: function () { + var i, availableWidgetsMap = {}, + widgetClasses = OB.MyOB.availableWidgetClasses; + for (i = 0; i < widgetClasses.length; i++) { + availableWidgetsMap[i] = widgetClasses[i].title; + } + this.form.setValueMap('widget', availableWidgetsMap); + }, + createDialogContents: function (rpcResponse, data, rpcRequest) { - var i, widgetClasses, availableWidgetsMap = {}; - - if (data && data.availableWidgetClasses) { - OB.MyOB.updateClassesCache(data.availableWidgetClasses); - widgetClasses = OB.MyOB.availableWidgetClasses; - for (i = 0; i < widgetClasses.length; i++) { - availableWidgetsMap[i] = widgetClasses[i].title; - } - } - - if (this.loadingLabel) { - this.loadingLabel.destroy(); - } - this.form = isc.DynamicForm.create({ width: '100%', height: 1, @@ -1058,7 +1063,7 @@ titleSuffix: '', requiredTitleSuffix: '', type: 'select', - valueMap: availableWidgetsMap, + valueMap: {}, changed: function (form, item, value) { if (value) { form.parentElement.parentElement.buttonsLayout.getMember(0).setDisabled(false); @@ -1067,6 +1072,16 @@ }] }); + OB.MyOB.leftColumnLayout.addWigetSelector = this; + + if (data && data.availableWidgetClasses) { + OB.MyOB.updateClassesCache(data.availableWidgetClasses); + } + + if (this.loadingLabel) { + this.loadingLabel.destroy(); + } + this.addItem(this.form); this.buttonsLayout.addMember(isc.OBFormButton.create({ ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits