diff --git a/forms/account/address-list/address-list.js b/forms/account/address-list/address-list.js index cffeb50a..2a9f7f49 100644 --- a/forms/account/address-list/address-list.js +++ b/forms/account/address-list/address-list.js @@ -11,7 +11,7 @@ Hedera.AddressList = new Class ,onAddAddressClick: function () { - this.hash.set ({ + this.hash.setAll ({ 'form': 'account/address', 'address': 0 }); diff --git a/forms/account/address-list/ui.xml b/forms/account/address-list/ui.xml index 460768ce..05665f8e 100755 --- a/forms/account/address-list/ui.xml +++ b/forms/account/address-list/ui.xml @@ -32,33 +32,33 @@
+ lot="user-form" + name="default_address"/>

- +

- +

- , - + , +

diff --git a/forms/account/address/ui.xml b/forms/account/address/ui.xml index f8742327..17656f29 100755 --- a/forms/account/address/ui.xml +++ b/forms/account/address/ui.xml @@ -12,9 +12,9 @@ SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id FROM address_view a - LEFT JOIN vn2008.province p ON p.province_id = a.province_id - JOIN vn2008.Paises c ON c.Id = p.Paises_Id - WHERE active != FALSE AND a.id = #address + LEFT JOIN vn2008.province p ON p.province_id = a.province_id + JOIN vn2008.Paises c ON c.Id = p.Paises_Id + WHERE active != FALSE AND a.id = #address @@ -41,28 +41,28 @@
- +
- +
- +
- +
- @@ -74,7 +74,7 @@
- + SELECT province_id, name FROM vn2008.province diff --git a/forms/account/conf/conf.js b/forms/account/conf/conf.js index 27aa6dea..bf32750e 100644 --- a/forms/account/conf/conf.js +++ b/forms/account/conf/conf.js @@ -72,7 +72,7 @@ Hedera.Conf = new Class ,onAddressesClick: function () { - this.hash.set ({'form': 'account/address-list'}); + this.hash.setAll ({'form': 'account/address-list'}); } }); diff --git a/forms/account/conf/ui.xml b/forms/account/conf/ui.xml index 6cba81cb..4f28f9af 100755 --- a/forms/account/conf/ui.xml +++ b/forms/account/conf/ui.xml @@ -47,15 +47,15 @@
- +
- +
- +
@@ -97,23 +97,23 @@
  • - + characters long
  • - + alphabetic characters
  • - + capital letters
  • - + digits
  • - + symbols
diff --git a/forms/admin/access-log/ui.xml b/forms/admin/access-log/ui.xml index a4e2e446..328d2a3d 100755 --- a/forms/admin/access-log/ui.xml +++ b/forms/admin/access-log/ui.xml @@ -22,16 +22,16 @@

- +

- +

- +

- +

@@ -56,12 +56,12 @@

- +

- - - - + - + +

diff --git a/forms/admin/connections/connections.js b/forms/admin/connections/connections.js index 32738f82..30dfb3e3 100644 --- a/forms/admin/connections/connections.js +++ b/forms/admin/connections/connections.js @@ -5,7 +5,7 @@ Hedera.Connections = new Class ,_timeoutId: null - ,onModelStatusChange: function (model, status) + ,onModelStatusChange: function (model) { if (!model.ready) return; @@ -40,9 +40,9 @@ Hedera.Connections = new Class this._onUserSupplant.bind (this)); } - ,_onUserSupplant: function (userName) + ,_onUserSupplant: function () { - this.hash.set ({'form': 'ecomerce/orders'}); + this.hash.setAll ({'form': 'ecomerce/orders'}); } ,sessionsFunc: function () diff --git a/forms/admin/connections/ui.xml b/forms/admin/connections/ui.xml index bf14e9e4..3e0ce5d9 100755 --- a/forms/admin/connections/ui.xml +++ b/forms/admin/connections/ui.xml @@ -38,23 +38,23 @@

- +

- - - + - +

- - - - + - + +

diff --git a/forms/admin/items/ui.xml b/forms/admin/items/ui.xml index 6639f827..b08753b6 100755 --- a/forms/admin/items/ui.xml +++ b/forms/admin/items/ui.xml @@ -13,7 +13,7 @@
- + SELECT id, name FROM vn2008.warehouse @@ -24,7 +24,7 @@
- + SELECT id, reino FROM vn2008.reinos diff --git a/forms/admin/links/ui.xml b/forms/admin/links/ui.xml index 08a9b7a3..8a4777da 100755 --- a/forms/admin/links/ui.xml +++ b/forms/admin/links/ui.xml @@ -14,15 +14,15 @@

- +

- +

diff --git a/forms/admin/shelves/locale/en.json b/forms/admin/shelves/locale/en.json index a9d21599..0e6a7389 100644 --- a/forms/admin/shelves/locale/en.json +++ b/forms/admin/shelves/locale/en.json @@ -11,6 +11,7 @@ ,"Title": "Title" ,"Show packing": "Show packing" ,"Stack different items": "Stack different items" + ,"Use ids instead of names": "Use ids instead of names" ,"Show": "Show" diff --git a/forms/admin/shelves/locale/es.json b/forms/admin/shelves/locale/es.json index 2a97e803..74dc9a12 100644 --- a/forms/admin/shelves/locale/es.json +++ b/forms/admin/shelves/locale/es.json @@ -11,6 +11,7 @@ ,"Title": "Título" ,"Show packing": "Mostrar unidades por caja" ,"Stack different items": "Apilar artículos distintos" + ,"Use ids instead of names": "Usar ids en vez de nombres" ,"Show": "Mostrar" diff --git a/forms/admin/shelves/locale/fr.json b/forms/admin/shelves/locale/fr.json index 0967ef42..0e6a7389 100644 --- a/forms/admin/shelves/locale/fr.json +++ b/forms/admin/shelves/locale/fr.json @@ -1 +1,22 @@ -{} +{ + "Configuration": "Configuration" + ,"Select config": "Select config" + ,"Reign": "Reign" + ,"Family": "Family" + ,"Store": "Store" + ,"Date": "Date" + ,"Shelf": "Shelf" + ,"Name prefix": "Name prefix" + ,"Limit amount per item": "Limit amount per item" + ,"Title": "Title" + ,"Show packing": "Show packing" + ,"Stack different items": "Stack different items" + ,"Use ids instead of names": "Use ids instead of names" + + ,"Show": "Show" + + ,"Pallets": "Pallets" + + ,"No items found, check that all fields are correct": + "No items found, check that all fields are correct" +} diff --git a/forms/admin/shelves/locale/mn.json b/forms/admin/shelves/locale/mn.json index a9d21599..0e6a7389 100644 --- a/forms/admin/shelves/locale/mn.json +++ b/forms/admin/shelves/locale/mn.json @@ -11,6 +11,7 @@ ,"Title": "Title" ,"Show packing": "Show packing" ,"Stack different items": "Stack different items" + ,"Use ids instead of names": "Use ids instead of names" ,"Show": "Show" diff --git a/forms/admin/shelves/locale/pt.json b/forms/admin/shelves/locale/pt.json index fd55c26d..58e062c4 100644 --- a/forms/admin/shelves/locale/pt.json +++ b/forms/admin/shelves/locale/pt.json @@ -11,6 +11,7 @@ ,"Title": "Título" ,"Show packing": "Mostrar unidades por caixa" ,"Stack different items": "Empilhar ítens diferentes" + ,"Use ids instead of names": "Usar ids en vez de nombres" ,"Show": "Mostrar" diff --git a/forms/admin/shelves/ui.xml b/forms/admin/shelves/ui.xml index b288f575..0c37ae01 100755 --- a/forms/admin/shelves/ui.xml +++ b/forms/admin/shelves/ui.xml @@ -31,11 +31,11 @@
- +
- + SELECT id, reino FROM vn2008.reinos @@ -46,7 +46,7 @@
- + SELECT tipo_id, Tipo FROM vn2008.Tipos @@ -62,7 +62,7 @@
- + SELECT id, name FROM vn2008.warehouse @@ -73,7 +73,7 @@
- + SELECT id, name FROM shelf @@ -83,27 +83,27 @@
- +
- +
- +
- +
- +
- +
diff --git a/forms/admin/users/ui.xml b/forms/admin/users/ui.xml index d458ca42..ecac1269 100755 --- a/forms/admin/users/ui.xml +++ b/forms/admin/users/ui.xml @@ -33,18 +33,18 @@

- +

- - - + - +

diff --git a/forms/admin/users/users.js b/forms/admin/users/users.js index 868ea52f..2edbfdc7 100644 --- a/forms/admin/users/users.js +++ b/forms/admin/users/users.js @@ -17,9 +17,9 @@ Hedera.Users = new Class this.onUserSupplant.bind (this)); } - ,onUserSupplant: function (userName) + ,onUserSupplant: function () { - this.hash.set ({'form': 'ecomerce/orders'}); + this.hash.setAll ({'form': 'ecomerce/orders'}); } }); diff --git a/forms/admin/visits/ui.xml b/forms/admin/visits/ui.xml index e2738f4d..79639c09 100755 --- a/forms/admin/visits/ui.xml +++ b/forms/admin/visits/ui.xml @@ -72,18 +72,18 @@

- - - - + + - +

- + visits, - + news

- +

diff --git a/forms/admin/visits/visits.js b/forms/admin/visits/visits.js index fd4c40b0..f832f7ba 100644 --- a/forms/admin/visits/visits.js +++ b/forms/admin/visits/visits.js @@ -16,7 +16,7 @@ Hedera.Visits = new Class ,onSessionsClick: function () { - this.hash.set ({'form': 'admin/connections'}); + this.hash.setAll ({'form': 'admin/connections'}); } }); diff --git a/forms/agencies/packages/packages.js b/forms/agencies/packages/packages.js index b71a13b6..6eba7324 100644 --- a/forms/agencies/packages/packages.js +++ b/forms/agencies/packages/packages.js @@ -5,7 +5,7 @@ Hedera.Packages = new Class ,onShowClick: function (column, agencyId) { - this.hash.set ({ + this.hash.setAll ({ 'form': 'agencies/provinces', 'agency': agencyId }); diff --git a/forms/cms/home/home.js b/forms/cms/home/home.js index d8a544d8..4a672b3d 100644 --- a/forms/cms/home/home.js +++ b/forms/cms/home/home.js @@ -5,7 +5,7 @@ Hedera.Home = new Class ,onStartOrderClick: function () { - this.hash.set ({'form': 'ecomerce/catalog'}); + this.hash.setAll ({'form': 'ecomerce/catalog'}); } }); diff --git a/forms/cms/home/ui.xml b/forms/cms/home/ui.xml index 3f06bb6e..0c16b5c3 100755 --- a/forms/cms/home/ui.xml +++ b/forms/cms/home/ui.xml @@ -22,21 +22,21 @@
-

+

- +
diff --git a/forms/cms/training/ui.xml b/forms/cms/training/ui.xml index 62716607..e7a1006f 100755 --- a/forms/cms/training/ui.xml +++ b/forms/cms/training/ui.xml @@ -16,19 +16,19 @@
-

+

- +

- +
diff --git a/forms/ecomerce/basket/basket.js b/forms/ecomerce/basket/basket.js index 66f9fe08..ff7a5ce5 100644 --- a/forms/ecomerce/basket/basket.js +++ b/forms/ecomerce/basket/basket.js @@ -8,7 +8,7 @@ Hedera.Basket = new Class this.close (); this.isOpen = true; - Hedera.BasketChecker.check (this.conn, + Hedera.BasketChecker.check (this.conn, this.hash, this.onBasketCheck.bind (this)); } @@ -26,17 +26,17 @@ Hedera.Basket = new Class ,onConfigureClick: function () { Htk.Toast.showWarning (_('RememberReconfiguringImpact')); - this.hash.set ({'form': 'ecomerce/checkout'}); + this.hash.setAll ({'form': 'ecomerce/checkout'}); } ,onCatalogClick: function () { - this.hash.set ({'form': 'ecomerce/catalog'}); + this.hash.setAll ({'form': 'ecomerce/catalog'}); } ,onCheckoutClick: function () { - this.hash.set ({'form': 'ecomerce/confirm'}); + this.hash.setAll ({'form': 'ecomerce/confirm'}); } ,repeaterFunc: function (res, form) diff --git a/forms/ecomerce/basket/ui.xml b/forms/ecomerce/basket/ui.xml index 17fbadf1..cee76924 100755 --- a/forms/ecomerce/basket/ui.xml +++ b/forms/ecomerce/basket/ui.xml @@ -39,27 +39,27 @@

- - - + + +

- x - + x + diff --git a/forms/ecomerce/catalog/catalog.js b/forms/ecomerce/catalog/catalog.js index 6d208f31..e50423d1 100644 --- a/forms/ecomerce/catalog/catalog.js +++ b/forms/ecomerce/catalog/catalog.js @@ -12,7 +12,7 @@ Hedera.Catalog = new Class if (!localStorage.getItem ('hederaGuest')) { - Hedera.BasketChecker.check (this.conn, + Hedera.BasketChecker.check (this.conn, this.hash, this.onBasketCheck.bind (this)); } else @@ -251,7 +251,7 @@ Hedera.Catalog = new Class if (this.isGuest ()) return; - this.hash.set ({'form': 'ecomerce/basket'}); + this.hash.setAll ({'form': 'ecomerce/basket'}); } ,onConfigureClick: function () @@ -259,7 +259,7 @@ Hedera.Catalog = new Class if (this.isGuest ()) return; - this.hash.set ({'form': 'ecomerce/checkout'}); + this.hash.setAll ({'form': 'ecomerce/checkout'}); } ,onAddItemClick: function (button, form) diff --git a/forms/ecomerce/catalog/ui.xml b/forms/ecomerce/catalog/ui.xml index c69f4eee..541c761a 100755 --- a/forms/ecomerce/catalog/ui.xml +++ b/forms/ecomerce/catalog/ui.xml @@ -151,38 +151,38 @@

- +

- +

- Size , - Category + Size , + Category

- Color - + Color +

- + from - +
@@ -194,11 +194,11 @@

- +

- +

diff --git a/forms/ecomerce/checkout/checkout.js b/forms/ecomerce/checkout/checkout.js index 5d8bce26..9f3e58af 100644 --- a/forms/ecomerce/checkout/checkout.js +++ b/forms/ecomerce/checkout/checkout.js @@ -34,7 +34,9 @@ Hedera.Checkout = new Class date = new Date (); if (i.get('delivery_method') != 'PICKUP') - date.setTime (date.getTime () + 86400000); + date.setDate (date.getDate () + 1); + + date.setHours (0, 0, 0, 0); } this.$('date').value = date; @@ -80,7 +82,7 @@ Hedera.Checkout = new Class else Htk.Toast.showMessage (_('OrderStarted')); - this.hash.set ({'form': 'ecomerce/catalog'}); + this.hash.setAll ({'form': 'ecomerce/catalog'}); } ,onCancelClick: function () @@ -88,7 +90,7 @@ Hedera.Checkout = new Class if (this.$('order-form').numRows > 0) window.history.back(); else - this.hash.set ({'form': 'ecomerce/orders'}); + this.hash.setAll ({'form': 'ecomerce/orders'}); } ,agencySteps: ['method', 'date', 'address', 'agency', 'confirm-agency'] diff --git a/forms/ecomerce/checkout/ui.xml b/forms/ecomerce/checkout/ui.xml index 39034772..46660f11 100755 --- a/forms/ecomerce/checkout/ui.xml +++ b/forms/ecomerce/checkout/ui.xml @@ -114,10 +114,10 @@

- +

- +

@@ -152,11 +152,11 @@

- +

Agency - +

@@ -76,7 +76,7 @@ Order total - + @@ -84,7 +84,7 @@ Order VAT - + @@ -100,7 +100,7 @@ Credit - + @@ -181,14 +181,14 @@ diff --git a/forms/ecomerce/orders/orders.js b/forms/ecomerce/orders/orders.js index ae533025..76ef891b 100644 --- a/forms/ecomerce/orders/orders.js +++ b/forms/ecomerce/orders/orders.js @@ -5,13 +5,16 @@ Hedera.Orders = new Class ,activate: function () { - this.tpv = new Hedera.Tpv ({conn: this.conn}); + this.tpv = new Hedera.Tpv ({ + conn: this.conn, + hash: this.hash + }); this.tpv.check (this._onTpvCheck.bind (this)); if (!this.$('from').value) { var from = new Date (); - from.setDate (from.getDate () - 25); + from.setDate (from.getDate () - 30); from.setHours (0, 0, 0, 0); this.$('from').value = from; } @@ -25,7 +28,7 @@ Hedera.Orders = new Class ,onBasketClick: function () { - this.hash.set ({'form': 'ecomerce/basket'}); + this.hash.setAll ({'form': 'ecomerce/basket'}); } ,repeaterFunc: function (res, form) diff --git a/forms/ecomerce/orders/ui.xml b/forms/ecomerce/orders/ui.xml index dfd967fe..1f96c844 100755 --- a/forms/ecomerce/orders/ui.xml +++ b/forms/ecomerce/orders/ui.xml @@ -30,7 +30,7 @@ Balance: - +

- +

- +

- +

- +

- +

diff --git a/forms/ecomerce/ticket/ui.xml b/forms/ecomerce/ticket/ui.xml index 3fb4744c..643fb199 100755 --- a/forms/ecomerce/ticket/ui.xml +++ b/forms/ecomerce/ticket/ui.xml @@ -29,36 +29,36 @@

- +

- +

- Delivery + Delivery

- +

- +

- - - () + + + ()

Total - +

Total + VAT - +

@@ -76,20 +76,20 @@

- - - + + +

- x - + x + diff --git a/forms/news/new/new.js b/forms/news/new/new.js index 90cdf0d4..911ccf08 100644 --- a/forms/news/new/new.js +++ b/forms/news/new/new.js @@ -86,7 +86,7 @@ Hedera.New = new Class ,onReturnClick: function () { - this.hash.set ({'form': 'news/news'}); + this.hash.setAll ({'form': 'news/news'}); } }); diff --git a/forms/news/new/ui.xml b/forms/news/new/ui.xml index 625b842f..7c39ee77 100755 --- a/forms/news/new/ui.xml +++ b/forms/news/new/ui.xml @@ -19,7 +19,7 @@ - +

AddEditNew @@ -38,11 +38,11 @@
- +
- + SELECT name, description FROM news_tag diff --git a/forms/news/news/news.js b/forms/news/news/news.js index 9b1ceda2..9465449f 100644 --- a/forms/news/news/news.js +++ b/forms/news/news/news.js @@ -19,7 +19,7 @@ Hedera.News = new Class ,onAddClick: function () { - this.hash.set ({ + this.hash.setAll ({ 'form': 'news/new', 'new': 0 }); diff --git a/forms/news/news/ui.xml b/forms/news/news/ui.xml index 2466c3f6..5db940b5 100755 --- a/forms/news/news/ui.xml +++ b/forms/news/news/ui.xml @@ -23,15 +23,15 @@

- +

- +

Priority - +

diff --git a/forms/preview/preview.js b/forms/preview/preview.js index 99056385..98562d47 100644 --- a/forms/preview/preview.js +++ b/forms/preview/preview.js @@ -5,7 +5,7 @@ Hedera.Preview = new Class ,activate: function () { - var reportName = Vn.Hash.get ('report'); + var reportName = this.hash.get ('report'); if (!reportName) { @@ -34,15 +34,12 @@ Hedera.Preview = new Class Htk.Toast.showError (_('Error loading report')); return; } - - var batch = new Sql.Batch (); - batch.addValues (Vn.Hash._hashMap); this.report = new module.klass ({ info: module, conn: this.conn }); - this.report.open (batch, this.node); + this.report.open (this.hash, this.node); } ,onPrintClick: function () diff --git a/js/db/connection.js b/js/db/connection.js index 2100f479..83cbbf9f 100644 --- a/js/db/connection.js +++ b/js/db/connection.js @@ -56,11 +56,11 @@ Connection.implement * * @param {Sql.Stmt} stmt The statement * @param {Function} callback The function to call when operation is done - * @param {Sql.Batch} batch The batch used to set the parameters + * @param {Object} params The statement parameters */ - ,execStmt: function (stmt, callback, batch) + ,execStmt: function (stmt, callback, params) { - this.execSql (stmt.render (batch), callback); + this.execSql (stmt.render (params), callback); } /** @@ -68,11 +68,11 @@ Connection.implement * * @param {String} query The SQL statement * @param {Function} callback The function to call when operation is done - * @param {Sql.Batch} batch The batch used to set the parameters + * @param {Object} params The statement parameters */ - ,execQuery: function (query, callback, batch) + ,execQuery: function (query, callback, params) { - this.execStmt (new Sql.String ({query: query}), callback, batch); + this.execStmt (new Sql.String ({query: query}), callback, params); } /* diff --git a/js/db/db.js b/js/db/db.js index e1ba4ec9..901b7e6b 100644 --- a/js/db/db.js +++ b/js/db/db.js @@ -9,7 +9,6 @@ Db = module.exports = { ,Iterator : require ('./iterator') ,SimpleIterator : require ('./simple-iterator') ,Form : require ('./form') - ,Param : require ('./param') ,Query : require ('./query') ,Calc : require ('./calc') ,CalcSum : require ('./calc-sum') diff --git a/js/db/model.js b/js/db/model.js index 28f3e5b5..b33afeef 100644 --- a/js/db/model.js +++ b/js/db/model.js @@ -101,6 +101,22 @@ Model.implement return this._batch; } }, + /** + * The lot used to execute the statement. + */ + lot: + { + type: Vn.Lot + ,set: function (x) + { + this.link ({_lot: x}, {'change': this._autoLoad}); + this._autoLoad (); + } + ,get: function () + { + return this._lot; + } + }, /** * The model select statement. */ diff --git a/js/db/param.js b/js/db/param.js deleted file mode 100644 index 00c77baa..00000000 --- a/js/db/param.js +++ /dev/null @@ -1,97 +0,0 @@ - -var Form = require ('./form'); - -module.exports = new Class -({ - Extends: Vn.Param - ,Tag: 'db-param' - ,Parent: 'form' - ,Properties: - { - /** - * The form field referenced by this param. - */ - column: - { - type: String - ,set: function (x) - { - this._columnName = x; - this.refresh (); - } - ,get: function () - { - this._columnName; - } - }, - /** - * The form referenced by this param. - */ - form: - { - type: Form - ,set: function (x) - { - this.link ({_set: x}, - { - 'change': this.onSetChange - }); - - this.refresh (); - } - ,get: function () - { - return this._set; - } - }, - /** - * Determines whether the link to the form is unidirectional, ie, a - * change in the form updates the parameter but not vice versa. - */ - oneWay: - { - type: Boolean - ,set: function (x) - { - this._oneWay = x; - } - ,get: function () - { - return this._oneWay; - } - } - } - - ,_columnName: null - ,_set: null - ,_setLock: false - ,_oneWay: false - ,_setValue: null - - ,initialize: function (props) - { - this.parent (props); - this.on ('changed', this.onChange, this); - } - - ,refresh: function () - { - if (this._set) - this.onSetChange (); - } - - ,onSetChange: function () - { - this._setLock = true; - var formValue = this._set.get (this._columnName); - this.value = formValue; - this._setLock = false; - } - - ,onChange: function () - { - if (!this._setLock && this._columnName && !this.oneWay) - this._set.set (this._columnName, this._value); - } -}); - diff --git a/js/db/query.js b/js/db/query.js index cb30a7aa..9670c028 100644 --- a/js/db/query.js +++ b/js/db/query.js @@ -56,19 +56,19 @@ module.exports = new Class } }, /** - * The batch used to execute the statement. + * The lot used to execute the statement. */ - batch: + lot: { - type: Sql.Batch + type: Vn.Lot ,set: function (x) { - this.link ({_batch: x}, {'changed': this.onChange}); - this.onChange (); + this.link ({_lot: x}, {'change': this.onChange}); + this._autoLoad (); } ,get: function () { - return this._batch; + return this._lot; } }, /** @@ -81,11 +81,6 @@ module.exports = new Class } } - ,initialize: function (props) - { - this.parent (props); - } - ,loadXml: function (builder, node) { this.parent (builder, node); diff --git a/js/hedera/app.js b/js/hedera/app.js index 6871c10b..6f69dbd3 100644 --- a/js/hedera/app.js +++ b/js/hedera/app.js @@ -21,7 +21,7 @@ module.exports = new Class { window.onerror = this._onWindowError.bind (this); window.onunload = this._onWindowUnload.bind (this); - Vn.Hash.initialize (); + this._hash = new Vn.Hash ({window: window}); var conn = new Db.Connection (); this.link ({_conn: conn}, {'error': this._onConnError}); @@ -34,7 +34,10 @@ module.exports = new Class if (this.tryAutoLogin ()) return; - var login = this._login = new Login ({conn: this._conn}); + var login = this._login = new Login ({ + conn: this._conn, + hash: this._hash + }); login.on ('login', this._onLogin, this); login.show (); } @@ -43,7 +46,10 @@ module.exports = new Class { this._freeLogin (); - var gui = this._gui = new Gui ({conn: this._conn}); + var gui = this._gui = new Gui ({ + conn: this._conn, + hash: this._hash + }); gui.on ('logout', this._onLogout, this); gui.show (); } @@ -82,7 +88,7 @@ module.exports = new Class this._logout (); break; case 'OutdatedVersion': - this._newVersion (error); + this._newVersion (); break; default: Htk.Toast.showError (error.message); @@ -100,7 +106,7 @@ module.exports = new Class this._gui.logout (); } - ,_newVersion: function (error) + ,_newVersion: function () { if (this.ignoreVersion) return; @@ -162,6 +168,7 @@ module.exports = new Class this._freeGui (); this.deinitAutoLogin (); this._conn.unref (); + this._hash.unref (); } // Auto login functionality @@ -170,15 +177,17 @@ module.exports = new Class ,initAutoLogin: function () { - var isGuest = new Vn.HashParam + var isGuest = new Vn.Param ({ + lot: this._hash, type: Boolean, key: 'guest' }); this.link ({_isGuest: isGuest}, {'changed': this._onGuestChange}); - var token = new Vn.HashParam + var token = new Vn.Param ({ + lot: this._hash, type: String, key: 'token' }); diff --git a/js/hedera/basket-checker.js b/js/hedera/basket-checker.js index 253d8bba..6a36c209 100644 --- a/js/hedera/basket-checker.js +++ b/js/hedera/basket-checker.js @@ -1,8 +1,9 @@ module.exports = { - check: function (conn, callback) + check: function (conn, hash, callback) { + this.hash = hash; conn.execQuery ('CALL basketCheck ()', this._onBasketCheck.bind (this, callback)); } @@ -10,7 +11,7 @@ module.exports = ,_onBasketCheck: function (callback, resultSet) { var status = resultSet.fetchValue (); - + if (!status) return; @@ -21,6 +22,6 @@ module.exports = if (callback) callback (isOk); if (!isOk) - Vn.Hash.set ({'form': 'ecomerce/checkout'}); + this.hash.setAll ({'form': 'ecomerce/checkout'}); } }; diff --git a/js/hedera/form.js b/js/hedera/form.js index 786d2fb3..b09a423f 100644 --- a/js/hedera/form.js +++ b/js/hedera/form.js @@ -23,6 +23,7 @@ module.exports = new Class var builder = new Vn.Builder (); builder.signalData = this; builder.add ('conn', this.conn); + builder.add ('hash', this.hash); builder.loadXml ('forms/'+ this.formInfo.path +'/ui.xml'); var res = this.builderResultInit (builder); diff --git a/js/hedera/gui.css b/js/hedera/gui.css index b554fcf2..3bb52633 100644 --- a/js/hedera/gui.css +++ b/js/hedera/gui.css @@ -318,7 +318,7 @@ { margin-left: 0; } - .vn-gui .menu-button + .vn-gui .navbar .menu-button { display: block; } diff --git a/js/hedera/gui.js b/js/hedera/gui.js index da9282ac..a1dfebca 100644 --- a/js/hedera/gui.js +++ b/js/hedera/gui.js @@ -77,10 +77,13 @@ module.exports = new Class window.addEventListener ('scroll', this._onScrollHandler ); } - this.hash = Vn.Hash; - this.formParam = new Vn.HashParam ({key: 'form'}); + this.formParam = new Vn.Param ({ + lot: this.hash, + type: String, + key: 'form' + }); this.formParam.on ('changed', this._onFormChange, this); - + if (!localStorage.getItem ('hederaCookies')) { localStorage.setItem ('hederaCookies', true); @@ -220,7 +223,7 @@ module.exports = new Class if (res.get ('path')) { - a.href = Vn.Hash.make ({'form': res.get ('path')}); + a.href = this.hash.make ({'form': res.get ('path')}); this.menuOptions[res.get ('path')] = a; } @@ -374,7 +377,7 @@ module.exports = new Class ,_onFormChange: function () { var formPath = this.formParam.value; - + if (!formPath) formPath = Vn.Config['default_form']; @@ -475,7 +478,7 @@ module.exports = new Class form: 'preview', report: reportName }; - Vn.Hash.set (Object.assign (hashParams, params)); + this.hash.setAll (Object.assign (hashParams, params)); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++ Supplant diff --git a/js/hedera/report.js b/js/hedera/report.js index 36e95631..9316032b 100644 --- a/js/hedera/report.js +++ b/js/hedera/report.js @@ -3,6 +3,11 @@ module.exports = new Class ({ Extends: Htk.Component + ,activate: function () + { + this.renderReport (); + } + ,open: function (batch, body) { this.batch = batch; @@ -11,11 +16,6 @@ module.exports = new Class this.activate (batch, body); } - ,activate: function (batch, body) - { - this.renderReport (); - } - ,openIframe: function (batch) { this.batch = batch; diff --git a/js/hedera/social-bar.js b/js/hedera/social-bar.js index 0ff058f3..16ed1e41 100644 --- a/js/hedera/social-bar.js +++ b/js/hedera/social-bar.js @@ -46,12 +46,10 @@ module.exports = new Class if (!this._conn || this._priority === null) return; - var batch = new Sql.Batch (); - batch.addValue ('priority', this._priority); - + var params = {priority: this._priority}; var query = 'SELECT title, link, icon FROM social ' +'WHERE priority >= #priority ORDER BY priority'; - this._conn.execQuery (query, this._onQueryDone.bind (this), batch); + this._conn.execQuery (query, this._onQueryDone.bind (this), params); } ,_onQueryDone: function (resultSet) diff --git a/js/hedera/style.css b/js/hedera/style.css index 8374650c..e4140d05 100644 --- a/js/hedera/style.css +++ b/js/hedera/style.css @@ -56,15 +56,15 @@ } /* Mobile - High DPI */ -@media screen and - (max-device-width: 411px) and (min-resolution: 249dpi), - (max-device-width: 411px) and (-webkit-min-device-pixel-ratio: 3) +@media + screen and (max-device-width: 411px) and (min-resolution: 249dpi), + screen and (max-device-width: 411px) and (-webkit-min-device-pixel-ratio: 3) { body { font-size: 10pt; } } -@media screen and - (min-device-width: 412px) and (min-resolution: 249dpi), - (min-device-width: 412px) and (-webkit-min-device-pixel-ratio: 3) +@media + screen and (min-device-width: 412px) and (min-resolution: 249dpi), + screen and (min-device-width: 412px) and (-webkit-min-device-pixel-ratio: 3) { body { font-size: 11pt; } } @@ -160,6 +160,7 @@ button, .clickable { transition: background-color 200ms ease-out; + -webkit-transition: background-color 200ms ease-out; } button:hover, .list-row:hover, @@ -171,6 +172,7 @@ button:hover, .clickable-img { transition: opacity 200ms ease-out; + -webkit-transition: opacity 200ms ease-out; } .clickable-img:hover { diff --git a/js/hedera/tpv.js b/js/hedera/tpv.js index ec276777..d87879b2 100644 --- a/js/hedera/tpv.js +++ b/js/hedera/tpv.js @@ -8,17 +8,17 @@ module.exports = new Class ,check: function (callback) { - this.tpvOrder = Vn.Hash.get ('tpvOrder'); - this.tpvStatus = Vn.Hash.get ('tpvStatus'); + this.tpvOrder = this.hash.get ('tpvOrder'); + this.tpvStatus = this.hash.get ('tpvStatus'); if (this.tpvStatus) { - var batch = new Sql.Batch (); - batch.addValue ('transaction', this.tpvOrder); - batch.addValue ('status', this.tpvStatus); - var query = 'CALL transactionEnd (#transaction, #status)'; - this.conn.execQuery (query, null, batch); + var params = { + transaction: this.tpvOrder, + status: this.tpvStatus + }; + this.conn.execQuery (query, null, params); } if (callback) @@ -35,10 +35,10 @@ module.exports = new Class if (amount > 0) { var params = { - 'amount': parseInt (amount) - ,'urlOk': this._makeUrl ('ok') - ,'urlKo': this._makeUrl ('ko') - ,'company': company + amount: parseInt (amount) + ,urlOk: this._makeUrl ('ok') + ,urlKo: this._makeUrl ('ko') + ,company: company }; this.conn.send ('tpv/transaction', params, @@ -48,7 +48,7 @@ module.exports = new Class Htk.Toast.showError (_('AmountError')); } - ,_onTransactionStart: function (json, error) + ,_onTransactionStart: function (json) { if (json) { @@ -59,9 +59,9 @@ module.exports = new Class var fieldsMap = { - 'Ds_SignatureVersion': 'HMAC_SHA256_V1' - ,'Ds_MerchantParameters': json.params - ,'Ds_Signature': json.signature + Ds_SignatureVersion: 'HMAC_SHA256_V1' + ,Ds_MerchantParameters: json.params + ,Ds_Signature: json.signature }; for (var field in fieldsMap) @@ -83,15 +83,13 @@ module.exports = new Class ,retryPay: function () { - var batch = new Sql.Batch (); - batch.addValue ('transaction', parseInt (this.tpvOrder)); - var query = 'SELECT t.amount, m.company_id ' +'FROM tpv_transaction_view t ' +'JOIN tpv_merchant m ON t.merchant_id = m.id ' +'WHERE t.id = #transaction'; + var params = {transaction: parseInt (this.tpvOrder)}; this.conn.execQuery (query, - this._onRetryPayDone.bind (this), batch); + this._onRetryPayDone.bind (this), params); } ,_onRetryPayDone: function (resultSet) @@ -104,13 +102,13 @@ module.exports = new Class Htk.Toast.showError (_('AmountError')); } - ,_makeUrl: function (status, order) + ,_makeUrl: function (status) { var path = location.protocol +'//'+ location.host; path += location.port ? ':'+ location.port : ''; path += location.pathname; path += location.search ? location.search : ''; - path += Vn.Hash.make ({ + path += this.hash.make ({ 'form': 'ecomerce/orders', 'tpvStatus': status, 'tpvOrder': '%s' diff --git a/js/htk/field.js b/js/htk/field.js index 7d8ef106..086fafe4 100644 --- a/js/htk/field.js +++ b/js/htk/field.js @@ -5,7 +5,6 @@ module.exports = new Class ({ Extends: Widget ,Tag: 'htk-field' - ,Child: 'param' ,Properties: { value: @@ -22,7 +21,7 @@ module.exports = new Class this.valueChanged (x); this.putValue (x); } - ,get: function (x) + ,get: function () { return this._value; } @@ -56,22 +55,22 @@ module.exports = new Class return this._editable; } }, - form: + lot: { type: Db.Iterator ,set: function (x) { - this._form = x; - this.bindToForm (); + this._lot = x; + this.bindToLot (); } }, - column: + name: { type: String ,set: function (x) { this._paramName = x; - this.bindToForm (); + this.bindToLot (); } }, conditionalFunc: @@ -97,13 +96,13 @@ module.exports = new Class } } - ,bindToForm: function () + ,bindToLot: function () { - if (this._form && this._paramName) - this.param = new Db.Param + if (this._lot && this._paramName) + this.param = new Vn.Param ({ - form: this._form - ,column: this._paramName + lot: this._lot + ,name: this._paramName }); } diff --git a/js/sql/batch.js b/js/sql/batch.js deleted file mode 100644 index ef88ae52..00000000 --- a/js/sql/batch.js +++ /dev/null @@ -1,169 +0,0 @@ - -var Object = require ('./object'); -var Value = require ('./value'); - -/** - * A map container for many Sql.Object - */ -module.exports = new Class -({ - Extends: Object - ,Tag: 'sql-batch' - ,Properties: - { - blocked: - { - type: Boolean - ,set: function (x) - { - this._blocked = x; - } - ,get: function () - { - return this._blocked; - } - } - } - - ,objects: {} - ,_blocked: false - - ,loadXml: function (builder, node) - { - this.parent (builder, node); - - var childs = node.childNodes; - - for (var i = 0; i < childs.length; i++) - if (childs[i].tagName && childs[i].tagName.toLowerCase () == 'item') - { - var object; - var id = childs[i].getAttribute ('name'); - - if (id) - { - if (object = builder.getById (childs[i].getAttribute ('param'))) - this.addParam (id, object); - else if (object = builder.getById (childs[i].getAttribute ('object'))) - this.addObject (id, object); - } - } - } - - ,get: function (id) - { - if (this.objects[id]) - return this.objects[id]; - - return null; - } - - ,add: function (id) - { - if (!this.objects[id]) - this.objects[id] = null; - } - - ,_addObject: function (id, object) - { - this.remove (id); - this.objects[id] = object; - object.on ('changed', this.emitChanged, this); - this.emitChanged (); - } - - ,addObject: function (id, object) - { - this._addObject (id, object.ref ()); - } - - ,addValue: function (id, value) - { - this._addObject (id, - new Value ({value: value})); - } - - ,addValues: function (values) - { - for (var id in values) - this.addValue (id, values[id]); - } - - ,addParam: function (id, param) - { - this._addObject (id, - new Value ({param: param})); - } - - ,getValue: function (id) - { - var object = this.objects[id]; - - if (object instanceof Value) - return object.value; - - return null; - } - - ,addParams: function (params) - { - for (var id in params) - this.addParam (id, params[id]); - } - - ,remove: function (id) - { - if (this.objects[id]) - { - this._unrefObject (this.objects[id]); - delete this.objects[id]; - } - } - - ,block: function () - { - this._blocked = true; - } - - ,unblock: function () - { - this._blocked = false; - } - - ,emitChanged: function () - { - if (!this._blocked) - this.signalEmit ('changed'); - } - - ,changed: function () - { - this.signalEmit ('changed'); - } - - ,isReady: function () - { - for (var id in this.objects) - if (!(this.objects[id] && this.objects[id].isReady ())) - return false; - - return true; - } - - ,_unrefObject: function (object) - { - if (object) - { - object.disconnect ('changed', this.emitChanged, this); - object.unref (); - } - } - - ,_destroy: function () - { - for (var id in this.objects) - this._unrefObject (this.objects[id]); - - this.parent (); - } -}); diff --git a/js/sql/holder.js b/js/sql/holder.js index 34777aca..3ca40e0d 100644 --- a/js/sql/holder.js +++ b/js/sql/holder.js @@ -1,12 +1,13 @@ -var Object = require ('./object'); +var SqlObject = require ('./object'); +var Value = require ('./value'); /** * A holder for another object. */ module.exports = new Class ({ - Extends: Object + Extends: SqlObject ,Properties: { id: @@ -16,12 +17,21 @@ module.exports = new Class } } - ,render: function (batch) + ,render: function (params) { var object; - if (batch && (object = batch.get (this.id))) - return object.render (batch); + if (params && (object = params[this.id])) + { + if (!(object instanceof SqlObject)) + { + var sqlValue = new Value (); + sqlValue.value = object; + return sqlValue.render (); + } + else + return object.render (params); + } return '#'+ this.id; } diff --git a/js/sql/object.js b/js/sql/object.js index 284756f2..7d936cf6 100644 --- a/js/sql/object.js +++ b/js/sql/object.js @@ -8,10 +8,10 @@ module.exports = new Class /** * Renders the object as an SQL string. * - * @param {Sql.Batch} batch The batch used to render the object + * @param {Object} params The params used to render the object * @return {String} The SQL string */ - ,render: function (batch) {} + ,render: function () {} /** * Gets if the object is ready to be rendered. @@ -26,7 +26,7 @@ module.exports = new Class /** * Through the query looking for containers and adds it to the batch. * - * @return {Sql.Batch} batch The batch + * @return {Object} The found statement parameters */ - ,findHolders: function (batch) {} + ,findHolders: function () {} }); diff --git a/js/sql/sql.js b/js/sql/sql.js index 7de038f9..3443f157 100644 --- a/js/sql/sql.js +++ b/js/sql/sql.js @@ -4,7 +4,6 @@ require ('vn/vn'); Sql = module.exports = { Object : require ('./object') ,Holder : require ('./holder') - ,Batch : require ('./batch') ,List : require ('./list') ,Expr : require ('./expr') ,Value : require ('./value') diff --git a/js/vn/basic-set.js b/js/vn/basic-lot.js similarity index 93% rename from js/vn/basic-set.js rename to js/vn/basic-lot.js index 093aa3d1..d7ae72ff 100644 --- a/js/vn/basic-set.js +++ b/js/vn/basic-lot.js @@ -1,11 +1,11 @@ var Object = require ('./object'); -var Set = require ('./set'); +var Lot = require ('./lot'); module.exports = new Class ({ Extends: Object - ,Implements: Set + ,Implements: Lot ,Tag: 'vn-basic-set' ,Properties: { diff --git a/js/vn/hash-listener.js b/js/vn/hash-listener.js deleted file mode 100644 index 69d3a086..00000000 --- a/js/vn/hash-listener.js +++ /dev/null @@ -1,15 +0,0 @@ - -var Object = require ('./object'); - -/** - * Class to handle the URL. - */ -module.exports = new Class -({ - Extends: Object - - ,changed: function () - { - this.signalEmit ('changed'); - } -}); diff --git a/js/vn/hash-param.js b/js/vn/hash-param.js deleted file mode 100644 index 4f76666f..00000000 --- a/js/vn/hash-param.js +++ /dev/null @@ -1,138 +0,0 @@ - -var Object = require ('./object'); -var Param = require ('./param'); -var Hash = require ('./hash'); -var Type = require ('./type'); -var VnDate = require ('./date'); - -module.exports = new Class -({ - Extends: Object - ,Tag: 'vn-hash-param' - ,Child: 'param' - ,Properties: - { - param: - { - type: Param - ,set: function (x) - { - this.link ({_param: x}, {'changed': this._onParamChange}); - this._refreshParam (); - } - ,get: function () - { - return this._param; - } - }, - key: - { - type: String - ,set: function (x) - { - this._key = x; - this._onHashChange (); - } - ,get: function () - { - return this._key; - } - }, - value: - { - type: Object - ,set: function (x) - { - this._setValue (x, true); - } - ,get: function () - { - return this._value; - } - }, - type: - { - type: Type - ,set: function (x) - { - this._type = x; - this._onHashChange (); - } - ,get: function () - { - return this._type; - } - } - } - - ,_hashLock: false - ,_paramLock: false - ,_value: undefined - ,_key: null - ,_type: null - - ,initialize: function (props) - { - this.parent (props); - var listener = Hash.getListener (); - this.link ({_listener: listener}, {'changed': this._onHashChange}); - this._onHashChange (); - } - - ,_onHashChange: function () - { - if (this._hashLock || !this._key || !this._listener) - return; - - var newValue = Hash.get (this._key, this._type); - - this._hashLock = true; - this._setValue (newValue, true); - this._hashLock = false; - } - - ,_setValue: function (newValue, signal) - { - if (newValue == this._value) - return; - - this._value = newValue; - - if (this._key && !this._hashLock) - { - this._hashLock = true; - - var map = {}; - map[this._key] = newValue; - Hash.add (map); - - this._hashLock = false; - } - - this._refreshParam (); - - if (signal) - this.signalEmit ('changed', newValue); - } - - ,_refreshParam: function () - { - if (this._param && !this._paramLock) - { - this._paramLock = true; - this._param.value = this._value; - this._paramLock = false; - } - } - - ,_onParamChange: function () - { - if (this._paramLock) - return; - - this._paramLock = true; - this._setValue (this._param.value); - this._paramLock = false; - } -}); - diff --git a/js/vn/hash.js b/js/vn/hash.js index dff2c86d..fee1d9e6 100644 --- a/js/vn/hash.js +++ b/js/vn/hash.js @@ -1,58 +1,78 @@ -var HashListener = require ('./hash-listener'); +var VnObject = require ('./object'); var VnDate = require ('./date'); +var Lot = require ('./lot'); /** * Class to handle the URL. */ -module.exports = -{ - _hash: null - ,_hashMap: {} - ,_listener: null +module.exports = new Class +({ + Extends: VnObject + ,Implements: Lot + ,Properties: { + window: + { + type: Window + ,set: function (x) + { + this._window = x; + x.addEventListener ('hashchange', this._hashChangedHandler); + this._hashChanged (); + } + ,get: function () + { + return this._window; + } + }, + params: + { + type: Object + ,set: function (x) + { + this.setAll (x); + } + ,get: function () + { + return this._hashMap; + } + } + } - ,initialize: function () + ,initialize: function (props) { - this._listener = new HashListener (); - + this._hash = null; + this._hashMap = null; + this._window = null; this._hashChangedHandler = this._hashChanged.bind (this); - window.addEventListener ('hashchange', this._hashChangedHandler); - this._hashChanged (); + this.parent (props); } - ,destroy: function () - { - window.removeEventListener ('hashchange', this._hashChangedHandler); - } - - ,getListener: function () - { - return this._listener; - } - - /** - * Gets the hash part of the URL. - * - * @param {string} key The variable name - */ ,get: function (key, type) { return this.parseValue (this._hashMap[key], type); } + + ,set: function (key, value) + { + var map = {}; + map[key] = value; + this.assign (map); + } /** * Sets the hash part of the URL, respecting the current hash variables. * * @param {Object} map A key-value map */ - ,add: function (map) + ,assign: function (map) { var newMap = this._hashMap; for (var key in map) newMap[key] = map[key]; - this.set (newMap); + this.setAll (newMap); } /** @@ -60,7 +80,7 @@ module.exports = * * @param {Object} map A key-value map */ - ,set: function (map) + ,setAll: function (map) { if (map) for (var key in map) @@ -81,7 +101,7 @@ module.exports = location.hash = newHash; this._blockChanged = false; - this._listener.changed (); + this.changed (); } } @@ -106,7 +126,7 @@ module.exports = if (hash.length > 2) hash += '&'; - hash += key +'='+ this.renderValue (map[key]); + hash += encodeURIComponent (key) +'='+ this.renderValue (map[key]); } return hash; @@ -127,12 +147,12 @@ module.exports = var kvPair = kvPairs[i].split ('=', 2); if (kvPair[0]) - newMap[kvPair[0]] = decodeURIComponent (kvPair[1]); + newMap[decodeURIComponent (kvPair[0])] = decodeURIComponent (kvPair[1]); } this._hashMap = newMap; this._hash = newHash; - this._listener.changed (); + this.changed (); } ,renderValue: function (v) @@ -171,4 +191,11 @@ module.exports = return v; } -}; + + ,_destroy: function () + { + this._window.removeEventListener ('hashchange', this._hashChangedHandler); + this._window = null; + this.parent (); + } +}); diff --git a/js/vn/set.js b/js/vn/lot.js similarity index 100% rename from js/vn/set.js rename to js/vn/lot.js diff --git a/js/vn/param.js b/js/vn/param.js index 7001198c..c558f23b 100644 --- a/js/vn/param.js +++ b/js/vn/param.js @@ -1,71 +1,157 @@ -var Object = require ('./object'); -var Param = require ('./param'); -var Value = require ('./value'); +var VnObject = require ('./object'); +var Lot = require ('./lot'); +var Type = require ('./type'); -/** - * Simply a linkable value holder. - */ module.exports = new Class ({ - Extends: Object + Extends: VnObject ,Tag: 'vn-param' + ,Child: 'param' ,Properties: { - value: + param: + { + type: Object + ,set: function (x) + { + this.link ({_param: x}, {'changed': this._onParamChange}); + this._refreshParam (); + } + ,get: function () + { + return this._param; + } + }, + key: { type: String ,set: function (x) { - if (Value.compare (x, this._value)) - return; - - if (x instanceof Date) - x = x.clone (); - - this._value = x; - - if (this._master && !this.masterLock) - { - this.masterLock = true; - this._master.value = x; - this.masterLock = false; - } - - this.signalEmit ('changed', this._value); + this._key = x; + this._onLotChange (); + } + ,get: function () + { + return this._key; + } + }, + value: + { + type: Object + ,set: function (x) + { + this._setValue (x, true); } ,get: function () { return this._value; } }, - master: + type: { - type: Param + type: Type ,set: function (x) { - this.link ({_master: x}, {'changed': this._onMasterChange}); - this._onMasterChange (); + this._type = x; + this._onLotChange (); } ,get: function () { - return this._master; + return this._type; + } + }, + lot: + { + type: Lot + ,set: function (x) + { + this.link ({_lot: x}, {'change': this._onLotChange}); + this._onLotChange (); + } + ,get: function () + { + return this._lot; + } + }, + /** + * Determines whether the link to the form is unidirectional, ie, a + * change in the lot updates the parameter but not vice versa. + */ + oneWay: + { + type: Boolean + ,set: function (x) + { + this._oneWay = x; + } + ,get: function () + { + return this._oneWay; } } } - + + ,_lotLock: false + ,_paramLock: false ,_value: undefined - ,_master: null - ,masterLock: false + ,_lot: null + ,_key: null + ,_type: null + ,_oneWay: false - ,_onMasterChange: function () + ,_onLotChange: function () { - if (this.masterLock) + if (this._lotLock || !this._key || !this._lot) + return; + + var newValue = this._lot.get (this._key, this._type); + + this._lotLock = true; + this._setValue (newValue, true); + this._lotLock = false; + } + + ,_setValue: function (newValue, signal) + { + if (newValue == this._value) return; - this.masterLock = true; - this.value = this._master.value; - this.masterLock = false; + if (newValue instanceof Date) + newValue = newValue.clone (); + + this._value = newValue; + + if (this._lot && this._key && !this._lotLock && !this._oneWay) + { + this._lotLock = true; + this._lot.set (this._key, newValue); + this._lotLock = false; + } + + this._refreshParam (); + + if (signal) + this.signalEmit ('changed', newValue); + } + + ,_refreshParam: function () + { + if (this._param && !this._paramLock) + { + this._paramLock = true; + this._param.value = this._value; + this._paramLock = false; + } + } + + ,_onParamChange: function () + { + if (this._paramLock) + return; + + this._paramLock = true; + this._setValue (this._param.value); + this._paramLock = false; } }); - diff --git a/js/vn/vn.js b/js/vn/vn.js index 3da01551..b78db811 100644 --- a/js/vn/vn.js +++ b/js/vn/vn.js @@ -12,12 +12,10 @@ Vn = module.exports = { ,Value : require ('./value') ,Url : require ('./url') ,Mutators : require ('./mutators') - ,Set : require ('./set') - ,BasicSet : require ('./basic-set') - ,Param : require ('./param') - ,HashListener : require ('./hash-listener') + ,Lot : require ('./lot') + ,BasicLot : require ('./basic-lot') ,Hash : require ('./hash') - ,HashParam : require ('./hash-param') + ,Param : require ('./param') ,Node : require ('./node') ,Builder : require ('./builder') ,JsonException : require ('./json-exception') diff --git a/reports/delivery-note/ui.xml b/reports/delivery-note/ui.xml index 08db656d..f4c2c3c7 100755 --- a/reports/delivery-note/ui.xml +++ b/reports/delivery-note/ui.xml @@ -10,25 +10,25 @@

- +

- +

- +

- +

- - - () + + + ()

- Delivery + Delivery

@@ -37,23 +37,23 @@ CALL clientTicketRowGet(#ticket) - - - - - - - + + + + + + +
diff --git a/webpack.config.js b/webpack.config.js index 69f283a8..41034d10 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -72,8 +72,8 @@ var devConfig = { port: wpConfig.devServerPort, headers: { "Access-Control-Allow-Origin": "*" }, stats: { chunks: false } - }, - devtool: 'eval-source-map' + }/*, + devtool: 'eval-source-map'*/ }; var mrgConfig = devMode ? devConfig : prodConfig;