Openbravo Issue Tracking System - Retail Modules
View Issue Details
0034431Retail ModulesWeb POSpublic2016-11-08 17:042016-11-22 18:48
guillermogil 
ranjith_qualiantech_com 
highmajoralways
closedfixed 
5
 
RR17Q1 
marvintm
No
0034431: If a module add some properties with QueryTerminalProperty if it does not return anything you cannot login on WebPOS
If a module add some properties with QueryTerminalProperty if it does not return anything you cannot login on WebPOS.
If it returns some value it works perfectly.
Create a module with the following code:

import java.util.Arrays;
import java.util.List;

import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.openbravo.retail.posterminal.term.QueryTerminalProperty;

public class NewTerminalProperties extends QueryTerminalProperty {

  @Override
  protected boolean isAdminMode() {
    return true;
  }

  @Override
  protected List<String> getQuery(JSONObject jsonsent) throws JSONException {
    return Arrays.asList(new String[] { "QUERY" });
  }

  @Override
  public String getProperty() {
    return "decriConfiguration";
  }

  @Override
  public boolean returnList() {
    return true;
  }
}


Add the query desired that will not return anything.
Login on WebPOS
On Terminal.java

        if (queryterminal.returnList()) {
          queryaux.put(queryterminal.getProperty(), new JSONArray(new JSONTokener(new JSONObject(
              "{" + queryWriter.toString() + "}").get("data").toString())).get(0));
        } else {
          queryaux.put(queryterminal.getProperty(), new JSONArray(new JSONTokener(new JSONObject(
              "{" + queryWriter.toString() + "}").get("data").toString())));
        }

On the case it is returnList = true it should review if there are some values. If not, return null.
No tags attached.
Issue History
2016-11-08 17:04guillermogilNew Issue
2016-11-08 17:04guillermogilAssigned To => Retail
2016-11-08 17:04guillermogilResolution time => 1480374000
2016-11-08 17:04guillermogilTriggers an Emergency Pack => No
2016-11-09 05:59ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2016-11-09 05:59ranjith_qualiantech_comStatusnew => scheduled
2016-11-10 05:40hgbotCheckin
2016-11-10 05:40hgbotNote Added: 0091302
2016-11-10 05:40hgbotStatusscheduled => resolved
2016-11-10 05:40hgbotResolutionopen => fixed
2016-11-10 05:40hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/1ff9ed660a1049be828b3f9b966d4d7e7a5a6358 [^]
2016-11-11 17:02guilleaerReview Assigned To => guilleaer
2016-11-11 17:02guilleaerStatusresolved => closed
2016-11-11 17:02guilleaerFixed in Version => RR17Q1
2016-11-15 09:16marvintmNote Added: 0091526
2016-11-15 09:16marvintmStatusclosed => new
2016-11-15 09:16marvintmResolutionfixed => open
2016-11-15 09:16marvintmFixed in VersionRR17Q1 =>
2016-11-15 10:35ranjith_qualiantech_comStatusnew => scheduled
2016-11-15 13:49hgbotCheckin
2016-11-15 13:49hgbotNote Added: 0091557
2016-11-15 13:49hgbotStatusscheduled => resolved
2016-11-15 13:49hgbotResolutionopen => fixed
2016-11-15 13:49hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/1ff9ed660a1049be828b3f9b966d4d7e7a5a6358 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/6f8a89f152b1ac1abbb090befc1e21d2a9df5db1 [^]
2016-11-22 18:48marvintmReview Assigned Toguilleaer => marvintm
2016-11-22 18:48marvintmStatusresolved => closed
2016-11-22 18:48marvintmFixed in Version => RR17Q1

Notes
(0091302)
hgbot   
2016-11-10 05:40   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 1ff9ed660a1049be828b3f9b966d4d7e7a5a6358
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Thu Nov 10 10:10:00 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/1ff9ed660a1049be828b3f9b966d4d7e7a5a6358 [^]

Fixes issue 34431 : Updated QueryTerminal Property validation

* Return terminal property as null, if no data is returned in the query

---
M src/org/openbravo/retail/posterminal/term/Terminal.java
---
(0091526)
marvintm   
2016-11-15 09:16   
There is currently a problem with the solution of this issue. The idea behind the fix is correct, but the code is no longer checking the queryterminal.returnList() value. It should check it and in the case of it returning false, it should return an empty array instead of a null object.
(0091557)
hgbot   
2016-11-15 13:49   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 6f8a89f152b1ac1abbb090befc1e21d2a9df5db1
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Tue Nov 15 16:22:57 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/6f8a89f152b1ac1abbb090befc1e21d2a9df5db1 [^]

Fixes issue 34431 : Updated QueryTerminal Property validation

* Return data if the returnList is false
* Return null if the returnList is true and data length is 0

---
M src/org/openbravo/retail/posterminal/term/Terminal.java
---