details: https://code.openbravo.com/erp/devel/pi/rev/c0d4406ef0c0
changeset: 20164:c0d4406ef0c0
user: Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date: Mon Apr 22 09:53:02 2013 +0530
summary: Fixes Issue 0020587: [Pick&Execute] Mandatory column validation is
not working
The mandatory columns of pick and execute windows are validated on cellEditEnd
event and onSubmit.
diffstat:
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
| 12 ++
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
| 41 ++++++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
| 14 +++
3 files changed, 60 insertions(+), 7 deletions(-)
diffs (98 lines):
diff -r 0d16137a3524 -r c0d4406ef0c0
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
---
a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
Sat Apr 20 16:33:07 2013 +0200
+++
b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
Mon Apr 22 09:53:02 2013 +0530
@@ -795,6 +795,18 @@
<!--7410A9E707384D369419188644A31430-->
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--7410A9E707384D369419188644A31430--></AD_MESSAGE>
+<!--744877846A1D4E3EAD6F4BFF308C148D--><AD_MESSAGE>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->
<AD_MESSAGE_ID><![CDATA[744877846A1D4E3EAD6F4BFF308C148D]]></AD_MESSAGE_ID>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--744877846A1D4E3EAD6F4BFF308C148D--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--744877846A1D4E3EAD6F4BFF308C148D--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->
<VALUE><![CDATA[OBUIAPP_FillMandatoryFields]]></VALUE>
+<!--744877846A1D4E3EAD6F4BFF308C148D--> <MSGTEXT><![CDATA[Few mandatory
fields have not been filled. Refer lines]]></MSGTEXT>
+<!--744877846A1D4E3EAD6F4BFF308C148D--> <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->
<AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--744877846A1D4E3EAD6F4BFF308C148D--></AD_MESSAGE>
+
<!--75E47FA30B8D438E9569B4C688E863EB--><AD_MESSAGE>
<!--75E47FA30B8D438E9569B4C688E863EB-->
<AD_MESSAGE_ID><![CDATA[75E47FA30B8D438E9569B4C688E863EB]]></AD_MESSAGE_ID>
<!--75E47FA30B8D438E9569B4C688E863EB-->
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 0d16137a3524 -r c0d4406ef0c0
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
Sat Apr 20 16:33:07 2013 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
Mon Apr 22 09:53:02 2013 +0530
@@ -57,14 +57,41 @@
function actionClick() {
view.messageBar.hide();
- if (view.validate()) {
- view.doProcess(this._buttonValue);
+ var hasErrors = false,
+ grid = view.grid.viewGrid,
+ fields = grid.getFields(),
+ selection = grid.getSelectedRecords() || [],
+ len = selection.length,
+ allRows = grid.data.allRows || grid.data.localData || grid.data,
+ lineNumbers = null,
+ i, j, record, undef;
+ for (i = 0; i < len; i++) {
+ record = grid.getEditedRecord(grid.getRecordIndex(selection[i]));
+ for (j = 0; j < fields.length; j++) {
+ if (fields[j].required) {
+ if (record[fields[j].name] === null || record[fields[j] ===
undef]) {
+ hasErrors = true;
+ if (lineNumbers === null) {
+ lineNumbers = grid.getRecordIndex(selection[i]).toString();
+ } else {
+ lineNumbers = lineNumbers + "," +
grid.getRecordIndex(selection[i]).toString();
+ }
+ }
+ }
+ }
+ }
+ if (!hasErrors) {
+ if (view.validate()) {
+ view.doProcess(this._buttonValue);
+ } else {
+ // If the messageBar is visible, it means that it has been set due
to a custom validation inside view.validate()
+ // so we don't want to overwrite it with the generic
OBUIAPP_ErrorInFields message
+ if (!view.messageBar.isVisible()) {
+ view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null,
OB.I18N.getLabel('OBUIAPP_ErrorInFields'));
+ }
+ }
} else {
- // If the messageBar is visible, it means that it has been set due to
a custom validation inside view.validate()
- // so we don't want to overwrite it with the generic
OBUIAPP_ErrorInFields message
- if (!view.messageBar.isVisible()) {
- view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null,
OB.I18N.getLabel('OBUIAPP_ErrorInFields'));
- }
+ view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null,
OB.I18N.getLabel('OBUIAPP_FillMandatoryFields') + " " + lineNumbers);
}
}
diff -r 0d16137a3524 -r c0d4406ef0c0
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
Sat Apr 20 16:33:07 2013 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
Mon Apr 22 09:53:02 2013 +0530
@@ -224,6 +224,20 @@
this.Super('selectionUpdated', arguments);
},
+ cellEditEnd: function (editCompletionEvent, newValue, ficCallDone,
autoSaveDone) {
+ var colNum = this.getEditCol(),
+ editField = this.getEditField(colNum),
+ undef;
+ if (editField.required) {
+ if (newValue === null || newValue === undef) {
+ this.setFieldError(rowNum, editField.name, "Invalid Value");
+ } else {
+ this.clearFieldError(rowNum, editField.name);
+ }
+ }
+ this.Super('cellEditEnd', arguments);
+ },
+
handleFilterEditorSubmit: function (criteria, context) {
var ids = [],
crit = {},
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits