From 403845bf2bd143a1b1fc4e1cbe407d6da147722f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Sat, 8 Apr 2017 13:42:27 +0200 Subject: [PATCH] Backup --- .eslintrc.yml | 3 +- forms/account/address/address.js | 2 +- forms/account/address/ui.xml | 6 +- forms/account/conf/ui.xml | 32 +++--- forms/admin/shelves/shelves.js | 11 +- forms/admin/shelves/ui.xml | 24 ++-- forms/cms/location/location.js | 24 ++-- forms/ecomerce/checkout/checkout.js | 4 +- forms/ecomerce/checkout/ui.xml | 12 +- forms/ecomerce/confirm/confirm.js | 52 ++++----- forms/ecomerce/confirm/ui.xml | 45 ++++---- forms/ecomerce/orders/orders.js | 2 +- forms/ecomerce/ticket/ticket.js | 2 +- js/db/form.js | 15 +++ js/db/iterator.js | 56 +++++++-- js/db/model.js | 20 +--- js/db/query.js | 10 +- js/db/result-set.js | 15 +++ js/db/result.js | 40 ++++++- js/db/simple-iterator.js | 15 +++ js/hedera/gui.js | 38 +++---- js/hedera/report.js | 12 +- js/hedera/social-bar.js | 11 +- js/hedera/tpv.js | 6 +- js/htk/field/combo.js | 15 +++ js/htk/field/radio-group.js | 6 +- js/htk/field/radio.js | 6 +- js/htk/field/spin.js | 1 - js/htk/full-image.js | 4 +- js/vn/basic-lot.js | 8 ++ js/vn/browser.js | 42 ------- js/vn/hash.js | 54 ++++----- js/vn/ie.js | 139 ----------------------- js/vn/json-connection.js | 32 +++--- js/vn/lot.js | 19 ++-- js/vn/polyfills.js | 29 +++++ js/vn/vn.js | 4 +- reports/shelves-report/shelves-report.js | 81 +++++++------ 38 files changed, 433 insertions(+), 464 deletions(-) delete mode 100644 js/vn/browser.js delete mode 100644 js/vn/ie.js create mode 100644 js/vn/polyfills.js diff --git a/.eslintrc.yml b/.eslintrc.yml index cf2ca1e9..64de1d5c 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -3,4 +3,5 @@ rules: no-undef: 0 no-redeclare: 0 no-mixed-spaces-and-tabs: 0 - no-console: 0 \ No newline at end of file + no-console: 0 + no-cond-assign: 0 \ No newline at end of file diff --git a/forms/account/address/address.js b/forms/account/address/address.js index bbd623a3..2d9c5a3c 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.$('address').value == 0) + if (form.ready && this.hash.get ('address') == 0) form.insertRow (); } diff --git a/forms/account/address/ui.xml b/forms/account/address/ui.xml index a8ca179e..8e6c2dae 100755 --- a/forms/account/address/ui.xml +++ b/forms/account/address/ui.xml @@ -10,7 +10,7 @@ mode="ON_DEMAND" lot="hash" on-operations-done="onOperationsDone"> - SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id + SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country 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 @@ -56,7 +56,7 @@ id="country" property="param" lot="iter" - name="country_id" + name="country" one-way="true"/> SELECT Id, Pais FROM vn2008.Paises @@ -67,7 +67,7 @@
- + SELECT province_id, name FROM vn2008.province WHERE Paises_Id = #country ORDER BY name diff --git a/forms/account/conf/ui.xml b/forms/account/conf/ui.xml index 4f28f9af..8afd0ee1 100755 --- a/forms/account/conf/ui.xml +++ b/forms/account/conf/ui.xml @@ -2,32 +2,26 @@ - - SELECT length, nAlpha, nUpper, nDigits, nPunct - FROM account.userPassword - + SELECT length, nAlpha, nUpper, nDigits, nPunct + FROM account.userPassword - - SELECT u.id, u.name, u.recoverPass, - c.email, c.mail, c.user_id - FROM account.userView u - LEFT JOIN customer_view c - ON u.id = c.user_id - + SELECT u.id, u.name, u.recoverPass, + c.email, c.mail, c.user_id + FROM account.userView u + LEFT JOIN customer_view c + ON u.id = c.user_id - - SELECT a.id, a.consignee, p.name province, - a.zip_code, a.city, a.name, a.active, c.Pais country - FROM address_view a - LEFT JOIN vn2008.province p ON a.province_id = p.province_id - JOIN vn2008.Paises c ON c.Id = p.Paises_Id - WHERE active - + SELECT a.id, a.consignee, p.name province, + a.zip_code, a.city, a.name, a.active, c.Pais country + FROM address_view a + LEFT JOIN vn2008.province p ON a.province_id = p.province_id + JOIN vn2008.Paises c ON c.Id = p.Paises_Id + WHERE active

diff --git a/forms/admin/shelves/shelves.js b/forms/admin/shelves/shelves.js index fcfa19b0..fbda8be9 100644 --- a/forms/admin/shelves/shelves.js +++ b/forms/admin/shelves/shelves.js @@ -5,19 +5,20 @@ Hedera.Shelves = new Class ,activate: function () { - var set = this.$('set'); - set.set ('date', new Date ()); - set.set ('useIds', false); + this.$('lot').assign ({ + date: new Date (), + useIds: false + }); } ,onConfigChange: function () { - this.$('set').assign (this.$('config')); + this.$('lot').assignLot (this.$('config')); } ,onShowClick: function () { - this.gui.openReport ('shelves-report', this.$('set').params); + this.gui.openReport ('shelves-report', this.$('lot').params); } }); diff --git a/forms/admin/shelves/ui.xml b/forms/admin/shelves/ui.xml index 1a093a4d..2f2f173b 100755 --- a/forms/admin/shelves/ui.xml +++ b/forms/admin/shelves/ui.xml @@ -1,5 +1,5 @@ - +

Shelves

@@ -29,11 +29,11 @@

- +
- + SELECT id, reino FROM vn2008.reinos WHERE display != FALSE ORDER BY reino @@ -42,7 +42,7 @@
- + SELECT tipo_id, Tipo FROM vn2008.Tipos WHERE reino_id = #realm ORDER BY Tipo @@ -51,7 +51,7 @@
- + SELECT id, name FROM vn2008.warehouse WHERE reserve ORDER BY name @@ -60,7 +60,7 @@
- + SELECT id, name FROM shelf @@ -68,27 +68,27 @@
- +
- +
- +
- +
- +
- +
diff --git a/forms/cms/location/location.js b/forms/cms/location/location.js index dc823f5f..0d06c2fb 100644 --- a/forms/cms/location/location.js +++ b/forms/cms/location/location.js @@ -50,40 +50,40 @@ Hedera.Location = new Class var div = this.$('form'); var gmap = new google.maps.Map (div, options); + var row; - if (this.locations) - while (this.locations.next ()) - this.createMarker (this.locations, gmap); + while (row = this.locations.fetchObject ()) + this.createMarker (row, gmap); } - ,createMarker: function (location, gmap) + ,createMarker: function (row, gmap) { var div = document.createElement ('div'); div.className = 'marker'; var h = document.createElement ('h3'); - h.appendChild (document.createTextNode (location.get ('title'))); + h.appendChild (document.createTextNode (row.title)); div.appendChild (h); var p = document.createElement ('p'); - p.appendChild (document.createTextNode (location.get ('address'))); + p.appendChild (document.createTextNode (row.address)); div.appendChild (p); var p = document.createElement ('p'); - p.appendChild (document.createTextNode (location.get ('postcode') +' '+ location.get ('city'))); + p.appendChild (document.createTextNode (row.postcode +' '+ row.city)); div.appendChild (p); var p = document.createElement ('p'); - p.appendChild (document.createTextNode (location.get ('province'))); + p.appendChild (document.createTextNode (row.province)); div.appendChild (p); var p = document.createElement ('p'); - p.appendChild (document.createTextNode (location.get ('phone'))); + p.appendChild (document.createTextNode (row.phone)); div.appendChild (p); var lat = new google.maps.LatLng ( - location.get ('lat'), - location.get ('lng') + row.lat, + row.lng ); var marker = new google.maps.Marker ({ @@ -100,7 +100,7 @@ Hedera.Location = new Class this.openInfoWindow.bind (this, infoWindow, gmap, marker)); if (Vn.Locale.language - && Vn.Locale.language == location.get ('language')) + && Vn.Locale.language == row.language) this.openInfoWindow (infoWindow, gmap, marker); } diff --git a/forms/ecomerce/checkout/checkout.js b/forms/ecomerce/checkout/checkout.js index a73a1244..f87cea6b 100644 --- a/forms/ecomerce/checkout/checkout.js +++ b/forms/ecomerce/checkout/checkout.js @@ -127,10 +127,8 @@ Hedera.Checkout = new Class this.$('calendar').goToSelectedMonth (); break; case 'agency': - this.$('agencies').refresh (); - break; case 'pickup': - this.$('warehouses').refresh (); + this.$('agencies').refresh (); break; } diff --git a/forms/ecomerce/checkout/ui.xml b/forms/ecomerce/checkout/ui.xml index 61f12c58..2c870ff9 100755 --- a/forms/ecomerce/checkout/ui.xml +++ b/forms/ecomerce/checkout/ui.xml @@ -46,7 +46,6 @@ id="rg-method" lot="lot" name="method" - param="method" on-changed="onFieldChange"/>
@@ -68,7 +67,8 @@
@@ -121,7 +121,7 @@ lot="lot" name="agency" on-changed="onFieldChange" - model="warehouses"/> + model="agencies"/>
@@ -129,7 +129,7 @@

Arrival - +

@@ -149,7 +149,7 @@

Arrival - +

@@ -168,7 +168,7 @@

Pickup - +

Warehouse diff --git a/forms/ecomerce/confirm/confirm.js b/forms/ecomerce/confirm/confirm.js index 12d0215d..97c9c1c4 100644 --- a/forms/ecomerce/confirm/confirm.js +++ b/forms/ecomerce/confirm/confirm.js @@ -22,8 +22,10 @@ Hedera.Confirm = new Class { if (form.row < 0) return; + + var order = form.params; - if (form.get ('method') != 'PICKUP') + if (order.method != 'PICKUP') { Vn.Node.show (this.$('address')); Vn.Node.setText (this.$('method'), _('Agency')); @@ -34,34 +36,26 @@ Hedera.Confirm = new Class Vn.Node.setText (this.$('method'), _('Warehouse')); } - var total = form.get ('tax_base') + form.get ('vat'); + var total = order.taxBase + order.vat; if (total === null) total = 0; - var credit = form.get ('credit'); - var debt = form.get ('debt'); - - var totalDebt = debt + total; - var exceededCredit = totalDebt - credit; + var totalDebt = order.debt + total; + var exceededCredit = totalDebt - order.credit; var creditExceededCond = exceededCredit > 0; if (creditExceededCond) Htk.Toast.showWarning ( _('You have exceeded your credit.')); - this.$('lot').assign ({ - debt: debt, + var lot = { totalDebt: totalDebt, - totalAmount: totalDebt, - creditExcess: exceededCredit, - excessAmount: exceededCredit, + exceededCredit: exceededCredit, payAmount: 'ALL' - }); + }; - this.$('pay-amount').value = 'ALL'; - - if (credit > 0) + if (order.credit > 0) { this.$('credit-info').style.display = 'table-row'; @@ -69,7 +63,7 @@ Hedera.Confirm = new Class { this.$('amount-selector').style.display = 'block'; this.$('exceeded-info').style.display = 'table-row'; - lot.assign ({payAmount: 'EXCEEDED'}); + lot.payAmount = 'EXCEEDED'; } } @@ -78,7 +72,7 @@ Hedera.Confirm = new Class if (totalDebt <= 0) { methods = ['balance']; - selectedMethod = 'BALANCE'; + lot.payMethod = 'BALANCE'; } else { @@ -87,16 +81,16 @@ Hedera.Confirm = new Class if (!creditExceededCond) { methods.push ('credit'); - selectedMethod = 'CREDIT'; + lot.payMethod = 'CREDIT'; } else - selectedMethod = 'CARD'; + lot.payMethod = 'CARD'; } for (var i = 0; i < methods.length; i++) this.$(methods[i] +'-method').style.display = 'block'; - - lot.assign ({payAmount: selectedMethod}); + + this.$('lot').assign (lot); } ,onPayMethodChange: function (payMethod) @@ -143,6 +137,7 @@ Hedera.Confirm = new Class ,onConfirmClick: function () { + console.log (this.$('lot').params); this.disableButtons (true); this.$('confirm-query').execute (); } @@ -152,29 +147,28 @@ Hedera.Confirm = new Class this.disableButtons (false); if (resultSet.fetchResult ()) - { - Vn.Cookie.unset ('order'); this.$('success-dialog').show (); - } } ,onDialogResponse: function () { + var lot = this.$('lot').params; + if (this.$('pay-method').value === 'CARD') { if (this.$('pay-amount').value === 'EXCEEDED') - var payAmount = this.$('excess-amount').value; + var payAmount = lot.exceededCredit; else - var payAmount = this.$('total-amount').value; + var payAmount = lot.totalDebt; var tpv = new Hedera.Tpv ({ conn: this.conn, hash: this.hash }); - tpv.pay (payAmount, this.$('order-form').get ('company_id')); + tpv.pay (payAmount, this.$('order').get ('company')); } else - this.hash.setAll ({'form': 'ecomerce/orders'}); + this.hash.params = {form: 'ecomerce/orders'}; } }); diff --git a/forms/ecomerce/confirm/ui.xml b/forms/ecomerce/confirm/ui.xml index 6a6bd8c4..2bddad18 100755 --- a/forms/ecomerce/confirm/ui.xml +++ b/forms/ecomerce/confirm/ui.xml @@ -1,12 +1,12 @@ - + CALL basket_get_vat (); - SELECT o.id, o.date_send, o.note, o.company_id, + SELECT o.id, o.date_send sendDate, o.note, o.company_id company, ag.description agency, v.code method, - ad.consignee, ad.zip_code, ad.city, ad.name address, + ad.consignee, ad.zip_code zipCode, ad.city, ad.name address, t.*, c.credit, clientGetDebt() debt FROM basket o JOIN vn2008.Agencias ag ON ag.Id_Agencia = o.agency_id @@ -15,7 +15,7 @@ JOIN customer_view c JOIN ( SELECT - IFNULL(SUM(tax_base), 0) tax_base, + IFNULL(SUM(tax_base), 0) taxBase, IFNULL(SUM(vat + surcharge), 0) vat FROM t_order_vat ) t; @@ -35,23 +35,23 @@

Delivery at - +

Agency - +

- +

- +

- , - + , +

@@ -65,7 +65,7 @@ Previous balance - + @@ -73,7 +73,7 @@ Order total - + @@ -81,7 +81,7 @@ Order VAT - + @@ -97,7 +97,7 @@ Credit - + @@ -105,7 +105,7 @@ Exceeded credit - + @@ -117,19 +117,21 @@
+ id="pay-amount" + lot="lot" + name="payAmount"/>
@@ -141,6 +143,7 @@
@@ -171,10 +174,8 @@ Make a transfer to one account. - - SELECT description, iban, entity_id, office, dc, number - FROM vn2008.account_customer c - + SELECT description, iban, entity_id, office, dc, number + FROM vn2008.account_customer c