details: https://code.openbravo.com/erp/devel/pi/rev/eaa3c659079b changeset: 13968:eaa3c659079b user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Oct 05 10:12:58 2011 +0200 summary: fixed bug 18382, fixed bug 17526
DAL getIdentifier does not work properly with multi-level identifiers details: https://code.openbravo.com/erp/devel/pi/rev/13236c1d9619 changeset: 13969:13236c1d9619 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Oct 05 10:53:30 2011 +0200 summary: fixed bug 18698: Grid identifiers don't take seqno into account details: https://code.openbravo.com/erp/devel/pi/rev/96866849102b changeset: 13970:96866849102b user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Wed Oct 05 16:37:04 2011 +0200 summary: fixed bug 18126: quick launch does not work when there is a manual form with JS error details: https://code.openbravo.com/erp/devel/pi/rev/2b39427a921f changeset: 13971:2b39427a921f user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Mon Oct 10 11:01:22 2011 +0200 summary: Added log to alert management details: https://code.openbravo.com/erp/devel/pi/rev/e7f45dcbde11 changeset: 13972:e7f45dcbde11 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Mon Oct 10 13:08:43 2011 +0200 summary: fixed bug 18741: Alert rule filter clause not working fine in some circumstances Do not include alert rule in case it has filter clause and does not return any row for current session diffstat: modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java | 4 + modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertManagementActionHandler.java | 41 +++++++-- src/org/openbravo/base/model/Column.hbm.xml | 3 +- src/org/openbravo/base/model/Column.java | 9 ++ src/org/openbravo/base/model/Entity.java | 17 ++++ src/org/openbravo/base/model/Property.java | 11 ++ src/org/openbravo/base/structure/IdentifierProvider.java | 6 + src/org/openbravo/erpCommon/security/Login.html | 2 +- src/org/openbravo/erpCommon/security/Login_F1.html | 2 +- web/js/utils.js | 15 ++- 10 files changed, 92 insertions(+), 18 deletions(-) diffs (284 lines): diff -r 2ded609faec7 -r e7f45dcbde11 modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java Thu Oct 13 12:51:12 2011 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java Mon Oct 10 13:08:43 2011 +0200 @@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.apache.log4j.Logger; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONObject; import org.hibernate.Query; @@ -57,6 +58,7 @@ */ @ApplicationScoped public class AlertActionHandler extends BaseActionHandler { + private static final Logger log4j = Logger.getLogger(AlertActionHandler.class); /* * (non-Javadoc) @@ -106,6 +108,8 @@ .addEntity(Alert.ENTITY_NAME); sqlQuery.setParameter(0, alertRule.getId()); final DataToJsonConverter converter = new DataToJsonConverter(); + log4j.debug("Alert " + alertRule.getName() + " (" + alertRule.getId() + ") - SQL:'" + sql + + "' - Rows: " + sqlQuery.list().size()); for (Object alertObject : sqlQuery.list()) { final Alert alert = (Alert) alertObject; alertJsonObjects.add(converter.toJsonObject(alert, DataResolvingMode.FULL)); diff -r 2ded609faec7 -r e7f45dcbde11 modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertManagementActionHandler.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertManagementActionHandler.java Thu Oct 13 12:51:12 2011 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertManagementActionHandler.java Mon Oct 10 13:08:43 2011 +0200 @@ -50,6 +50,7 @@ private static final Logger log = Logger.getLogger(AlertManagementActionHandler.class); private static final String GET_ALERT_RULES = "getAlertRules"; private static final String MOVE_TO_STATUS = "moveToStatus"; + private static final Logger log4j = Logger.getLogger(AlertManagementActionHandler.class); /* * (non-Javadoc) @@ -106,14 +107,21 @@ try { if (alertRulesQuery.count() > 0) { for (AlertRule alertRule : alertRulesQuery.list()) { - JSONObject alertRuleJson = new JSONObject(); - alertRuleJson.put("name", alertRule.getIdentifier()); - alertRuleJson.put("alertRuleId", alertRule.getId()); - if (alertRule.getTab() != null) { - alertRuleJson.put("tabId", alertRule.getTab().getId()); - } else { - alertRuleJson.put("tabId", ""); + JSONObject alertRuleJson = null; + + // Adding alert rule if it has not filter clause. In case it has, it will be added only in + // case it returns data after applying the filter clause. + if (alertRule.getFilterClause() == null) { + alertRuleJson = new JSONObject(); + alertRuleJson.put("name", alertRule.getIdentifier()); + alertRuleJson.put("alertRuleId", alertRule.getId()); + if (alertRule.getTab() != null) { + alertRuleJson.put("tabId", alertRule.getTab().getId()); + } else { + alertRuleJson.put("tabId", ""); + } } + String filterClause = null; if (alertRule.getFilterClause() != null) { try { @@ -129,10 +137,23 @@ final SQLQuery sqlQuery = OBDal.getInstance().getSession().createSQLQuery(sql) .addEntity(Alert.ENTITY_NAME); sqlQuery.setParameter(0, alertRule.getId()); + + log4j.debug("Alert " + alertRule.getName() + " (" + alertRule.getId() + ") - SQL:'" + + sql + "' - Rows: " + sqlQuery.list().size()); // It is not possible to add an SQL filter clause to the grid's default datasource. // A String with the alert_id's to filter the grid's so only alerts with access are // shown. if (sqlQuery.list().size() > 0) { + // Alert rule returns data, adding it to list of alert rules. + alertRuleJson = new JSONObject(); + alertRuleJson.put("name", alertRule.getIdentifier()); + alertRuleJson.put("alertRuleId", alertRule.getId()); + if (alertRule.getTab() != null) { + alertRuleJson.put("tabId", alertRule.getTab().getId()); + } else { + alertRuleJson.put("tabId", ""); + } + String filterAlerts = ""; @SuppressWarnings("unchecked") List<Alert> alerts = sqlQuery.list(); @@ -143,10 +164,12 @@ filterAlerts += "'" + alert.getId() + "'"; } alertRuleJson.put("alerts", filterAlerts); + } } - - alertRules.put(alertRuleJson); + if (alertRuleJson != null) { + alertRules.put(alertRuleJson); + } } } } catch (JSONException e) { diff -r 2ded609faec7 -r e7f45dcbde11 src/org/openbravo/base/model/Column.hbm.xml --- a/src/org/openbravo/base/model/Column.hbm.xml Thu Oct 13 12:51:12 2011 +0200 +++ b/src/org/openbravo/base/model/Column.hbm.xml Mon Oct 10 13:08:43 2011 +0200 @@ -46,7 +46,8 @@ <property name="valueMax"/> <property name="developmentStatus"/> <property name="position"/> - + <property name="seqno"/> + <many-to-one name="table" not-null="true" class="org.openbravo.base.model.Table" column="ad_table_id"/> <many-to-one name="reference" not-null="true" class="org.openbravo.base.model.Reference" column="ad_reference_id"/> diff -r 2ded609faec7 -r e7f45dcbde11 src/org/openbravo/base/model/Column.java --- a/src/org/openbravo/base/model/Column.java Thu Oct 13 12:51:12 2011 +0200 +++ b/src/org/openbravo/base/model/Column.java Mon Oct 10 13:08:43 2011 +0200 @@ -67,6 +67,7 @@ private String isTransientCondition; private Integer position; private boolean translatable; + private Integer seqno; private Module module; @@ -454,4 +455,12 @@ public void setStoredInSession(boolean storedInSession) { this.storedInSession = storedInSession; } + + public Integer getSeqno() { + return seqno; + } + + public void setSeqno(Integer seqno) { + this.seqno = seqno; + } } diff -r 2ded609faec7 -r e7f45dcbde11 src/org/openbravo/base/model/Entity.java --- a/src/org/openbravo/base/model/Entity.java Thu Oct 13 12:51:12 2011 +0200 +++ b/src/org/openbravo/base/model/Entity.java Mon Oct 10 13:08:43 2011 +0200 @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -152,6 +153,22 @@ orderByProperties.add(p); } + Collections.sort(identifierProperties, new Comparator<Property>() { + public int compare(Property p1, Property p2) { + if (p1.getSeqno() == null && p2.getSeqno() == null) { + return 0; + } + if (p1.getSeqno() == null) { + return 1; + } + if (p2.getSeqno() == null) { + return -1; + } + + return p1.getSeqno().compareTo(p2.getSeqno()); + } + }); + entityValidator = new EntityValidator(); entityValidator.setEntity(this); entityValidator.initialize(); diff -r 2ded609faec7 -r e7f45dcbde11 src/org/openbravo/base/model/Property.java --- a/src/org/openbravo/base/model/Property.java Thu Oct 13 12:51:12 2011 +0200 +++ b/src/org/openbravo/base/model/Property.java Mon Oct 10 13:08:43 2011 +0200 @@ -116,6 +116,8 @@ private Property trlParentProperty; private Property trlOneToManyProperty; + private Integer seqno; + /** * Initializes this Property using the information from the Column. * @@ -130,6 +132,7 @@ setColumnName(fromColumn.getColumnName()); setNameOfColumn(fromColumn.getName()); setColumnId(fromColumn.getId()); + setSeqno(fromColumn.getSeqno()); setStoredInSession(fromColumn.isStoredInSession()); @@ -1229,4 +1232,12 @@ public void setStoredInSession(boolean storedInSession) { this.storedInSession = storedInSession; } + + public Integer getSeqno() { + return seqno; + } + + public void setSeqno(Integer seqno) { + this.seqno = seqno; + } } diff -r 2ded609faec7 -r e7f45dcbde11 src/org/openbravo/base/structure/IdentifierProvider.java --- a/src/org/openbravo/base/structure/IdentifierProvider.java Thu Oct 13 12:51:12 2011 +0200 +++ b/src/org/openbravo/base/structure/IdentifierProvider.java Mon Oct 10 13:08:43 2011 +0200 @@ -117,6 +117,12 @@ property = displayColumnProperty; } else if (property.isTranslatable()) { value = ((BaseOBObject) dob).get(identifier.getName(), language); + } else if (!property.isPrimitive() && identifyDeep) { + if (dob.get(property.getName()) != null) { + value = ((BaseOBObject) dob.get(property.getName())).getIdentifier(); + } else { + value = ""; + } } else { value = dob.get(identifier.getName()); } diff -r 2ded609faec7 -r e7f45dcbde11 src/org/openbravo/erpCommon/security/Login.html --- a/src/org/openbravo/erpCommon/security/Login.html Thu Oct 13 12:51:12 2011 +0200 +++ b/src/org/openbravo/erpCommon/security/Login.html Mon Oct 10 13:08:43 2011 +0200 @@ -388,7 +388,7 @@ } catch (e) { } - if ((!revisionControl('11667')) || (isOpsInstance() != isOpsInstanceCached())) { + if ((!revisionControl('11668')) || (isOpsInstance() != isOpsInstanceCached())) { maskLoginWindow(cacheMsg); setLoginMessage('Warning', '', cacheMsg); } diff -r 2ded609faec7 -r e7f45dcbde11 src/org/openbravo/erpCommon/security/Login_F1.html --- a/src/org/openbravo/erpCommon/security/Login_F1.html Thu Oct 13 12:51:12 2011 +0200 +++ b/src/org/openbravo/erpCommon/security/Login_F1.html Mon Oct 10 13:08:43 2011 +0200 @@ -126,7 +126,7 @@ clearForm(); } catch (e) {} setWindowElementFocus('firstElement'); - if ((!revisionControl('11667')) || (isOpsInstance() != isOpsInstanceCached())) { + if ((!revisionControl('11668')) || (isOpsInstance() != isOpsInstanceCached())) { alert(cacheMsg); } diff -r 2ded609faec7 -r e7f45dcbde11 web/js/utils.js --- a/web/js/utils.js Thu Oct 13 12:51:12 2011 +0200 +++ b/web/js/utils.js Mon Oct 10 13:08:43 2011 +0200 @@ -95,7 +95,7 @@ * Return a number that would be checked at the Login screen to know if the file is cached with the correct version */ function getCurrentRevision() { - var number = '11667'; + var number = '11668'; return number; } @@ -1634,12 +1634,15 @@ * Put the focus on the Window frame */ function putFocusOnWindow() { - parent.frameMenu.onBlurMenu(); - parent.appFrame.selectedArea = 'window' - parent.appFrame.focus(); - parent.appFrame.setWindowElementFocus(parent.appFrame.focusedWindowElement); + try { + parent.frameMenu.onBlurMenu(); + parent.appFrame.selectedArea = 'window' + parent.appFrame.focus(); + parent.appFrame.setWindowElementFocus(parent.appFrame.focusedWindowElement); + } catch (e) { + console.log(e); + } return true; - //parent.appFrame.focus(); } /** ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
