details: https://code.openbravo.com/erp/devel/main/rev/ce708237830a changeset: 22824:ce708237830a user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Thu Apr 10 18:41:31 2014 +0200 summary: Related to issue 26231: getParentRecord returns the proper record
The getParentRecord was returning the record selected in the standard grid view of the parent tab, even if it was showing the tree view grid. This resulted in that if the subtab had only one record, the tab display logic was not working properly. details: https://code.openbravo.com/erp/devel/main/rev/5ff2e1d25729 changeset: 22825:5ff2e1d25729 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Tue Apr 15 13:34:54 2014 +0200 summary: Fixes issue 26231: Fixes bug that provoked a js error before calling the FIC details: https://code.openbravo.com/erp/devel/main/rev/fe61ebd979af changeset: 22826:fe61ebd979af user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Tue Apr 15 18:59:23 2014 +0200 summary: Related to issue 26228: Date and datetime fields are shown properly in treeview If a date or datetime field was shown in the tree grid view, the record was shown properly. But if then the record was opened in form view, the value of its date and datetime fields was being deleted. details: https://code.openbravo.com/erp/devel/main/rev/eb17076f846a changeset: 22827:eb17076f846a user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Wed Apr 16 12:18:32 2014 +0200 summary: Fixes issue 26228: Includes missing change done in ob-smartclient.js Without the missing text the transformData of ob-tree.js was not being called, and the dates were not being shown properly in the tree grid view. Also includes change done in ob-tree-grid to fix the js spacing. details: https://code.openbravo.com/erp/devel/main/rev/816854ac29a1 changeset: 22828:816854ac29a1 user: Atul Gaware <atul.gaware <at> openbravo.com> date: Wed Apr 16 14:54:15 2014 +0530 summary: Fixes Issue 26288, Fixes Issue 26070: Initial Organization Setup process failed details: https://code.openbravo.com/erp/devel/main/rev/3d398ecc35d2 changeset: 22829:3d398ecc35d2 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Wed Apr 16 15:11:44 2014 +0200 summary: Fixes issue 26308: Product Characteristics tree is not working properly The problem was that the Product Characteristics TreeType ('CH') had been added to the wrong table. It should have been added to the table used in the Value subtab of the Product Characteristic window, but it had been added to the header tab. details: https://code.openbravo.com/erp/devel/main/rev/21c21de1258a changeset: 22830:21c21de1258a user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Thu Apr 24 14:03:37 2014 +0200 summary: Fixes issue 26308: Product Characteristics tree is not working properly The previous fix worked only if the product characteristic tree was already created. The product characteristic tree is created when the first product characteristic is defined. The tree was being created without ad_table_id, and this column was not being set properly until the modulescripts are executed. This has been fixed by providing the proper ad_table_id in the tree creation. details: https://code.openbravo.com/erp/devel/main/rev/0e9e87d1da1c changeset: 22831:0e9e87d1da1c user: David Baz Fayos <david.baz <at> openbravo.com> date: Thu Apr 17 01:22:39 2014 +0200 summary: [absref] Fixed issue 26287: Abs DateTime now display always the same value whether the field be shown in grid view or not details: https://code.openbravo.com/erp/devel/main/rev/3d7fbc1cdc08 changeset: 22832:3d7fbc1cdc08 user: David Baz Fayos <david.baz <at> openbravo.com> date: Mon Apr 14 17:13:43 2014 +0200 summary: Fixed issue 26273: Absolute DateTime picker now shows the proper date value details: https://code.openbravo.com/erp/devel/main/rev/40ccdb338831 changeset: 22833:40ccdb338831 user: David Baz Fayos <david.baz <at> openbravo.com> date: Mon Apr 14 14:38:22 2014 +0200 summary: Fixed issue 26243: The time inserted in abs time field is not changed anymore if the input lose the focus when the current DST is different than 1-1-1970 details: https://code.openbravo.com/erp/devel/main/rev/cfa592a901b0 changeset: 22834:cfa592a901b0 user: David Baz Fayos <david.baz <at> openbravo.com> date: Mon Apr 21 15:19:02 2014 +0200 summary: Fixed issue 26316: Status bar fields are shown again in saved views Related to issue 24705: 'getPersonalizationDataFromForm' now takes into account existing form fields details: https://code.openbravo.com/erp/devel/main/rev/43b1fb2c6cef changeset: 22835:43b1fb2c6cef user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Tue Apr 22 09:22:32 2014 +0200 summary: fixed bug 26317: cannot filter by properties not in main entity Adding complete path to filtered property, so it works even it is not a direct property of the main entity but it is reached through a path details: https://code.openbravo.com/erp/devel/main/rev/67e9d9baa0b4 changeset: 22836:67e9d9baa0b4 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Thu Apr 24 10:06:42 2014 +0200 summary: Fixes issue 26355: Date fields are not displayed properly in the tree grid view The problem was that the fix done to fix the issue [1] was only being applied to root nodes, so the date fields were still not being displayed properly for non root nodes. [1] https://issues.openbravo.com/view.php?id=26228 diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js | 21 +++++-- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js | 8 ++- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js | 5 ++ modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-grid.js | 24 ++++++++++ modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-view-grid.js | 2 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js | 16 +++++- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js | 12 ++++- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization.js | 7 ++- modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java | 9 ++- modules/org.openbravo.service.json/src/org/openbravo/service/json/DataEntityQueryService.java | 12 ++++- modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java | 8 ++- modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js | 6 ++ src-db/database/model/triggers/C_ACCTSCHEMA_ELEMENT_TRG.xml | 6 +- src-db/database/model/triggers/M_CHARACTERISTIC_TRG.xml | 4 +- src-db/database/sourcedata/AD_TABLE.xml | 2 +- 15 files changed, 115 insertions(+), 27 deletions(-) diffs (truncated from 378 to 300 lines): diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js Thu Apr 24 10:06:42 2014 +0200 @@ -328,20 +328,27 @@ }, getPickerData: function () { - var date = this.getValue(); + var date = this.getValue(), + utcDate, utcMonth, utcFullYear, utcHours, utcMinutes, utcSeconds; // To visualize in the calendar the displayed value instead of internal value, since due to the GMT difference it can be in a different day if (this.isAbsoluteDateTime && isc.isA.Date(date)) { + utcDate = date.getUTCDate(); + utcMonth = date.getUTCMonth(); + utcFullYear = date.getUTCFullYear(); + utcHours = date.getUTCHours(); + utcMinutes = date.getUTCMinutes(); + utcSeconds = date.getUTCSeconds(); // Set the month initially to January to prevent error like this // provided date: 15/02/2014 // today: 31/03/2014 // date.setDate(today.getDate()) would result in Mon Mar 02 2014 18:00:00 GMT+0100 (CET), because February does not have 31 days date.setMonth(0); - date.setDate(date.getUTCDate()); - date.setMonth(date.getUTCMonth()); - date.setFullYear(date.getUTCFullYear()); - date.setHours(date.getUTCHours()); - date.setMinutes(date.getUTCMinutes()); - date.setSeconds(date.getUTCSeconds()); + date.setDate(utcDate); + date.setMonth(utcMonth); + date.setFullYear(utcFullYear); + date.setHours(utcHours); + date.setMinutes(utcMinutes); + date.setSeconds(utcSeconds); } if (isc.isA.Date(date)) { return date; diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js Thu Apr 24 10:06:42 2014 +0200 @@ -93,14 +93,20 @@ value = isc.Time.parseInput(value); } if (value && isc.isA.Date(value)) { + if (this.isAbsoluteTime) { + value = OB.Utilities.Date.addTimezoneOffset(value); + } this.setTodaysDate(value); + if (this.isAbsoluteTime) { + value = OB.Utilities.Date.substractTimezoneOffset(value); + } } return this.Super('setValue', arguments); }, getValue: function () { var value = this.Super('getValue', arguments); - if (value && isc.isA.Date(value)) { + if (value && isc.isA.Date(value) && !this.isAbsoluteTime) { this.setTodaysDate(value); } return value; diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Thu Apr 24 10:06:42 2014 +0200 @@ -1036,6 +1036,11 @@ } } else if (isAbsoluteDateTime) { jsDateTime = isc.Date.parseStandardDate(columnValue.value); + // In the case of an absolute datetime, it needs to be converted in order to avoid the UTC conversion + // http://forums.smartclient.com/showthread.php?p=116135 + if (Object.prototype.toString.call(jsDateTime) === '[object Date]') { + jsDateTime = OB.Utilities.Date.substractTimezoneOffset(jsDateTime); + } this.setItemValue(field.name, jsDateTime); if (field.textField) { delete field.textField._textChanged; diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-grid.js Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-grid.js Thu Apr 24 10:06:42 2014 +0200 @@ -148,5 +148,29 @@ value = Date.parseSchemaDate(value); } return this.Super('applyCellTypeFormatters', [value, record, field, rowNum, colNum, isMultipleElement]); + }, + + + // converts the date and datetime fields from string to a js date + transformData: function (data) { + var dateFields = [], + fieldName, i, j, type, record; + for (i = 0; i < this.getFields().length; i++) { + type = isc.SimpleType.getType(this.getFields()[i].type); + if (type.inheritsFrom === 'date' || type.inheritsFrom === 'datetime') { + dateFields.add(this.getFields()[i].name); + } + } + if (dateFields.length > 0) { + for (i = 0; i < data.length; i++) { + record = data[i]; + for (j = 0; j < dateFields.length; j++) { + fieldName = dateFields[j]; + if (!isc.isA.Date(record[fieldName]) && isc.isA.Date(isc.Date.parseSchemaDate(record[fieldName]))) { + record[fieldName] = isc.Date.parseSchemaDate(record[fieldName]); + } + } + } + } } }); \ No newline at end of file diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-view-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-view-grid.js Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-view-grid.js Thu Apr 24 10:06:42 2014 +0200 @@ -383,7 +383,7 @@ var selectedRecordId = this.getSelectedRecord() ? this.getSelectedRecord().id : null, length, tabViewPane, i; this.view.updateSubtabVisibility(); - this.toolBar.updateButtonState(); + this.view.toolBar.updateButtonState(); // refresh the tabs if (this.view.childTabSet) { length = this.view.childTabSet.tabs.length; diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js Thu Apr 24 10:06:42 2014 +0200 @@ -1527,6 +1527,7 @@ }, getParentRecord: function () { + var grid = null; if (!this.parentView || !this.parentView.viewGrid.getSelectedRecords() || this.parentView.viewGrid.getSelectedRecords().length !== 1) { return null; } @@ -1535,8 +1536,12 @@ if (this.parentView.viewGrid.getSelectedRecord()._new) { return null; } - - return this.parentView.viewGrid.getSelectedRecord(); + if (this.parentView.isShowingTree) { + grid = this.parentView.treeGrid; + } else { + grid = this.parentView.viewGrid; + } + return grid.getSelectedRecord(); }, updateTabTitle: function () { @@ -2229,6 +2234,13 @@ propertyObj = properties[i]; value = record[propertyObj.property]; field = component.getField(propertyObj.property); + if (field && field.editorType // + && Object.prototype.toString.call(value) === '[object Date]' // + && new Function('return isc.' + field.editorType + '.getPrototype().isAbsoluteDateTime')()) { // + // In the case of an absolute datetime, it needs to be converted in order to avoid the UTC conversion + // http://forums.smartclient.com/showthread.php?p=116135 + value = OB.Utilities.Date.addTimezoneOffset(value); + } addProperty = propertyObj.sessionProperty || !onlySessionProperties; if (addProperty) { if (classicMode) { diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js Thu Apr 24 10:06:42 2014 +0200 @@ -190,7 +190,7 @@ // view state is stored in the standardWindow.getClass().personalization object. OB.Personalization.getViewDefinition = function (standardWindow, name, isDefault) { var view, persDataByTab, personalizationData = {}, - i, formData, length = standardWindow.views.length; + i, formFields, formData, length = standardWindow.views.length; // retrieve the viewstate from the server for (i = 0; i < length; i++) { @@ -198,7 +198,15 @@ view = standardWindow.views[i]; // get the form personalization information - formData = OB.Personalization.getPersonalizationDataFromForm(view.viewForm); + if (!view.viewForm.getDataSource()) { + // If the datasource is not yet set, view.viewForm.fields it is not set yet. + // Get them directly form the view definition. + formFields = view.formFields; + } else { + formFields = null; + } + + formData = OB.Personalization.getPersonalizationDataFromForm(view.viewForm, formFields); persDataByTab.form = formData.form; if (view.isShowingTree) { diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization.js Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization.js Thu Apr 24 10:06:42 2014 +0200 @@ -39,9 +39,12 @@ // If an existing personalization data is passed in then that one is // used as the basis. This can be used to make sure that the // personalizationData used is up-to-date with the current form fields. -OB.Personalization.getPersonalizationDataFromForm = function (form) { +OB.Personalization.getPersonalizationDataFromForm = function (form, formFields) { var i, dataFields = [], statusBarFields, length, record, origPersonalizationData = form && form.view ? form.view.getFormPersonalization(true) : null; + if (typeof formFields === 'undefined' || formFields === null) { + formFields = form.getFields(); + } // just use the personalization data which was used on the // form, we can not reconstruct it completely from the form fields @@ -65,7 +68,7 @@ // update with the form data, new fields may have been added, titles // may have changed etc. // the content of dataFields will be updated - this.updatePersonalizationDataFromFields(dataFields, form.getFields(), statusBarFields || form.statusBarFields); + this.updatePersonalizationDataFromFields(dataFields, formFields, statusBarFields || form.statusBarFields); // set the first focus field if (form.firstFocusedField) { diff -r 2244ca099532 -r 67e9d9baa0b4 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 Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java Thu Apr 24 10:06:42 2014 +0200 @@ -152,6 +152,7 @@ private List<String> additionalProperties = new ArrayList<String>(); private Entity subEntity; private Property distinctProperty; + private String distinctPropertyPath; private DataEntityQueryService subDataEntityQueryService; private int aliasOffset = 0; @@ -228,8 +229,9 @@ } whereClause += StringUtils.isEmpty(whereClause.trim()) ? "where" : "and"; whereClause += " exists (select 1 from " + subEntity.getName() + " " - + subEntityQueryBuilder.getJoinClause() + subentityWhere + "e." + distinctPropName - + " = " + mainAlias + subEntityClientOrg + ") "; + + subEntityQueryBuilder.getJoinClause() + subentityWhere + "e." + + distinctPropertyPath.replace(DalUtil.FIELDSEPARATOR, DalUtil.DOT) + " = " + mainAlias + + subEntityClientOrg + ") "; typedParameters.addAll(subEntityQueryBuilder.typedParameters); } @@ -1692,6 +1694,9 @@ public void setDistinctProperty(Property distinctProperty) { this.distinctProperty = distinctProperty; + } + void setDistinctPropertyPath(String distinctPropertyPath) { + this.distinctPropertyPath = distinctPropertyPath; } } diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.service.json/src/org/openbravo/service/json/DataEntityQueryService.java --- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataEntityQueryService.java Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataEntityQueryService.java Thu Apr 24 10:06:42 2014 +0200 @@ -365,11 +365,19 @@ * only organizations with that criteria will be shown * </ul> */ - public void setSubEntity(String subEntityName, DataEntityQueryService dataEntityQueryService, - Property distinctProperty) { + void setSubEntity(String subEntityName, DataEntityQueryService dataEntityQueryService, + Property distinctProperty, String distinctPropertyPath) { queryBuilder.setSubEntityName(subEntityName); queryBuilder.setSubDataEntityQueryService(dataEntityQueryService); queryBuilder.setDistinctProperty(distinctProperty); + queryBuilder.setDistinctPropertyPath(distinctPropertyPath); + } + + @Deprecated + public void setSubEntity(String subEntityName, DataEntityQueryService dataEntityQueryService, + Property distinctProperty) { + setSubEntity(subEntityName, dataEntityQueryService, distinctProperty, + distinctProperty.getName()); } } diff -r 2244ca099532 -r 67e9d9baa0b4 modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java --- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java Mon Apr 14 14:12:57 2014 +0200 +++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java Thu Apr 24 10:06:42 2014 +0200 @@ -285,8 +285,9 @@ // this is the main entity of a 'contains' (used in FK drop down lists), it will create also // info for subentity + final String distinctPropertyPath = parameters.get(JsonConstants.DISTINCT_PARAMETER); final Property distinctProperty = DalUtil.getPropertyFromPath(ModelProvider.getInstance() - .getEntity(entityName), parameters.get(JsonConstants.DISTINCT_PARAMETER)); + .getEntity(entityName), distinctPropertyPath); final Entity distinctEntity = distinctProperty.getTargetEntity(); // criteria needs to be split in two parts: @@ -301,7 +302,7 @@ try { JSONObject jsonCriterion = new JSONObject(criterion); if (jsonCriterion.getString("fieldName").equals( - distinctProperty.getName() + "$" + JsonConstants.IDENTIFIER)) { + distinctPropertyPath + "$" + JsonConstants.IDENTIFIER)) { jsonCriterion.put("fieldName", JsonConstants.IDENTIFIER); baseCriteria = jsonCriterion.toString(); } else { ------------------------------------------------------------------------------ Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
