details: https://code.openbravo.com/erp/devel/pi/rev/c220c40da810 changeset: 35922:c220c40da810 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Wed May 29 17:28:40 2019 +0200 summary: fixes bug 40969: Max call stack size error in P&E grids that allow addition
P&E grids have specific code to prevent hiding the inline editor of the grid when not all mandatory fields of a new record being added are populated. When this happens, the standard "hideInlineEditor" function of Smartclient's ListGrid is not executed, preventing the clearing of the "_editorShowing" flag. If this flag is not cleared and afterwards the "showInlineEditor" is invoked the maximum call stack size error appears because the function enters into a recursive loop. To fix this problem we now also prevent the execution of the "showInlineEditor" function when not all mandatory fields of a new record being added are populated. Exactly the same logic that the "hideInlineEditor" function of P&E grids already has. diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js | 11 +++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diffs (35 lines): diff -r 1924cce570cd -r c220c40da810 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js Wed May 29 16:29:58 2019 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js Wed May 29 17:28:40 2019 +0200 @@ -981,6 +981,11 @@ showInlineEditor: function (rowNum, colNum, newCell, newRow, suppressFocus) { var editForm, items, i, updatedBlur; + + if (this.hasNewRecordWithEmptyMandatoryFields()) { + return; + } + // retrieve the initial values only if a new row has been selected // see issue https://issues.openbravo.com/view.php?id=20653 if (newRow) { @@ -1022,7 +1027,7 @@ hideInlineEditor: function (focusInBody, suppressCMHide) { var ret; - if (this.viewProperties && this.viewProperties.allowAdd && this.isRequiredFieldWithNoValue()) { + if (this.hasNewRecordWithEmptyMandatoryFields()) { return; } else { ret = this.Super('hideInlineEditor', arguments); @@ -1031,6 +1036,10 @@ } }, + hasNewRecordWithEmptyMandatoryFields: function () { + return this.viewProperties && this.viewProperties.allowAdd && this.isRequiredFieldWithNoValue(); + }, + validateRows: function () { var i, row, field, errors, editRowIDs, data = this.data.allRows || this.data.localData; _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits