From b8c83df08ff2fcd073cd8cf0229a31aa6ca05e5c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 21 Aug 2017 12:20:36 +0200 Subject: [PATCH] Backup --- forms/account/address/address.js | 2 +- forms/account/address/ui.xml | 7 +++-- forms/ecomerce/catalog/catalog.js | 17 ++--------- forms/ecomerce/catalog/ui.xml | 33 +++++++++++--------- forms/ecomerce/orders/ui.xml | 4 +-- forms/ecomerce/ticket/ui.xml | 17 ++++++----- forms/reports/shelves/ui.xml | 5 +++- js/db/model.js | 2 +- js/sql/holder.js | 2 +- js/vn/date.js | 2 +- js/vn/hash.js | 50 ++----------------------------- js/vn/locale/ca.json | 2 +- js/vn/locale/en.json | 2 +- js/vn/locale/es.json | 2 +- js/vn/locale/fr.json | 2 +- js/vn/locale/mn.json | 2 +- js/vn/locale/pt.json | 2 +- js/vn/lot-query.js | 40 +++++++++++++++++++++---- js/vn/lot.js | 19 ------------ webpack.config.js | 10 ++++--- 20 files changed, 95 insertions(+), 127 deletions(-) diff --git a/forms/account/address/address.js b/forms/account/address/address.js index 2d9c5a3c..809e8d2d 100644 --- a/forms/account/address/address.js +++ b/forms/account/address/address.js @@ -12,7 +12,7 @@ Hedera.Address = new Class ,onStatusChange: function (form) { - if (form.ready && this.hash.get ('address') == 0) + if (form.ready && this.$('params').$.address == 0) form.insertRow (); } diff --git a/forms/account/address/ui.xml b/forms/account/address/ui.xml index 8e6c2dae..8543f070 100755 --- a/forms/account/address/ui.xml +++ b/forms/account/address/ui.xml @@ -1,14 +1,15 @@ - - + + + SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country FROM address_view a diff --git a/forms/ecomerce/catalog/catalog.js b/forms/ecomerce/catalog/catalog.js index f7665491..31ead49a 100644 --- a/forms/ecomerce/catalog/catalog.js +++ b/forms/ecomerce/catalog/catalog.js @@ -164,17 +164,8 @@ Hedera.Catalog = new Class ,onRealmChange: function () { var newValue = this.hash.get ('realm'); - - if (newValue) - { - this.$('filters').style.display = 'block'; - this.$('realm-msg').style.display = 'none'; - } - else - { - this.$('filters').style.display = 'none'; - this.$('realm-msg').style.display = 'block'; - } + this.$('filters').style.display = newValue ? 'block' : 'none'; + this.$('realm-msg').style.display = newValue ? 'none' : 'block'; this.refreshTitleColor (); this.hash.params = { @@ -445,9 +436,7 @@ Vn.Filter = new Class this._ul = this.createElement ('ul'); this.node.appendChild (this._ul); - this._modelLot = new Vn.LotQuery ({ - type: Vn.LotQuery.Type.EXCLUDE - }); + this._modelLot = new Vn.LotQuery (); this.parent (props); } diff --git a/forms/ecomerce/catalog/ui.xml b/forms/ecomerce/catalog/ui.xml index 4898620c..df4c21ca 100755 --- a/forms/ecomerce/catalog/ui.xml +++ b/forms/ecomerce/catalog/ui.xml @@ -1,12 +1,17 @@ - + + + + + + + + + - - + + CREATE TEMPORARY TABLE tmp.bionic_calc (INDEX (item_id)) @@ -111,7 +116,7 @@ tip="_Switch view" on-click="onSwitchViewClick"/>
@@ -208,14 +213,14 @@

Filter by

CALL item_available (); @@ -230,7 +235,7 @@ @@ -247,7 +252,7 @@ @@ -263,7 +268,7 @@ @@ -280,7 +285,7 @@ diff --git a/forms/ecomerce/orders/ui.xml b/forms/ecomerce/orders/ui.xml index 055bbfaf..2c90c19e 100755 --- a/forms/ecomerce/orders/ui.xml +++ b/forms/ecomerce/orders/ui.xml @@ -44,12 +44,12 @@
- +
- + CALL clientTicketList (#from, NULL) diff --git a/forms/ecomerce/ticket/ui.xml b/forms/ecomerce/ticket/ui.xml index f8f709c1..84db1fbe 100755 --- a/forms/ecomerce/ticket/ui.xml +++ b/forms/ecomerce/ticket/ui.xml @@ -1,11 +1,12 @@ - - - - CALL clientTicketGet(#ticket) - - - + + + + + + CALL clientTicketGet(#ticket) + +

OrderDetail

@@ -54,7 +55,7 @@
- + CALL clientTicketRowGet(#ticket) diff --git a/forms/reports/shelves/ui.xml b/forms/reports/shelves/ui.xml index eb7912a4..89f9b525 100755 --- a/forms/reports/shelves/ui.xml +++ b/forms/reports/shelves/ui.xml @@ -1,4 +1,7 @@ + + +

Shelves @@ -17,7 +20,7 @@ id="config" placeholder="_Select config" model="configs-model" - lot="hash" + lot="params" name="config" on-changed="onConfigChange" on-ready="onConfigChange"> diff --git a/js/db/model.js b/js/db/model.js index b50df942..d78dcdab 100644 --- a/js/db/model.js +++ b/js/db/model.js @@ -309,7 +309,7 @@ Klass.implement return true; for (var key in params) - if (params[key] === undefined) + if (params[key] == null) return false; return true; diff --git a/js/sql/holder.js b/js/sql/holder.js index cde1b234..63288eab 100644 --- a/js/sql/holder.js +++ b/js/sql/holder.js @@ -23,7 +23,7 @@ module.exports = new Class { var object = params[this.id]; - if (object != null) + if (object !== undefined) { if (!(object instanceof SqlObject)) { diff --git a/js/vn/date.js b/js/vn/date.js index d07ab50e..518e4ed3 100644 --- a/js/vn/date.js +++ b/js/vn/date.js @@ -50,7 +50,7 @@ module.exports = ,'Feb' ,'Mar' ,'Apr' - ,'May' + ,'MayAbr' ,'Jun' ,'Jul' ,'Ago' diff --git a/js/vn/hash.js b/js/vn/hash.js index 0f50c6bb..90b5b573 100644 --- a/js/vn/hash.js +++ b/js/vn/hash.js @@ -149,22 +149,11 @@ module.exports = new Class switch (typeof v) { - case 'number': - return '(Number)'+ v; - case 'boolean': - return '(Boolean)'+ (v ? 'true' : 'false'); case 'object': if (v instanceof Date) - return '(Date)'+ VnDate.strftime (v, '%Y-%m-%d'); + return VnDate.strftime (v, '%Y-%m-%d'); else - return '(Object)'+ JSON.stringify (v) - } - - switch (v.charAt (0)) - { - case '(': - case '\\': - return '\\'+ v; + return JSON.stringify (v) } return v; @@ -177,43 +166,10 @@ module.exports = new Class v = decodeURIComponent (v); - if (v === '') - return v; - - var typeStr; - - switch (v.charAt(0)) - { - case '(': - var index = v.indexOf (')'); - typeStr = v.substr (1, index - 1); - v = v.substr (index + 1); - break; - case '\\': - v = v.substr (1); - break; - } - if (v === '') return null; - if (!typeStr) - return v; - switch (typeStr) - { - case 'Boolean': - return (/^(true|1)$/i).test (v); - case 'Number': - return 0 + new Number (v); - case 'Date': - var date = new Date (v); - date.setHours (0, 0, 0, 0); - return date; - case 'Object': - return JSON.parse (v); - default: - return v; - } + return v; } ,_destroy: function () diff --git a/js/vn/locale/ca.json b/js/vn/locale/ca.json index 77a72036..e18ac876 100644 --- a/js/vn/locale/ca.json +++ b/js/vn/locale/ca.json @@ -32,7 +32,7 @@ ,"Feb": "Febr" ,"Mar": "Març" ,"Apr": "Abr" - ,"May": "Maig" + ,"MayAbr": "Maig" ,"Jun": "Juny" ,"Jul": "Jul" ,"Ago": "Ag" diff --git a/js/vn/locale/en.json b/js/vn/locale/en.json index f2ee6372..39939b08 100644 --- a/js/vn/locale/en.json +++ b/js/vn/locale/en.json @@ -32,7 +32,7 @@ ,"Feb": "Feb" ,"Mar": "Mar" ,"Apr": "Apr" - ,"May": "May" + ,"MayAbr": "May" ,"Jun": "Jun" ,"Jul": "Jul" ,"Ago": "Ago" diff --git a/js/vn/locale/es.json b/js/vn/locale/es.json index 400dee13..6f34bcb6 100644 --- a/js/vn/locale/es.json +++ b/js/vn/locale/es.json @@ -32,7 +32,7 @@ ,"Feb": "Feb" ,"Mar": "Mar" ,"Apr": "Abr" - ,"May": "May" + ,"MayAbr": "May" ,"Jun": "Jun" ,"Jul": "Jul" ,"Ago": "Ago" diff --git a/js/vn/locale/fr.json b/js/vn/locale/fr.json index 07c3e725..782043d5 100644 --- a/js/vn/locale/fr.json +++ b/js/vn/locale/fr.json @@ -32,7 +32,7 @@ ,"Feb": "Fév" ,"Mar": "Mars" ,"Apr": "Avr" - ,"May": "Mai" + ,"MayAbr": "Mai" ,"Jun": "Juin" ,"Jul": "Juil" ,"Ago": "Août" diff --git a/js/vn/locale/mn.json b/js/vn/locale/mn.json index de1f336b..225bcecf 100644 --- a/js/vn/locale/mn.json +++ b/js/vn/locale/mn.json @@ -32,7 +32,7 @@ ,"Feb": "хоё" ,"Mar": "Гур" ,"Apr": "Дөр" - ,"May": "May" + ,"MayAbr": "May" ,"Jun": "Jun" ,"Jul": "Jul" ,"Ago": "Най" diff --git a/js/vn/locale/pt.json b/js/vn/locale/pt.json index 538ed138..c5cd4361 100644 --- a/js/vn/locale/pt.json +++ b/js/vn/locale/pt.json @@ -32,7 +32,7 @@ ,"Feb": "Fev" ,"Mar": "Mar" ,"Apr": "Abr" - ,"May": "Mai" + ,"MayAbr": "Mai" ,"Jun": "Jun" ,"Jul": "Jul" ,"Ago": "Ago" diff --git a/js/vn/lot-query.js b/js/vn/lot-query.js index b0fe585b..53175d13 100644 --- a/js/vn/lot-query.js +++ b/js/vn/lot-query.js @@ -43,6 +43,7 @@ module.exports = new Class Object.assign (this, { _fields: null, _source: null, + _lockSource: false, _specs: {} }); this.parent (props); @@ -58,6 +59,9 @@ module.exports = new Class ,_onSourceChange: function () { + if (this._lockSource) + return; + var params = this._source ? this._source.params : {}; var myParams = {}; @@ -67,6 +71,32 @@ module.exports = new Class this.assign (myParams); } + ,assign: function (params) + { + params = this.transformParams (params); + var diff = Value.partialDiff (this._params, params); + + if (diff) + { + Object.assign (this._params, diff); + + if (this.source) + { + this._lockSource = true; + this.source.assign (diff); + this._lockSource = false; + } + + this._paramsChanged (diff); + this.changed (diff); + } + } + + ,setAll: function (params) + { + this.assign (params); + } + ,transformParams: function (params) { var newParams = {}; @@ -87,17 +117,17 @@ function cast (value, type) switch (type) { case Boolean: - return (/^(true|1)$/i).test (v); + return (/^(true|1)$/i).test (value); case Number: - return 0 + new Number (v); + return 0 + new Number (value); case Date: - var date = new Date (v); + var date = new Date (value); date.setHours (0, 0, 0, 0); return date; default: if (type instanceof Object) - return JSON.parse (v); + return JSON.parse (value); else - return v; + return value; } } diff --git a/js/vn/lot.js b/js/vn/lot.js index 4cbf4a28..a7bf294a 100644 --- a/js/vn/lot.js +++ b/js/vn/lot.js @@ -41,11 +41,6 @@ module.exports = new Class this._params = {}; this.parent (props); } - - ,get: function (field) - { - return this._params[field]; - } ,keys: function () { @@ -54,7 +49,6 @@ module.exports = new Class ,assign: function (params) { - params = this.transformParams (params); var diff = Value.partialDiff (this._params, params); if (diff) @@ -67,7 +61,6 @@ module.exports = new Class ,setAll: function (params) { - params = this.transformParams (params); var diff = Value.diff (this._params, params); if (diff) @@ -85,16 +78,4 @@ module.exports = new Class * @param {Object} diff Changed parameters and its new values */ ,_paramsChanged: function () {} - - /** - * Called when lot params changes to apply transformations over them, can be - * implemented by child classes. - * - * @param {Object} params New parameters - * @return {Object} Transformed parameters - */ - ,transformParams: function (params) - { - return params; - } }); diff --git a/webpack.config.js b/webpack.config.js index d4d89d48..6fe67e63 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -13,9 +13,7 @@ var baseConfig = { entry: wpConfig.entry, output: { path: outputPath, - publicPath: publicPath, - filename: '[name].js', - chunkFilename: 'chunk.[id].js' + publicPath: publicPath }, module: { rules: [ @@ -64,13 +62,17 @@ var prodConfig = { }; var devConfig = { + output: { + filename: '[name].js', + chunkFilename: 'chunk.[id].js' + }, plugins: [ new webpack.NamedModulesPlugin () ], devServer: { host: '0.0.0.0', port: wpConfig.devServerPort, - headers: { "Access-Control-Allow-Origin": "*" }, + headers: { 'Access-Control-Allow-Origin': '*' }, stats: { chunks: false } }, devtool: 'eval'