diff --git a/forms/ecomerce/catalog/catalog.js b/forms/ecomerce/catalog/catalog.js index 9800b09d..f1980850 100644 --- a/forms/ecomerce/catalog/catalog.js +++ b/forms/ecomerce/catalog/catalog.js @@ -18,7 +18,7 @@ Hedera.Catalog = new Class if (!localStorage.getItem ('hederaGuest')) { - Hedera.BasketChecker.check (this.conn, this.params, + Hedera.BasketChecker.check (this.conn, this.hash, this.onBasketCheck.bind (this)); } else @@ -46,6 +46,7 @@ Hedera.Catalog = new Class this.onRealmChange (); this.refreshTitle (); + this.onParamsChange (); } ,deactivate: function () @@ -108,28 +109,26 @@ Hedera.Catalog = new Class this.hideMenu (); } - ,onLotChange: function () + ,onParamsChange: function () { - function shouldRefresh (params) - { - return params.search || - params.realm && ( - params.type || - params.color || - params.origin || - params.category || - params.producer - ); - } + var params = this.params.$; + var shouldRefresh = params.search || + params.realm && ( + params.type || + params.color || + params.origin || + params.category || + params.producer + ); - function refreshItems () + if (shouldRefresh) { - this.$('items').refresh (); - } + var filterSql = this.$('filter').render (params); + var modelParams = { + filter: new Sql.String ({query: filterSql}) + }; + this.$('items').refresh (modelParams); - if (shouldRefresh (this.params.$)) - { - refreshItems (); this.hideMenu (); this.$('order').style.display = 'block'; } diff --git a/forms/ecomerce/catalog/style.css b/forms/ecomerce/catalog/style.css index b44fc3bf..ece81502 100644 --- a/forms/ecomerce/catalog/style.css +++ b/forms/ecomerce/catalog/style.css @@ -275,15 +275,15 @@ position: relative; width: 100%; margin: 0; - height: 5.5em; + height: 6.5em; overflow: visible; border-bottom: 1px solid #DDD; } .list-view .item-box > .htk-image { margin: 1em; - width: 3.5em; - height: 3.5em; + width: 4.5em; + height: 4.5em; float: left; overflow: hidden; } @@ -294,7 +294,7 @@ .list-view .item-info { position: absolute; - left: 5.5em; + left: 6.5em; right: 0; top: 0; bottom: 0; diff --git a/forms/ecomerce/catalog/ui.xml b/forms/ecomerce/catalog/ui.xml index 391bf4b3..6ec955c2 100755 --- a/forms/ecomerce/catalog/ui.xml +++ b/forms/ecomerce/catalog/ui.xml @@ -1,6 +1,6 @@ - + @@ -41,8 +41,6 @@ CREATE TEMPORARY TABLE tmp.bionic_calc (INDEX (item_id)) @@ -151,6 +149,9 @@

+

+ +

Size , Category @@ -211,44 +212,6 @@

-
-

Order by

- -

Choose a realm

@@ -342,6 +305,44 @@
+
+

Order by

+ +
diff --git a/js/db/connection.js b/js/db/connection.js index 750df0e7..91c3fc5d 100644 --- a/js/db/connection.js +++ b/js/db/connection.js @@ -47,6 +47,9 @@ Connection.implement */ ,execSql: function (sql, callback) { + if (enableDebug) + console.log (sql); + this.send ('core/query', {'sql': sql}, this._onExec.bind (this, callback)); } diff --git a/js/hedera/basket-checker.js b/js/hedera/basket-checker.js index 6a36c209..d4a2494f 100644 --- a/js/hedera/basket-checker.js +++ b/js/hedera/basket-checker.js @@ -22,6 +22,6 @@ module.exports = if (callback) callback (isOk); if (!isOk) - this.hash.setAll ({'form': 'ecomerce/checkout'}); + this.hash.$ = {form: 'ecomerce/checkout'}; } }; diff --git a/js/hedera/form.js b/js/hedera/form.js index c513da48..66c63569 100644 --- a/js/hedera/form.js +++ b/js/hedera/form.js @@ -40,7 +40,8 @@ module.exports = new Class builder.add ('hash', this.hash); builder.loadXml ('forms/'+ this.formInfo.path +'/ui.xml'); - var res = this.builderResultInit (builder); + var res = this.builder = builder.load (); + this._node = res.$('main'); var paramsLot = res.$('params'); @@ -49,6 +50,8 @@ module.exports = new Class paramsLot.source = this.hash; this.params = paramsLot; } + + res.link (); var models = res.getByTagName ('db-model'); @@ -79,10 +82,10 @@ module.exports = new Class if (this.node) { this.deactivate (); + this.builder.unref (); this.gui.setTitle (null); this.gui.setActions (null); this.gui.setForm (null); - this.deactivate (); this.node = null; this.params = null; } diff --git a/js/vn/lot-query.js b/js/vn/lot-query.js index 53175d13..c4248a18 100644 --- a/js/vn/lot-query.js +++ b/js/vn/lot-query.js @@ -55,6 +55,7 @@ module.exports = new Class throw new Error ('VnLotQuery: Child must be a Vn.Spec instance'); this._specs[child.name] = child; + this._onSourceChange (); } ,_onSourceChange: function () diff --git a/js/vn/vn.js b/js/vn/vn.js index 3a69931f..fbeb9893 100644 --- a/js/vn/vn.js +++ b/js/vn/vn.js @@ -3,6 +3,8 @@ require ('mootools'); require ('./mutators'); require ('./polyfills'); +enableDebug = false; + Vn = module.exports = { Locale : require ('./locale') ,Enum : require ('./enum') diff --git a/rest/tpv/transaction.php b/rest/tpv/transaction.php index 331c3cdf..0cdb1c00 100755 --- a/rest/tpv/transaction.php +++ b/rest/tpv/transaction.php @@ -12,24 +12,24 @@ class Transaction extends Vn\Web\JsonRequest $amount = (int) $_REQUEST['amount']; $companyId = empty ($_REQUEST['company']) ? NULL : $_REQUEST['company']; - $row = $db->getRow ('CALL transactionStart (#, #)', + $row = $db->getObject ('CALL transactionStart (#, #)', [$amount, $companyId]); if (!isset ($row)) throw new Exception ('Transaction error'); - $transactionId = str_pad ($row['transactionId'], 12, '0', STR_PAD_LEFT); + $transactionId = str_pad ($row->transactionId, 12, '0', STR_PAD_LEFT); $urlOk = empty ($_REQUEST['urlOk']) ? '' : sprintf ($_REQUEST['urlOk'], $transactionId); $urlKo = empty ($_REQUEST['urlKo']) ? '' : sprintf ($_REQUEST['urlKo'], $transactionId); - $merchantUrl = $row['merchantUrl'] ? $row['merchantUrl'] : ''; + $merchantUrl = $row->merchantUrl ? $row->merchantUrl : ''; $params = [ 'Ds_Merchant_Amount' => $amount ,'Ds_Merchant_Order' => $transactionId - ,'Ds_Merchant_MerchantCode' => $row['merchant'] - ,'Ds_Merchant_Currency' => $row['currency'] - ,'Ds_Merchant_TransactionType' => $row['transactionType'] - ,'Ds_Merchant_Terminal' => $row['terminal'] + ,'Ds_Merchant_MerchantCode' => $row->merchant + ,'Ds_Merchant_Currency' => $row->currency + ,'Ds_Merchant_TransactionType' => $row->transactionType + ,'Ds_Merchant_Terminal' => $row->terminal ,'Ds_Merchant_MerchantURL' => $merchantUrl ,'Ds_Merchant_UrlOK' => $urlOk ,'Ds_Merchant_UrlKO' => $urlKo @@ -37,7 +37,7 @@ class Transaction extends Vn\Web\JsonRequest $encodedParams = base64_encode (json_encode ($params)); - $key = base64_decode ($row['secretKey']); + $key = base64_decode ($row->secretKey); $bytes = [0, 0, 0, 0, 0, 0, 0, 0]; $iv = implode (array_map ('chr', $bytes)); @@ -45,7 +45,7 @@ class Transaction extends Vn\Web\JsonRequest $signature = base64_encode (hash_hmac ('sha256', $encodedParams, $key, TRUE)); - $url = $row['url']; + $url = $row->url; $postValues = [ 'Ds_SignatureVersion' => 'HMAC_SHA256_V1' ,'Ds_MerchantParameters' => $encodedParams