details: https://code.openbravo.com/erp/devel/pi/rev/156cf2dff878 changeset: 14209:156cf2dff878 user: Martin Taal <martin.taal <at> openbravo.com> date: Tue Nov 08 13:11:07 2011 +0100 summary: Fixes issue 19013: Filter on Account Schema Tables is not working okay
details: https://code.openbravo.com/erp/devel/pi/rev/1816a1d26f54 changeset: 14210:1816a1d26f54 user: Martin Taal <martin.taal <at> openbravo.com> date: Tue Nov 08 13:25:13 2011 +0100 summary: Fixes issue 18667: Provide a reset-to-defaults for Personalized Forms details: https://code.openbravo.com/erp/devel/pi/rev/c44410324eb7 changeset: 14211:c44410324eb7 user: Martin Taal <martin.taal <at> openbravo.com> date: Tue Nov 08 15:28:58 2011 +0100 summary: Fixes issue 19017: Wrong toolbar buttons are displayed and having unsaved changed to a previously saved record. diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js | 3 + modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js | 2 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js | 9 +- modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java | 57 ++++++++- 4 files changed, 58 insertions(+), 13 deletions(-) diffs (138 lines): diff -r a5cfc47000ab -r c44410324eb7 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js Tue Nov 08 03:54:05 2011 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js Tue Nov 08 15:28:58 2011 +0100 @@ -138,6 +138,9 @@ this.getClass().originalView.viewDefinition = OB.Personalization.getViewDefinition(this, '', false); this.getClass().originalView.viewDefinition.name = OB.I18N.getLabel('OBUIAPP_StandardView'); this.getClass().originalView.canDelete = false; + + // and clone the original view so that it can't get updated accidentally + this.getClass().originalView = isc.clone(this.getClass().originalView); } this.getClass().personalization = personalization; diff -r a5cfc47000ab -r c44410324eb7 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js Tue Nov 08 03:54:05 2011 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js Tue Nov 08 15:28:58 2011 +0100 @@ -550,7 +550,7 @@ restoreButtonProperties = { action: function() { var i, standardWindow = this.view.getStandardWindow(), - viewDefinitions = standardWindow.getClass().originalView, + viewDefinitions = standardWindow.getClass().originalView.viewDefinition, length = standardWindow.views.length, view, viewTabDefinition; for (i = 0; i < length; i++) { view = standardWindow.views[i]; diff -r a5cfc47000ab -r c44410324eb7 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js Tue Nov 08 03:54:05 2011 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js Tue Nov 08 15:28:58 2011 +0100 @@ -1175,10 +1175,11 @@ hideShowRightMembers: function(show) { var i; - for (i = 0; i < this.rightMembers.length; i++) { - if (show) { - this.rightMembers[i].show(); - } else { + // if showing make sure that they are not always shown + if (show) { + this.refreshCustomButtons(false); + } else { + for (i = 0; i < this.rightMembers.length; i++) { this.rightMembers[i].hide(); } } diff -r a5cfc47000ab -r c44410324eb7 modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java --- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java Tue Nov 08 03:54:05 2011 +0100 +++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java Tue Nov 08 15:28:58 2011 +0100 @@ -36,12 +36,17 @@ import org.openbravo.base.model.ModelProvider; import org.openbravo.base.model.Property; import org.openbravo.base.model.domaintype.SearchDomainType; +import org.openbravo.base.model.domaintype.TableDomainType; import org.openbravo.base.structure.IdentifierProvider; import org.openbravo.base.util.Check; import org.openbravo.client.kernel.RequestContext; import org.openbravo.dal.core.DalUtil; import org.openbravo.dal.core.OBContext; +import org.openbravo.dal.service.OBDal; import org.openbravo.erpCommon.utility.Utility; +import org.openbravo.model.ad.datamodel.Table; +import org.openbravo.model.ad.domain.Reference; +import org.openbravo.model.ad.domain.ReferencedTable; import org.openbravo.service.db.DalConnectionProvider; /** @@ -398,13 +403,49 @@ private String buildFieldClause(List<Property> properties, Property property, String fieldName, String operator) { + // special cases: + // TableDomainType + // TableDirDomainType + + // handle a special case the table reference which shows a tablename in a combo + // or uses the display column to display that in the grid + Property useProperty = property; + String useFieldName = fieldName; + if (properties.size() >= 2) { + final Property refProperty = properties.get(properties.size() - 2); + if (refProperty.getDomainType() instanceof TableDomainType) { + // special case table reference itself + final boolean isTable = property.getEntity() == ModelProvider.getInstance().getEntity( + Table.ENTITY_NAME); + if (isTable) { + useProperty = property.getEntity().getProperty(Table.PROPERTY_NAME); + final int index = fieldName.indexOf("."); + useFieldName = fieldName.substring(0, index + 1) + useProperty.getName(); + } else { + // read the reference to get the table reference + final Reference reference = OBDal.getInstance().get(Reference.class, + refProperty.getDomainType().getReference().getId()); + for (ReferencedTable referencedTable : reference.getADReferencedTableList()) { + if (referencedTable.isActive() && referencedTable.getDisplayedColumn() != null + && referencedTable.getDisplayedColumn().isActive()) { + useProperty = property.getEntity().getPropertyByColumnName( + referencedTable.getDisplayedColumn().getDBColumnName()); + final int index = fieldName.indexOf("."); + useFieldName = fieldName.substring(0, index + 1) + useProperty.getName(); + break; + } + } + } + } + } + String clause = null; if (orNesting > 0) { - clause = resolveJoins(properties, fieldName); + clause = resolveJoins(properties, useFieldName); } else if (getMainAlias() != null) { - clause = getMainAlias() + "." + fieldName.trim(); + clause = getMainAlias() + "." + useFieldName.trim(); } else { - clause = fieldName; + clause = useFieldName; } // get rid of the identifier and replace it with the real property name @@ -412,14 +453,14 @@ // NOTE: the if and else check against the key variable and not the leftwherepart // because the key contains the original string (with the _identifier part). // Within the if the leftWherePart is used because it contains the join aliases - if (fieldName.equals(JsonConstants.IDENTIFIER) - || fieldName.endsWith("." + JsonConstants.IDENTIFIER)) { - clause = computeLeftWhereClauseForIdentifier(property, fieldName, clause); - } else if (!property.isPrimitive()) { + if (useFieldName.equals(JsonConstants.IDENTIFIER) + || useFieldName.endsWith("." + JsonConstants.IDENTIFIER)) { + clause = computeLeftWhereClauseForIdentifier(useProperty, useFieldName, clause); + } else if (!useProperty.isPrimitive()) { clause = clause + ".id"; } - if (ignoreCase(property, operator)) { + if (ignoreCase(useProperty, operator)) { clause = "upper(" + clause + ")"; } return clause; ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
