diff --git a/debian/changelog b/debian/changelog index 9eb9e1f9..66f78051 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.407.81) stable; urgency=low +hedera-web (1.407.82) stable; urgency=low * Initial Release. diff --git a/forms/ecomerce/checkout/checkout.js b/forms/ecomerce/checkout/checkout.js index 386d0eb1..b20e6ad9 100644 --- a/forms/ecomerce/checkout/checkout.js +++ b/forms/ecomerce/checkout/checkout.js @@ -11,20 +11,20 @@ Hedera.Checkout = new Class({ }, onValuesReady: function() { - var orderForm = this.$.orderForm; - var defaultsForm = this.$.defaults; + const orderForm = this.$.orderForm; + const defaultsForm = this.$.defaults; if (!(orderForm.ready && defaultsForm.ready)) return; - var date; - const row = orderForm.$ || defaultsForm.$; + let date; + const row = orderForm.$ || defaultsForm.$ || {}; if (!date || date.getTime() < (new Date()).getTime()) { date = new Date(); date.setHours(0, 0, 0, 0); - var addDays = 0; + let addDays = 0; switch(date.getDay()) { case 6: // Saturday @@ -57,7 +57,7 @@ Hedera.Checkout = new Class({ onConfirmClick: function() { this.disableButtons(true); - var query = 'CALL myBasket_configure(#date, #method, #agency, #address)'; + const query = 'CALL myBasket_configure(#date, #method, #agency, #address)'; this.conn.execQuery(query, this.onBasketConfigured.bind(this), this.$.lot.$); }, @@ -160,10 +160,10 @@ Hedera.Checkout = new Class({ if (this.selectedNode) Vn.Node.removeClass(this.selectedNode, 'selected'); - var row = this.$.addresses.search('id', this.$.lot.$.address); + const row = this.$.addresses.search('id', this.$.lot.$.address); if (row != -1) { - var builder = this.$.repeater.getBuilder(row); + const builder = this.$.repeater.getBuilder(row); this.selectedNode = builder.$.address; Vn.Node.addClass(this.selectedNode, 'selected'); @@ -176,15 +176,21 @@ Hedera.Checkout = new Class({ if (!model.ready) return; if (model.numRows > 0) { - var agency; - var defaults = [ - this.$.orderForm.$.agencyModeFk, - this.$.defaults.$.agencyModeFk, - this.$.defaults.$.defaultAgencyFk - ]; + let agency; + const agencies = []; - for (var i = 0; i < defaults.length; i++) { - agency = defaults[i]; + if (this.$.orderForm.$) + agencies.push(this.$.orderForm.$); + + const defaults = this.$.defaults.$; + if (defaults) + agencies.push( + defaults.agencyModeFk, + defaults.defaultAgencyFk + ); + + for (let i = 0; i < agencies.length; i++) { + agency = agencies[i]; if (model.search('id', agency) !== -1) break; } diff --git a/forms/news/new/new.js b/forms/news/new/new.js index d3b68aec..9581a1a1 100644 --- a/forms/news/new/new.js +++ b/forms/news/new/new.js @@ -12,8 +12,7 @@ Hedera.New = new Class({ new Sql.Function({schema: 'account', name: 'myUser_getId'})); tinymce.init({ - mode : 'exact' - ,target: this.$.htmlEditor + target: this.$.htmlEditor ,plugins: [ "advlist autolink lists link image charmap print preview hr" ,"anchor pagebreak searchreplace wordcount visualblocks" @@ -29,7 +28,7 @@ Hedera.New = new Class({ +" | forecolor backcolor" ,image_advtab: true ,init_instance_callback: this._onEditorInit.bind(this) - }); + }); }, deactivate: function() { @@ -46,16 +45,12 @@ Hedera.New = new Class({ if (!this.editor) return; - var newHtml = this.$.iter.$.text; - - if (!newHtml) - newHtml = ''; - - this.editor.setContent(newHtml); + const row = this.$.iter.$; + this.editor.setContent(row ? row.text : ''); }, onStatusChange: function() { - if (this.hash.$.new == 0) + if (!this.hash.$.new) this.$.iter.insertRow(); }, @@ -71,6 +66,10 @@ Hedera.New = new Class({ onAcceptClick: function() { this.$.iter.set('text', this.editor.getContent()); this.$.iter.performOperations(); + }, + + onReturnClick: function() { + this.hash.setAll({form: 'news/news'}); } }); }); diff --git a/forms/news/new/ui.xml b/forms/news/new/ui.xml index b9b54964..54014e7f 100644 --- a/forms/news/new/ui.xml +++ b/forms/news/new/ui.xml @@ -20,7 +20,7 @@ + on-click="this.onReturnClick()"/> + on-click="hash.setAll({form: 'news/new', new: null})"/>
diff --git a/js/db/model.js b/js/db/model.js index 449fc7a1..92d245ee 100644 --- a/js/db/model.js +++ b/js/db/model.js @@ -279,7 +279,6 @@ Model.implement({ ,_onLotChange: function() { const params = this._getHolderValues(); this._paramsChanged = !Vn.Value.equals(params, this._lastParams); - this._lastParams = params; if (this.autoLoad) this.lazyRefresh(); @@ -316,6 +315,7 @@ Model.implement({ if (this._isReady(params)) { this._setStatus(Status.LOADING); + this._lastParams = this._getHolderValues(); this._paramsChanged = false; this._conn.execStmt(this._stmt, this._selectDone.bind(this), params); @@ -490,10 +490,14 @@ Model.implement({ ,_checkTableUpdatable: function(tableIndex) { var tableUpdatable = tableIndex !== null && this.tables[tableIndex].pks.length > 0; - - if (!tableUpdatable) - console.warn("Db.Model: Table %s is not updatable", - this.tables[tableIndex].name); + + if (!tableUpdatable && !tableIndex) { + if (tableIndex) + console.warn("Db.Model: Table %s is not updatable", + this.tables[tableIndex].name); + else + console.warn("Db.Model: Model not updatable"); + } return tableUpdatable; } @@ -784,7 +788,7 @@ Model.implement({ var dmlQuery = new Sql.Insert(); var table = this.tables[tableIndex]; - for (const def of defaults) + for (const def of this._defaults) if (def.table === table.name) { if (def.value) dmlQuery.addSet(def.field, def.value); diff --git a/js/hedera/form.js b/js/hedera/form.js index a7092fb6..f07f3b38 100644 --- a/js/hedera/form.js +++ b/js/hedera/form.js @@ -26,6 +26,7 @@ module.exports = new Class({ this.$ = scope.$; scope.link({conn, hash}); this.node = scope.$.form; + this.node.$ctrl = this; const paramsLot = this.$.params; if (paramsLot) { diff --git a/js/vn/component.js b/js/vn/component.js index a73ae6d3..73974b62 100644 --- a/js/vn/component.js +++ b/js/vn/component.js @@ -107,6 +107,7 @@ const ComponentClass = { ,createRoot: function(tagName) { const node = this._node = this.createElement(tagName); + node.$ctrl = this; if (this._htmlId) node.id = this._htmlId; if (this.$constructor.Classes) diff --git a/package.json b/package.json index 6f25ea44..62884604 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "1.407.81", + "version": "1.407.82", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": { @@ -37,7 +37,7 @@ }, "scripts": { "front": "webpack serve --open", - "back": "cd ../salix && NODE_ENV=test gulp backOnly", + "back": "cd ../salix && gulp backOnly", "build": "rm -rf build/ ; webpack", "clean": "rm -rf build/" }