Attached Files | posterminal_issue35383.diff [^] (2,189 bytes) 2017-03-01 17:32 [Show Content] [Hide Content]diff -r c04938eafe0f src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Thu Feb 23 17:47:42 2017 +0530
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Wed Mar 01 17:30:36 2017 +0100
@@ -313,6 +313,18 @@
<!--0616FB7F76E947778B1E9D9C5088108D--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--0616FB7F76E947778B1E9D9C5088108D--></AD_MESSAGE>
+<!--06584FCD868D42CCBF63298C30E395B5--><AD_MESSAGE>
+<!--06584FCD868D42CCBF63298C30E395B5--> <AD_MESSAGE_ID><![CDATA[06584FCD868D42CCBF63298C30E395B5]]></AD_MESSAGE_ID>
+<!--06584FCD868D42CCBF63298C30E395B5--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--06584FCD868D42CCBF63298C30E395B5--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--06584FCD868D42CCBF63298C30E395B5--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--06584FCD868D42CCBF63298C30E395B5--> <VALUE><![CDATA[OBPOS_ProductSearchTooBroad]]></VALUE>
+<!--06584FCD868D42CCBF63298C30E395B5--> <MSGTEXT><![CDATA[Please narrow your search, by filtering by name, product category, ...]]></MSGTEXT>
+<!--06584FCD868D42CCBF63298C30E395B5--> <MSGTYPE><![CDATA[W]]></MSGTYPE>
+<!--06584FCD868D42CCBF63298C30E395B5--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
+<!--06584FCD868D42CCBF63298C30E395B5--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--06584FCD868D42CCBF63298C30E395B5--></AD_MESSAGE>
+
<!--066342C0820945228E4FB178AED452C3--><AD_MESSAGE>
<!--066342C0820945228E4FB178AED452C3--> <AD_MESSAGE_ID><![CDATA[066342C0820945228E4FB178AED452C3]]></AD_MESSAGE_ID>
<!--066342C0820945228E4FB178AED452C3--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r c04938eafe0f src/org/openbravo/retail/posterminal/master/Product.java
--- a/src/org/openbravo/retail/posterminal/master/Product.java Thu Feb 23 17:47:42 2017 +0530
+++ b/src/org/openbravo/retail/posterminal/master/Product.java Wed Mar 01 17:30:36 2017 +0100
@@ -319,4 +319,14 @@
protected boolean bypassPreferenceCheck() {
return true;
}
+
+ @Override
+ protected boolean mustHaveRemoteFilters() {
+ return true;
+ }
+
+ @Override
+ protected String messageWhenNoFilters() {
+ return "OBPOS_ProductSearchTooBroad";
+ }
}
mobilecore_issue35383v2.diff [^] (4,601 bytes) 2017-03-06 11:57 [Show Content] [Hide Content]diff -r 7eea47ac0a15 src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Tue Feb 28 16:17:07 2017 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Mon Mar 06 11:54:34 2017 +0100
@@ -1744,6 +1744,18 @@
<!--CC9FB6E6597A466E8B11684FF30C3EA3--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--CC9FB6E6597A466E8B11684FF30C3EA3--></AD_MESSAGE>
+<!--CD56517EFD8D47F69219C1C25247506A--><AD_MESSAGE>
+<!--CD56517EFD8D47F69219C1C25247506A--> <AD_MESSAGE_ID><![CDATA[CD56517EFD8D47F69219C1C25247506A]]></AD_MESSAGE_ID>
+<!--CD56517EFD8D47F69219C1C25247506A--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CD56517EFD8D47F69219C1C25247506A--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CD56517EFD8D47F69219C1C25247506A--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CD56517EFD8D47F69219C1C25247506A--> <VALUE><![CDATA[OBMOBC_RemoteSearchWithoutFilters]]></VALUE>
+<!--CD56517EFD8D47F69219C1C25247506A--> <MSGTEXT><![CDATA[Remote query called without filters, please narrow your search]]></MSGTEXT>
+<!--CD56517EFD8D47F69219C1C25247506A--> <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--CD56517EFD8D47F69219C1C25247506A--> <AD_MODULE_ID><![CDATA[08943B85ADF64E708797A753E5B6AAEE]]></AD_MODULE_ID>
+<!--CD56517EFD8D47F69219C1C25247506A--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--CD56517EFD8D47F69219C1C25247506A--></AD_MESSAGE>
+
<!--CD9685F4E4F1407999D69700DCD5E8A0--><AD_MESSAGE>
<!--CD9685F4E4F1407999D69700DCD5E8A0--> <AD_MESSAGE_ID><![CDATA[CD9685F4E4F1407999D69700DCD5E8A0]]></AD_MESSAGE_ID>
<!--CD9685F4E4F1407999D69700DCD5E8A0--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 7eea47ac0a15 src/org/openbravo/mobile/core/process/ProcessHQLQuery.java
--- a/src/org/openbravo/mobile/core/process/ProcessHQLQuery.java Tue Feb 28 16:17:07 2017 +0100
+++ b/src/org/openbravo/mobile/core/process/ProcessHQLQuery.java Mon Mar 06 11:54:34 2017 +0100
@@ -62,6 +62,24 @@
return null;
}
+ /**
+ * If true, the query will not be executed if significant filters are not provided
+ *
+ * @return
+ */
+ protected boolean mustHaveRemoteFilters() {
+ return false;
+ }
+
+ /**
+ * Provides the message which should be used when not enough filters are provided
+ *
+ * @return
+ */
+ protected String messageWhenNoFilters() {
+ return "OBMOBC_RemoteSearchWithoutFilters";
+ }
+
@Inject
@Any
private Instance<HQLCriteriaProcess> hqlCriterias;
@@ -104,6 +122,13 @@
JSONArray remoteFilters = jsonsent.has("remoteFilters") && !jsonsent.isNull("remoteFilters") ? jsonsent
.getJSONArray("remoteFilters") : null;
+ if (jsonsent.has("parameters") && jsonsent.getJSONObject("parameters").has("remoteModel")
+ && jsonsent.getJSONObject("parameters").getBoolean("remoteModel")
+ && mustHaveRemoteFilters()
+ && (remoteFilters == null || !hasRelevantRemoteFilters(remoteFilters))) {
+ throw new OBException(messageWhenNoFilters());
+ }
+
String orderByClause = jsonsent.has("orderByClause") && !jsonsent.isNull("orderByClause") ? jsonsent
.getString("orderByClause") : null;
@@ -302,6 +327,26 @@
}
}
+ private boolean hasRelevantRemoteFilters(JSONArray remoteFilters) {
+ boolean hasFilters = false;
+ try {
+ for (int i = 0; i < remoteFilters.length() && !hasFilters; i++) {
+ JSONObject objFilter;
+ objFilter = (JSONObject) remoteFilters.get(i);
+ if (objFilter.getString("value").equals("__all__")
+ || ((!objFilter.has("fieldType") || !objFilter.getString("fieldType").equals("Number")) && objFilter
+ .getString("value").length() < 3)) {
+ continue;
+ }
+ hasFilters = true;
+ }
+ return hasFilters;
+ } catch (JSONException e) {
+ throw new OBException("Unable to read remote filters");
+ }
+
+ }
+
public interface StrategyQuery {
public int buildResponse(Writer w, Query query, boolean firstQuery) throws JSONException,
IOException;
diff -r 7eea47ac0a15 web/org.openbravo.mobile.core/source/data/ob-dal.js
--- a/web/org.openbravo.mobile.core/source/data/ob-dal.js Tue Feb 28 16:17:07 2017 +0100
+++ b/web/org.openbravo.mobile.core/source/data/ob-dal.js Mon Mar 06 11:54:34 2017 +0100
@@ -434,6 +434,7 @@
data.parameters = {};
}
data.parameters.forceRemote = whereClause && whereClause.forceRemote;
+ data.parameters.remoteModel = true;
//replace _filter column with all columns marked as filterable
if (whereClause && whereClause.remoteFilters) {
mobile.core-35383-Mar23.diff [^] (8,930 bytes) 2017-03-23 14:06 [Show Content] [Hide Content]diff -r 553553b86771 src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Tue Mar 21 09:16:23 2017 -0400
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Thu Mar 23 12:37:35 2017 +0100
@@ -1768,6 +1768,18 @@
<!--CC9FB6E6597A466E8B11684FF30C3EA3--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--CC9FB6E6597A466E8B11684FF30C3EA3--></AD_MESSAGE>
+<!--CD56517EFD8D47F69219C1C25247506A--><AD_MESSAGE>
+<!--CD56517EFD8D47F69219C1C25247506A--> <AD_MESSAGE_ID><![CDATA[CD56517EFD8D47F69219C1C25247506A]]></AD_MESSAGE_ID>
+<!--CD56517EFD8D47F69219C1C25247506A--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CD56517EFD8D47F69219C1C25247506A--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CD56517EFD8D47F69219C1C25247506A--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CD56517EFD8D47F69219C1C25247506A--> <VALUE><![CDATA[OBMOBC_RemoteSearchWithoutFilters]]></VALUE>
+<!--CD56517EFD8D47F69219C1C25247506A--> <MSGTEXT><![CDATA[Remote query called without filters, please narrow your search]]></MSGTEXT>
+<!--CD56517EFD8D47F69219C1C25247506A--> <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--CD56517EFD8D47F69219C1C25247506A--> <AD_MODULE_ID><![CDATA[08943B85ADF64E708797A753E5B6AAEE]]></AD_MODULE_ID>
+<!--CD56517EFD8D47F69219C1C25247506A--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--CD56517EFD8D47F69219C1C25247506A--></AD_MESSAGE>
+
<!--CD9685F4E4F1407999D69700DCD5E8A0--><AD_MESSAGE>
<!--CD9685F4E4F1407999D69700DCD5E8A0--> <AD_MESSAGE_ID><![CDATA[CD9685F4E4F1407999D69700DCD5E8A0]]></AD_MESSAGE_ID>
<!--CD9685F4E4F1407999D69700DCD5E8A0--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 553553b86771 src/org/openbravo/mobile/core/process/ProcessHQLQuery.java
--- a/src/org/openbravo/mobile/core/process/ProcessHQLQuery.java Tue Mar 21 09:16:23 2017 -0400
+++ b/src/org/openbravo/mobile/core/process/ProcessHQLQuery.java Thu Mar 23 12:37:35 2017 +0100
@@ -38,6 +38,7 @@
import org.openbravo.mobile.core.model.HQLPropertyList;
import org.openbravo.mobile.core.servercontroller.MobileServerController;
import org.openbravo.mobile.core.servercontroller.MobileServerUtils;
+import org.openbravo.service.json.JsonConstants;
import org.openbravo.service.json.JsonToDataConverter;
public abstract class ProcessHQLQuery extends SecuredJSONProcess {
@@ -62,6 +63,24 @@
return null;
}
+ /**
+ * If true, the query will not be executed if significant filters are not provided
+ *
+ * @return boolean, true if empty search's are not allowed
+ */
+ protected boolean mustHaveRemoteFilters() {
+ return false;
+ }
+
+ /**
+ * Provides the message which should be used when not enough filters are provided
+ *
+ * @return string, the message search key
+ */
+ protected String messageWhenNoFilters() {
+ return "OBMOBC_RemoteSearchWithoutFilters";
+ }
+
@Inject
@Any
private Instance<HQLCriteriaProcess> hqlCriterias;
@@ -104,6 +123,16 @@
JSONArray remoteFilters = jsonsent.has("remoteFilters") && !jsonsent.isNull("remoteFilters") ? jsonsent
.getJSONArray("remoteFilters") : null;
+ if (jsonsent.has("parameters") && jsonsent.getJSONObject("parameters").has("remoteModel")
+ && jsonsent.getJSONObject("parameters").getBoolean("remoteModel")
+ && mustHaveRemoteFilters()
+ && (remoteFilters == null || !hasRelevantRemoteFilters(remoteFilters))) {
+ JSONObject errorMessage = errorMessage(messageWhenNoFilters());
+ log.debug("Search without relevant filters rejected for class " + this.getClass().getName());
+ w.write(errorMessage.toString().substring(1, errorMessage.toString().length() - 1));
+ return;
+ }
+
String orderByClause = jsonsent.has("orderByClause") && !jsonsent.isNull("orderByClause") ? jsonsent
.getString("orderByClause") : null;
@@ -302,6 +331,50 @@
}
}
+ protected boolean hasRelevantRemoteFilters(JSONArray remoteFilters) {
+ boolean hasFilters = false;
+ try {
+ for (int i = 0; i < remoteFilters.length() && !hasFilters; i++) {
+ JSONObject objFilter;
+ objFilter = (JSONObject) remoteFilters.get(i);
+ //
+ // A filter is considered not relevant if:
+ // - is an empty filter (__all__)
+ // - or type distinct from numeric (assumed string) and length less than 3
+ // Note:
+ // - Assumed only two types string and numeric, if some day added boolean needed to edit
+ // this if
+ // - Numeric types always are considered relevant regardless the size, since will be
+ // something like size greater than 5
+ //
+ if (objFilter.getString("value").equals("__all__")
+ || ((!objFilter.has("fieldType") || !objFilter.getString("fieldType").equals("Number")) && objFilter
+ .getString("value").length() < 3)) {
+ continue;
+ }
+ hasFilters = true;
+ }
+ return hasFilters;
+ } catch (JSONException e) {
+ throw new OBException("Unable to read remote filters");
+ }
+
+ }
+
+ protected JSONObject errorMessage(String message) throws Exception {
+ final JSONObject jsonResponse = new JSONObject();
+
+ jsonResponse.put(JsonConstants.RESPONSE_STATUS, JsonConstants.RPCREQUEST_STATUS_FAILURE);
+ jsonResponse.put("result", "-1");
+ jsonResponse.put("ignoreForClientLog", true);
+
+ jsonResponse.put("message", message);
+ final JSONObject error = new JSONObject();
+ error.put("message", message);
+ jsonResponse.put("error", error);
+ return jsonResponse;
+ }
+
public interface StrategyQuery {
public int buildResponse(Writer w, Query query, boolean firstQuery) throws JSONException,
IOException;
diff -r 553553b86771 web/org.openbravo.mobile.core/source/data/ob-dal.js
--- a/web/org.openbravo.mobile.core/source/data/ob-dal.js Tue Mar 21 09:16:23 2017 -0400
+++ b/web/org.openbravo.mobile.core/source/data/ob-dal.js Thu Mar 23 12:37:35 2017 +0100
@@ -434,6 +434,7 @@
data.parameters = {};
}
data.parameters.forceRemote = whereClause && whereClause.forceRemote;
+ data.parameters.remoteModel = true;
//replace _filter column with all columns marked as filterable
if (whereClause && whereClause.remoteFilters) {
diff -r 553553b86771 web/org.openbravo.mobile.core/source/data/ob-datasource.js
--- a/web/org.openbravo.mobile.core/source/data/ob-datasource.js Tue Mar 21 09:16:23 2017 -0400
+++ b/web/org.openbravo.mobile.core/source/data/ob-datasource.js Thu Mar 23 12:37:35 2017 +0100
@@ -52,7 +52,9 @@
}
// an error has been sent in the successful response
- OB.error("serviceSuccess error: status: " + response.status + ((response.error && response.error.message) ? (", error.message: " + response.error.message) : ""));
+ if(!response.ignoreForClientLog){
+ OB.error("serviceSuccess error: status: " + response.status + ((response.error && response.error.message) ? (", error.message: " + response.error.message) : ""));
+ }
// generic error message
var exception = {
diff -r 553553b86771 web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js
--- a/web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js Tue Mar 21 09:16:23 2017 -0400
+++ b/web/org.openbravo.mobile.core/source/retail/component/ob-retail-searchproductcharacteristic.js Thu Mar 23 12:37:35 2017 +0100
@@ -1039,13 +1039,17 @@
},
changePricelist: function (inSender, inEvent) {
this.currentPriceList = inEvent.priceList;
- this.doSearchAction({
- productCat: this.$.searchProductCharacteristicHeader.$.productcategory.getValue() || '__all__',
- productName: this.$.searchProductCharacteristicHeader.$.productFilterText.getValue() || '',
- filter: this.model.get('filter'),
- skipProduct: false,
- skipProductCharacteristic: false
- });
+ if (OB.MobileApp.model.hasPermission('OBPOS_remote.product', true)) {
+ this.doClearAction();
+ } else {
+ this.doSearchAction({
+ productCat: this.$.searchProductCharacteristicHeader.$.productcategory.getValue() || '__all__',
+ productName: this.$.searchProductCharacteristicHeader.$.productFilterText.getValue() || '',
+ filter: this.model.get('filter'),
+ skipProduct: false,
+ skipProductCharacteristic: false
+ });
+ }
},
receiptChanged: function () {
this.receipt.on('clear', function () {
@@ -1596,7 +1600,7 @@
forceOffline: true
});
} else {
- OB.UTIL.showError(OB.I18N.getLabel(message ? message : 'OBMOBC_ConnectionFail'));
+ OB.UTIL.showWarning(OB.I18N.getLabel(message ? message : 'OBMOBC_ConnectionFail'));
me.$.renderLoading.hide();
me.$.products.collection.reset();
me.$.products.show();
posterminal-35383-Mar23.diff [^] (2,221 bytes) 2017-03-23 14:07 [Show Content] [Hide Content]diff -r a219e327f80d -r 80a332babcdf src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Tue Mar 21 15:31:07 2017 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Fri Mar 10 14:47:51 2017 +0100
@@ -313,6 +313,18 @@
<!--0616FB7F76E947778B1E9D9C5088108D--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--0616FB7F76E947778B1E9D9C5088108D--></AD_MESSAGE>
+<!--06584FCD868D42CCBF63298C30E395B5--><AD_MESSAGE>
+<!--06584FCD868D42CCBF63298C30E395B5--> <AD_MESSAGE_ID><![CDATA[06584FCD868D42CCBF63298C30E395B5]]></AD_MESSAGE_ID>
+<!--06584FCD868D42CCBF63298C30E395B5--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--06584FCD868D42CCBF63298C30E395B5--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--06584FCD868D42CCBF63298C30E395B5--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--06584FCD868D42CCBF63298C30E395B5--> <VALUE><![CDATA[OBPOS_ProductSearchTooBroad]]></VALUE>
+<!--06584FCD868D42CCBF63298C30E395B5--> <MSGTEXT><![CDATA[Please narrow your search, by filtering by name, product category, ...]]></MSGTEXT>
+<!--06584FCD868D42CCBF63298C30E395B5--> <MSGTYPE><![CDATA[W]]></MSGTYPE>
+<!--06584FCD868D42CCBF63298C30E395B5--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID>
+<!--06584FCD868D42CCBF63298C30E395B5--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--06584FCD868D42CCBF63298C30E395B5--></AD_MESSAGE>
+
<!--066342C0820945228E4FB178AED452C3--><AD_MESSAGE>
<!--066342C0820945228E4FB178AED452C3--> <AD_MESSAGE_ID><![CDATA[066342C0820945228E4FB178AED452C3]]></AD_MESSAGE_ID>
<!--066342C0820945228E4FB178AED452C3--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r a219e327f80d -r 80a332babcdf src/org/openbravo/retail/posterminal/master/Product.java
--- a/src/org/openbravo/retail/posterminal/master/Product.java Tue Mar 21 15:31:07 2017 +0100
+++ b/src/org/openbravo/retail/posterminal/master/Product.java Fri Mar 10 14:47:51 2017 +0100
@@ -319,4 +319,14 @@
protected boolean bypassPreferenceCheck() {
return true;
}
+
+ @Override
+ protected boolean mustHaveRemoteFilters() {
+ return true;
+ }
+
+ @Override
+ protected String messageWhenNoFilters() {
+ return "OBPOS_ProductSearchTooBroad";
+ }
}
retail.sampledata-35383-Mar23.diff [^] (655 bytes) 2017-03-23 14:07 [Show Content] [Hide Content]diff -r 80b2bb2a4771 -r a815032ed4da referencedata/sampledata/The_White_Valley_Group/M_PRODUCT.xml
--- a/referencedata/sampledata/The_White_Valley_Group/M_PRODUCT.xml Wed Mar 15 14:11:43 2017 +0100
+++ b/referencedata/sampledata/The_White_Valley_Group/M_PRODUCT.xml Tue Mar 14 19:04:48 2017 +0100
@@ -8858,7 +8858,7 @@
<UPDATED><![CDATA[2015-10-21 11:16:03.207]]></UPDATED>
<UPDATEDBY><![CDATA[100]]></UPDATEDBY>
<VALUE><![CDATA[WVG/TV]]></VALUE>
- <NAME><![CDATA[TV]]></NAME>
+ <NAME><![CDATA[Flat Panel TV]]></NAME>
<C_UOM_ID><![CDATA[100]]></C_UOM_ID>
<SALESREP_ID><![CDATA[100]]></SALESREP_ID>
<ISSUMMARY><![CDATA[N]]></ISSUMMARY>
pi-mobile-35383-Mar23.diff [^] (22,494 bytes) 2017-03-23 14:07 [Show Content] [Hide Content]diff -r 589c15557c6b -r d6f27626d7bd src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java
--- a/src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java Mon Mar 20 14:11:05 2017 +0100
+++ b/src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java Wed Mar 22 15:26:44 2017 +0100
@@ -286,6 +286,14 @@
testsAllowedToHaveJavascriptErrors.add("CheckShippingAddressMandatory");
testsAllowedToHaveJavascriptErrors.add("NewCustomerWithAddress");
+ // I35383_NoEmptySearchsInProductInRemote, allow all errors in this test, instead of only accept
+ // the error : "serviceSuccess error: status: -1, error.message: OBPOS_ProductSearchTooBroad"
+ // so If this error happen in other test will make fail the test, since empty search's in remote
+ // are not allowed
+ testsAllowedToHaveJavascriptErrors.add("I35383_NoEmptySearchsInProductInRemote");
+ testsAllowedToHaveJavascriptErrors.add("I35383_No1CharSearchsInProductInRemote");
+ testsAllowedToHaveJavascriptErrors.add("I35383_No2CharSearchsInProductInRemote");
+
return testsAllowedToHaveJavascriptErrors;
}
@@ -366,6 +374,14 @@
testsAllowedToHaveLogclientErrors
.add("SelectPrinterTests.SwitchBetweenReceiptPrintersWhenError");
+ // I35383_NoEmptySearchsInProductInRemote, allow all errors in this test, instead of only accept
+ // the error : "serviceSuccess error: status: -1, error.message: OBPOS_ProductSearchTooBroad"
+ // so If this error happen in other test will make fail the test, since empty search's in remote
+ // are not allowed
+ testsAllowedToHaveLogclientErrors.add("I35383_NoEmptySearchsInProductInRemote");
+ testsAllowedToHaveLogclientErrors.add("I35383_No1CharSearchsInProductInRemote");
+ testsAllowedToHaveLogclientErrors.add("I35383_No2CharSearchsInProductInRemote");
+
return testsAllowedToHaveLogclientErrors;
}
diff -r 589c15557c6b -r d6f27626d7bd src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/stockcriteria/CheckAlwaysShowStockHelper.java
--- a/src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/stockcriteria/CheckAlwaysShowStockHelper.java Mon Mar 20 14:11:05 2017 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/stockcriteria/CheckAlwaysShowStockHelper.java Wed Mar 22 15:26:44 2017 +0100
@@ -89,7 +89,7 @@
protected void changeFunction() {
SeleniumHelper
- .executeScript("OB.UTIL.showError = function(s) { OB.error(s); OB.MobileApp.model.temp = s;"
+ .executeScript("OB.UTIL.showWarning = function(s) { OB.error(s); OB.MobileApp.model.temp = s;"
+ "if (OB.MobileApp.model.hasPermission('OBMOBC_EnableErrorPopup', true)) {"
+ "return OB.UTIL.showConfirmation.display('', s);} "
+ "else {return OB.UTIL.showAlert.display(s, OB.I18N.getLabel('OBMOBC_LblError'), 'alert-error')}};");
diff -r 589c15557c6b -r d6f27626d7bd src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java Mon Mar 20 14:11:05 2017 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java Wed Mar 22 15:26:44 2017 +0100
@@ -994,7 +994,7 @@
"Customize Coat", EnyoKind.SEARCHPRODUCT); //
public static TestIdConstructor BUTTON_SEARCHPRODUCT_MASSAGE = new TestIdConstructor("Massage",
EnyoKind.SEARCHPRODUCT); //
- public static TestIdConstructor BUTTON_SEARCHPRODUCT_TV = new TestIdConstructor("TV",
+ public static TestIdConstructor BUTTON_SEARCHPRODUCT_TV = new TestIdConstructor("Flat Panel TV",
EnyoKind.SEARCHPRODUCT); //
public static TestIdConstructor BUTTON_SEARCHPRODUCT_BED = new TestIdConstructor("Bed",
EnyoKind.SEARCHPRODUCT); //
@@ -1648,6 +1648,22 @@
"productsCh_row7_renderProductCh", EnyoKind.BUTTON); //
public static TestIdConstructor BUTTON_CHARACTERISTICS_ROW8 = new TestIdConstructor(
"productsCh_row8_renderProductCh", EnyoKind.BUTTON); //
+ public static TestIdConstructor BUTTON_CHARACTERISTICS_ROW9 = new TestIdConstructor(
+ "productsCh_row9_renderProductCh", EnyoKind.BUTTON); //
+ public static TestIdConstructor BUTTON_CHARACTERISTICS_ROW10 = new TestIdConstructor(
+ "productsCh_row10_renderProductCh", EnyoKind.BUTTON); //
+ public static TestIdConstructor BUTTON_CHARACTERISTICS_ROW11 = new TestIdConstructor(
+ "productsCh_row11_renderProductCh", EnyoKind.BUTTON); //
+ public static TestIdConstructor BUTTON_CHARACTERISTICS_ROW12 = new TestIdConstructor(
+ "productsCh_row12_renderProductCh", EnyoKind.BUTTON); //
+ public static TestIdConstructor BUTTON_CHARACTERISTICS_ROW13 = new TestIdConstructor(
+ "productsCh_row13_renderProductCh", EnyoKind.BUTTON); //
+ public static TestIdConstructor BUTTON_CHARACTERISTICS_ROW14 = new TestIdConstructor(
+ "productsCh_row14_renderProductCh", EnyoKind.BUTTON); //
+ public static TestIdConstructor BUTTON_CHARACTERISTICS_ROW15 = new TestIdConstructor(
+ "productsCh_row15_renderProductCh", EnyoKind.BUTTON); //
+ public static TestIdConstructor BUTTON_POPUP_CHARACTERISTICS_ROW1 = new TestIdConstructor(
+ "valueslistitemprinter_row1_listValuesLineCheck"); //
public static TestIdConstructor BUTTON_POPUP_CHARACTERISTICS_BACK = new TestIdConstructor(
"modalProductChTopHeader_backChButton", EnyoKind.BUTTON); //
public static TestIdConstructor BUTTON_POPUP_CHARACTERISTICS_DONE = new TestIdConstructor(
diff -r 589c15557c6b -r d6f27626d7bd src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/highvolume/I35383_EnsureNormalSearchsInProductInRemoteContinueWorking.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/highvolume/I35383_EnsureNormalSearchsInProductInRemoteContinueWorking.java Wed Mar 22 15:26:44 2017 +0100
@@ -0,0 +1,73 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo Public License
+ * Version 1.0 (the "License"), being the Mozilla Public License
+ * Version 1.1 with a permitted attribution clause; you may not use this
+ * file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo S.L.U.
+ * All portions are Copyright (C) 2017 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.highvolume;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.retail.extmodules.selenium.TestIdExtModules;
+import org.openbravo.test.mobile.retail.mobilecore.annotations.TestClassAnnotations;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+@TestClassAnnotations(isHighVolumeCompatible = true)
+public class I35383_EnsureNormalSearchsInProductInRemoteContinueWorking extends
+ WebPOSTerminalHelper {
+
+ @Test
+ public void test() {
+
+ final Boolean isProductRemote = (Boolean) SeleniumHelper
+ .executeScriptWithReturn("OB.MobileApp.model.get('permissions')['OBPOS_remote.product'];");
+ assertThat("Test must be run in High Volume mode", isProductRemote, equalTo(Boolean.TRUE));
+
+ // In this test the errors are not ignored, so if with valid searches it get an error will make
+ // the test fail
+
+ // test name search (at least 3 characters)
+ tap(TestIdPack.BUTTON_SEARCH);
+ write(TestIdPack.FIELD_SEARCH_TEXT, "ski");
+ tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+ verify(TestIdPack.LABEL_PRODUCT_ROW1, "Ski & snowboard helmet");
+
+ tap(TestIdPack.BUTTON_SEARCH_DELETE);
+
+ // test with a filter
+ verify(TestIdPack.BUTTON_CHARACTERISTICS_ROW1, "Battery Life");
+ tap(TestIdPack.BUTTON_CHARACTERISTICS_ROW1);
+ verify(TestIdPack.LABEL_CHARACTERISTICS_VALUE_ROW2, "20h");
+ tap(TestIdPack.BUTTON_CHARACTERISTICS_VALUE_ROW2);
+ tap(TestIdPack.BUTTON_POPUP_CHARACTERISTICS_DONE);
+ verify(TestIdPack.LABEL_PRODUCT_ROW1, "Digital altimeter Blue");
+
+ tap(TestIdPack.BUTTON_SEARCH_DELETE);
+
+ tap(TestIdExtModules.BUTTON_SEARCH);
+ TestIdExtModules.COMBO_PRODUCTCATEGORY.enyoNode().executeExtension(".setSelected(4)");
+ tap(TestIdExtModules.BUTTON_SEARCH_EXECUTE);
+ verify(TestIdPack.LABEL_PRODUCT_ROW1, "Avalanche transceiver");
+
+ // // go back to initial tab, so next test finds the house clean
+ tap(TestIdPack.BUTTON_SCAN);
+ }
+}
\ No newline at end of file
diff -r 589c15557c6b -r d6f27626d7bd src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/highvolume/I35383_No1CharSearchsInProductInRemote.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/highvolume/I35383_No1CharSearchsInProductInRemote.java Wed Mar 22 15:26:44 2017 +0100
@@ -0,0 +1,73 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo Public License
+ * Version 1.0 (the "License"), being the Mozilla Public License
+ * Version 1.1 with a permitted attribution clause; you may not use this
+ * file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo S.L.U.
+ * All portions are Copyright (C) 2017 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.highvolume;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.core.junit.SequentialTestInfo;
+import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.retail.mobilecore.annotations.TestClassAnnotations;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+@TestClassAnnotations(isHighVolumeCompatible = true)
+public class I35383_No1CharSearchsInProductInRemote extends WebPOSTerminalHelper {
+
+ private static final String MESSAGE_OBPOS_PRODUCT_SEARCH_TOO_BROAD = "message: OBPOS_ProductSearchTooBroad";
+
+ @Test
+ // @TestAnnotations(waitFixOf = 35383)
+ public void test() {
+
+ // ensure we are in remote
+ final Boolean isProductRemote = (Boolean) SeleniumHelper
+ .executeScriptWithReturn("OB.MobileApp.model.get('permissions')['OBPOS_remote.product'];");
+ assertThat("Test must be run in High Volume mode", isProductRemote, equalTo(Boolean.TRUE));
+
+ // To check if the message was ignored, the error is needed to add here the message.
+ // Note: still needed to add the error to AllowedErrorsHelper.java
+ SequentialTestInfo.addIgnoredJavascriptError(MESSAGE_OBPOS_PRODUCT_SEARCH_TOO_BROAD);
+
+ // check that fail with 1 char
+ tap(TestIdPack.BUTTON_SEARCH);
+ write(TestIdPack.FIELD_SEARCH_TEXT, "s");
+ try {
+ // If the search return no results it gives an exception
+ tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+ } catch (org.jboss.netty.handler.timeout.TimeoutException e) {
+ assertThat(
+ "Get different exception than expected one",
+ e.getMessage(),
+ equalTo("The 'table_products (testId = table_products)' scrollableTable has not been populated with any data"));
+ }
+
+ // All the errors of this test are ignored, checking that we have get the error message that we
+ // expect when launching a search without filters
+ boolean isErrorShown = SequentialTestInfo
+ .wasJavascriptErrorIgnored(MESSAGE_OBPOS_PRODUCT_SEARCH_TOO_BROAD);
+ assertThat("The message has not been shown", isErrorShown, equalTo(true));
+
+ // // go back to initial tab, so next test finds the house clean
+ tap(TestIdPack.BUTTON_SCAN);
+ }
+}
\ No newline at end of file
diff -r 589c15557c6b -r d6f27626d7bd src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/highvolume/I35383_No2CharSearchsInProductInRemote.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/highvolume/I35383_No2CharSearchsInProductInRemote.java Wed Mar 22 15:26:44 2017 +0100
@@ -0,0 +1,73 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo Public License
+ * Version 1.0 (the "License"), being the Mozilla Public License
+ * Version 1.1 with a permitted attribution clause; you may not use this
+ * file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo S.L.U.
+ * All portions are Copyright (C) 2017 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.highvolume;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.core.junit.SequentialTestInfo;
+import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.retail.mobilecore.annotations.TestClassAnnotations;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+@TestClassAnnotations(isHighVolumeCompatible = true)
+public class I35383_No2CharSearchsInProductInRemote extends WebPOSTerminalHelper {
+
+ private static final String MESSAGE_OBPOS_PRODUCT_SEARCH_TOO_BROAD = "message: OBPOS_ProductSearchTooBroad";
+
+ @Test
+ // @TestAnnotations(waitFixOf = 35383)
+ public void test() {
+
+ // ensure we are in remote
+ final Boolean isProductRemote = (Boolean) SeleniumHelper
+ .executeScriptWithReturn("OB.MobileApp.model.get('permissions')['OBPOS_remote.product'];");
+ assertThat("Test must be run in High Volume mode", isProductRemote, equalTo(Boolean.TRUE));
+
+ // To check if the message was ignored, the error is needed to add here the message.
+ // Note: still needed to add the error to AllowedErrorsHelper.java
+ SequentialTestInfo.addIgnoredJavascriptError(MESSAGE_OBPOS_PRODUCT_SEARCH_TOO_BROAD);
+
+ // check that fail with 2 char search
+ tap(TestIdPack.BUTTON_SEARCH);
+ write(TestIdPack.FIELD_SEARCH_TEXT, "sk");
+ try {
+ // If the search return no results it gives an exception
+ tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+ } catch (org.jboss.netty.handler.timeout.TimeoutException e) {
+ assertThat(
+ "Get different exception than expected one",
+ e.getMessage(),
+ equalTo("The 'table_products (testId = table_products)' scrollableTable has not been populated with any data"));
+ }
+
+ // All the errors of this test are ignored, checking that we have get the error message that we
+ // expect when launching a search without filters
+ boolean isErrorShown = SequentialTestInfo
+ .wasJavascriptErrorIgnored(MESSAGE_OBPOS_PRODUCT_SEARCH_TOO_BROAD);
+ assertThat("The message has not been shown", isErrorShown, equalTo(true));
+
+ // // go back to initial tab, so next test finds the house clean
+ tap(TestIdPack.BUTTON_SCAN);
+ }
+}
\ No newline at end of file
diff -r 589c15557c6b -r d6f27626d7bd src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/highvolume/I35383_NoEmptySearchsInProductInRemote.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/highvolume/I35383_NoEmptySearchsInProductInRemote.java Wed Mar 22 15:26:44 2017 +0100
@@ -0,0 +1,72 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo Public License
+ * Version 1.0 (the "License"), being the Mozilla Public License
+ * Version 1.1 with a permitted attribution clause; you may not use this
+ * file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo S.L.U.
+ * All portions are Copyright (C) 2017 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.highvolume;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.core.junit.SequentialTestInfo;
+import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.retail.mobilecore.annotations.TestClassAnnotations;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+@TestClassAnnotations(isHighVolumeCompatible = true)
+public class I35383_NoEmptySearchsInProductInRemote extends WebPOSTerminalHelper {
+
+ private static final String MESSAGE_OBPOS_PRODUCT_SEARCH_TOO_BROAD = "message: OBPOS_ProductSearchTooBroad";
+
+ @Test
+ // @TestAnnotations(waitFixOf = 35383)
+ public void test() {
+
+ // ensure we are in remote
+ final Boolean isProductRemote = (Boolean) SeleniumHelper
+ .executeScriptWithReturn("OB.MobileApp.model.get('permissions')['OBPOS_remote.product'];");
+ assertThat("Test must be run in High Volume mode", isProductRemote, equalTo(Boolean.TRUE));
+
+ // To check if the message was ignored, the error is needed to add here the message.
+ // Note: still needed to add the error to AllowedErrorsHelper.java
+ SequentialTestInfo.addIgnoredJavascriptError(MESSAGE_OBPOS_PRODUCT_SEARCH_TOO_BROAD);
+
+ // check that fail with empty search
+ tap(TestIdPack.BUTTON_SEARCH);
+ try {
+ // If the search return no results it gives an exception
+ tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+ } catch (org.jboss.netty.handler.timeout.TimeoutException e) {
+ assertThat(
+ "Get different exception than expected one",
+ e.getMessage(),
+ equalTo("The 'table_products (testId = table_products)' scrollableTable has not been populated with any data"));
+ }
+
+ // All the errors of this test are ignored, checking that we have get the error message that we
+ // expect when launching a search without filters
+ boolean isErrorShown = SequentialTestInfo
+ .wasJavascriptErrorIgnored(MESSAGE_OBPOS_PRODUCT_SEARCH_TOO_BROAD);
+ assertThat("The message has not been shown", isErrorShown, equalTo(true));
+
+ // // go back to initial tab, so next test finds the house clean
+ tap(TestIdPack.BUTTON_SCAN);
+ }
+}
\ No newline at end of file
diff -r 589c15557c6b -r d6f27626d7bd src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I32962_ReceiptCreateAssortmentAndLoaded.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I32962_ReceiptCreateAssortmentAndLoaded.java Mon Mar 20 14:11:05 2017 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I32962_ReceiptCreateAssortmentAndLoaded.java Wed Mar 22 15:26:44 2017 +0100
@@ -28,6 +28,7 @@
import java.util.UUID;
import org.junit.Test;
+import org.openbravo.test.mobile.core.junit.SequentialTestInfo;
import org.openbravo.test.mobile.retail.mobilecore.annotations.TestClassAnnotations;
import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperInsertUpdateOrDelete;
import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
@@ -52,6 +53,20 @@
logoutAndCloseBrowser();
logIn();
tap(TestIdPack.BUTTON_SEARCH);
+
+ if (SequentialTestInfo.getHighVolumenMode()) {
+ tap(TestIdPack.BUTTON_CHARACTERISTICS_ROW14);
+ } else {
+ tap(TestIdPack.BUTTON_CHARACTERISTICS_ROW7);
+ }
+ verify(TestIdPack.LABEL_CHARACTERISTICS_VALUE_ROW1,
+ "High Mountaineering & Expeditions, Hiking & Trekking");
+ verify(TestIdPack.LABEL_CHARACTERISTICS_VALUE_ROW2,
+ "High Mountaineering & Expeditions, Ski Touring");
+ tap(TestIdPack.BUTTON_CHARACTERISTICS_VALUE_ROW1);
+ tap(TestIdPack.BUTTON_CHARACTERISTICS_VALUE_ROW2);
+ tap(TestIdPack.BUTTON_POPUP_CHARACTERISTICS_DONE);
+
tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
tap(TestIdPack.BUTTON_SEARCHPRODUCT_ALPINESKIING);
verify(TestIdPack.LABEL_RECEIPT_ROW1_AMOUNT, "109.90");
relevantfilters.diff [^] (2,575 bytes) 2017-04-05 14:13 [Show Content] [Hide Content]# HG changeset patch
# User Adrián Romero <adrianromero@openbravo.com>
# Date 1491309118 -7200
# Tue Apr 04 14:31:58 2017 +0200
# Node ID a8bcdcd185ee17b1fcc81141cb66f7d58504ec79
# Parent 5119622b48fc1da0ae6a7f6028b941a4ce40ab77
[TEMP] Fixes infrastructure for mandatory remote filters
* It has been adjusted the method hasRelevantRemoteFilters to consider relevant filters all filters wut operator equal and a non empty value.
Basically now the idea is that only filters *startsWith* or *contains* with a value with length < 3 are considered non relevants. This is done to avoid for example the case of searching EAN codes equals to a value with length less than 3 to be considered non relevant
diff --git a/src/org/openbravo/mobile/core/process/ProcessHQLQuery.java b/src/org/openbravo/mobile/core/process/ProcessHQLQuery.java
--- a/src/org/openbravo/mobile/core/process/ProcessHQLQuery.java
+++ b/src/org/openbravo/mobile/core/process/ProcessHQLQuery.java
@@ -326,23 +326,25 @@
}
private boolean hasRelevantRemoteFilters(JSONArray remoteFilters) {
- boolean hasFilters = false;
try {
- for (int i = 0; i < remoteFilters.length() && !hasFilters; i++) {
- JSONObject objFilter;
- objFilter = (JSONObject) remoteFilters.get(i);
- if (objFilter.getString("value").equals("__all__")
- || ((!objFilter.has("fieldType") || !objFilter.getString("fieldType").equals("Number")) && objFilter
- .getString("value").length() < 3)) {
- continue;
+ for (int i = 0; i < remoteFilters.length(); i++) {
+ JSONObject objFilter = (JSONObject) remoteFilters.get(i);
+ // Check filter has a non empty value
+ if (!objFilter.getString("value").equals("__all__")
+ && !objFilter.getString("value").equals("")) {
+ if (!objFilter.getString("operator").equals("startsWith")
+ && !objFilter.getString("operator").equals("contains")) {
+ return true; // equals, notEquals, greaterThan and lessThan are always relevant
+ }
+ if (objFilter.getString("value").length() >= 3) {
+ return true; // for startsWith and contains, the filter is relevant if length >= 3
+ }
}
- hasFilters = true;
}
- return hasFilters;
+ return false; // No filter of the list is relevant
} catch (JSONException e) {
- throw new OBException("Unable to read remote filters");
+ throw new OBException("Unable to read remote filters.");
}
-
}
public interface StrategyQuery {
|