Attached Files | I44855_ByTotal_20Q2.patch [^] (3,130 bytes) 2020-08-21 07:32 [Show Content] [Hide Content]From 3cd23c5b116ef19697c96c3bc096a2352d2aaa3e Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Thu, 20 Aug 2020 18:14:51 +0530
Subject: [PATCH] Related to BUG-44855: In webpos after reload it takes much
time even with incremental refresh false and more data * Much time take for
transformation to backbone models * Fixed by removing backbone transformation
---
.../js/bytotal-datahook.js | 45 +++++++++++++------
1 file changed, 32 insertions(+), 13 deletions(-)
diff --git a/web/org.openbravo.retail.discounts.bytotal/js/bytotal-datahook.js b/web/org.openbravo.retail.discounts.bytotal/js/bytotal-datahook.js
index d621283..dd36387 100644
--- a/web/org.openbravo.retail.discounts.bytotal/js/bytotal-datahook.js
+++ b/web/org.openbravo.retail.discounts.bytotal/js/bytotal-datahook.js
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2019 Openbravo S.L.U.
+ * Copyright (C) 2019-2020 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -12,28 +12,47 @@ function bytotal_data_hook(args, c) {
let freeProductQuery =
'SELECT * FROM DISCT_FREEPRODUCT INNER JOIN M_OFFER ON DISCT_FREEPRODUCT.M_OFFER_ID = M_OFFER.M_OFFER_ID' +
args.baseFilter;
- OB.Dal.query(
- OB.Model.FreeProduct,
- freeProductQuery,
- args.params,
- freeProducts => {
- let freeProductGroups = freeProducts.groupBy(family =>
- family.get('promotionDiscount')
+
+ OB.Data.localDB.transaction(function(tx) {
+ tx.executeSql(freeProductQuery, args.params, (trx, result) => {
+ let i,
+ freeProducts = [],
+ len = result.rows.length;
+
+ function validateBooleanVal(val) {
+ return val === 'false' || val === 'true' ? val === 'true' : val;
+ }
+
+ for (i = 0; i < len; i++) {
+ let celem = result.rows.item(i),
+ celemObj = {};
+ const propertyMap = OB.Model.FreeProduct.prototype.propertyMap;
+ for (let property in propertyMap) {
+ if (propertyMap.hasOwnProperty(property)) {
+ let columnName = propertyMap[property];
+ celemObj[property] = validateBooleanVal(celem[columnName]);
+ }
+ }
+ freeProducts.push(celemObj);
+ }
+
+ let freeProductGroups = _.groupBy(
+ freeProducts,
+ family => family.promotionDiscount
);
+
discounts.forEach(rule => {
rule.freeItems = [];
if (freeProductGroups[rule.id]) {
- rule.freeItems = JSON.parse(
- JSON.stringify(freeProductGroups[rule.id])
- );
+ rule.freeItems = freeProductGroups[rule.id];
rule.freeItems.forEach(
freeItem => (freeItem.product = { id: freeItem.product })
);
}
});
OB.UTIL.HookManager.callbackExecutor(args, c);
- }
- );
+ });
+ });
}
OB.UTIL.HookManager.registerHook(
--
2.20.1
I44855_Combo_20Q2.patch [^] (5,431 bytes) 2020-08-21 07:33 [Show Content] [Hide Content]From bca0d7491766f274a69ec134ce5a1a1305963901 Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Thu, 20 Aug 2020 18:15:07 +0530
Subject: [PATCH] Related to BUG-44855: In webpos after reload it takes much
time even with incremental refresh false and more data * Much time take for
transformation to backbone models * Fixed by removing backbone transformation
---
.../source/combo-datahook.js | 108 +++++++++++-------
1 file changed, 65 insertions(+), 43 deletions(-)
diff --git a/web/org.openbravo.retail.discounts.combo/source/combo-datahook.js b/web/org.openbravo.retail.discounts.combo/source/combo-datahook.js
index d465d4c..b98c62b 100644
--- a/web/org.openbravo.retail.discounts.combo/source/combo-datahook.js
+++ b/web/org.openbravo.retail.discounts.combo/source/combo-datahook.js
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2019 Openbravo S.L.U.
+ * Copyright (C) 2019-2020 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -12,11 +12,28 @@ function combo_data_hook(args, c) {
let comboFamilyQuery =
'SELECT * FROM OBCOMBO_FAMILY INNER JOIN M_OFFER ON OBCOMBO_FAMILY.M_OFFER_ID = M_OFFER.M_OFFER_ID' +
args.baseFilter;
- OB.Dal.query(
- OB.Model.ComboFamily,
- comboFamilyQuery,
- args.params,
- families => {
+ OB.Data.localDB.transaction(function(tx) {
+ tx.executeSql(comboFamilyQuery, args.params, (trx, result) => {
+ let i,
+ families = [],
+ len = result.rows.length;
+
+ function validateBooleanVal(val) {
+ return val === 'false' || val === 'true' ? val === 'true' : val;
+ }
+
+ for (i = 0; i < len; i++) {
+ let celem = result.rows.item(i),
+ celemObj = {};
+ const propertyList = OB.Model.ComboFamily.propertyList;
+ for (let i = 0; i < propertyList.length; i++) {
+ let name = propertyList[i]['name'],
+ column = propertyList[i]['column'];
+ celemObj[name] = validateBooleanVal(celem[column]);
+ }
+ families.push(celemObj);
+ }
+
let familyProductsQuery =
'SELECT * FROM OBCOMBO_PRODUCT INNER JOIN OBCOMBO_FAMILY ON OBCOMBO_PRODUCT.OBCOMBO_FAMILY_ID=OBCOMBO_FAMILY.OBCOMBO_FAMILY_ID' +
' INNER JOIN M_OFFER ON OBCOMBO_FAMILY.M_OFFER_ID=M_OFFER.M_OFFER_ID ' +
@@ -24,46 +41,51 @@ function combo_data_hook(args, c) {
comboFamilyQuery +
') )' +
'ORDER BY PRIORITY, M_OFFER.M_OFFER_ID, OBCOMBO_PRODUCT.OBCOMBO_FAMILY_ID';
- OB.Dal.query(
- OB.Model.ComboProduct,
- familyProductsQuery,
- args.params,
- products => {
- let productGroups = products.groupBy(prod =>
- prod.get('obcomboFamily')
- );
- families.forEach(family => {
- if (productGroups[family.get('id')]) {
- family.set(
- 'familyProducts',
- JSON.parse(JSON.stringify(productGroups[family.get('id')]))
- );
- family
- .get('familyProducts')
- .forEach(
- familyProduct =>
- (familyProduct.product = { id: familyProduct.product })
- );
- }
- });
+ tx.executeSql(familyProductsQuery, args.params, (trx, result) => {
+ let i,
+ products = [],
+ len = result.rows.length;
- let familyGroups = families.groupBy(family =>
- family.get('priceAdjustment')
- );
- discounts.forEach(rule => {
- rule.comboFamilies = [];
- if (familyGroups[rule.id]) {
- rule.comboFamilies = JSON.parse(
- JSON.stringify(familyGroups[rule.id])
- );
- }
- });
- OB.UTIL.HookManager.callbackExecutor(args, c);
+ for (i = 0; i < len; i++) {
+ let celem = result.rows.item(i),
+ celemObj = {};
+ const propertyList = OB.Model.ComboProduct.propertyList;
+ for (let i = 0; i < propertyList.length; i++) {
+ let name = propertyList[i]['name'],
+ column = propertyList[i]['column'];
+ celemObj[name] = validateBooleanVal(celem[column]);
+ }
+ products.push(celemObj);
}
- );
- }
- );
+
+ let productGroups = _.groupBy(products, prod => prod.obcomboFamily);
+
+ families.forEach(family => {
+ if (productGroups[family.id]) {
+ family.familyProducts = productGroups[family.id];
+ family.familyProducts.forEach(
+ familyProduct =>
+ (familyProduct.product = { id: familyProduct.product })
+ );
+ }
+ });
+
+ let familyGroups = _.groupBy(
+ families,
+ family => family.priceAdjustment
+ );
+
+ discounts.forEach(rule => {
+ rule.comboFamilies = [];
+ if (familyGroups[rule.id]) {
+ rule.comboFamilies = familyGroups[rule.id];
+ }
+ });
+ OB.UTIL.HookManager.callbackExecutor(args, c);
+ });
+ });
+ });
}
OB.UTIL.HookManager.registerHook(
--
2.20.1
I44855_ScaledPrice_20Q2.patch [^] (2,955 bytes) 2020-08-21 07:33 [Show Content] [Hide Content]From 4f169f2bc9847591a4f02ea7e937834f0ecc09c0 Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Thu, 20 Aug 2020 18:15:20 +0530
Subject: [PATCH] Related to BUG-44855: In webpos after reload it takes much
time even with incremental refresh false and more data * Much time take for
transformation to backbone models * Fixed by removing backbone transformation
---
.../js/scaledprice-datahook.js | 41 +++++++++++++------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/web/org.openbravo.retail.discounts.scaledprice/js/scaledprice-datahook.js b/web/org.openbravo.retail.discounts.scaledprice/js/scaledprice-datahook.js
index 4431aa1..473b65d 100644
--- a/web/org.openbravo.retail.discounts.scaledprice/js/scaledprice-datahook.js
+++ b/web/org.openbravo.retail.discounts.scaledprice/js/scaledprice-datahook.js
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2019 Openbravo S.L.U.
+ * Copyright (C) 2019-2020 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -12,23 +12,40 @@ function scaled_data_hook(args, c) {
let scaledPriceQuery =
'SELECT * FROM OBDSCAL_SCALE INNER JOIN M_OFFER ON OBDSCAL_SCALE.M_OFFER_ID = M_OFFER.M_OFFER_ID' +
args.baseFilter;
- OB.Dal.query(
- OB.Model.OBDSCAL_Scale,
- scaledPriceQuery,
- args.params,
- priceScales => {
- let scaleGroups = priceScales.groupBy(prod =>
- prod.get('promotionDiscount')
- );
+ OB.Data.localDB.transaction(function(tx) {
+ tx.executeSql(scaledPriceQuery, args.params, (trx, result) => {
+ let i,
+ priceScales = [],
+ len = result.rows.length;
+
+ function validateBooleanVal(val) {
+ return val === 'false' || val === 'true' ? val === 'true' : val;
+ }
+
+ for (i = 0; i < len; i++) {
+ let celem = result.rows.item(i),
+ celemObj = {};
+ const propertyMap = OB.Model.OBDSCAL_Scale.prototype.propertyMap;
+ for (let property in propertyMap) {
+ if (propertyMap.hasOwnProperty(property)) {
+ let columnName = propertyMap[property];
+ celemObj[property] = validateBooleanVal(celem[columnName]);
+ }
+ }
+ priceScales.push(celemObj);
+ }
+
+ let scaleGroups = _.groupBy(priceScales, prod => prod.promotionDiscount);
+
discounts.forEach(rule => {
rule.priceScales = [];
if (scaleGroups[rule.id]) {
- rule.priceScales = JSON.parse(JSON.stringify(scaleGroups[rule.id]));
+ rule.priceScales = scaleGroups[rule.id];
}
});
OB.UTIL.HookManager.callbackExecutor(args, c);
- }
- );
+ });
+ });
}
OB.UTIL.HookManager.registerHook(
--
2.20.1
|