Attached Files | I44746_ScaledPrice_V2.patch [^] (4,443 bytes) 2020-08-21 07:24 [Show Content] [Hide Content]From 3b360bc1d60e4b91eba6d6ea13fe9845738ab70e Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Tue, 18 Aug 2020 14:28:19 +0530
Subject: [PATCH] Related to BUG-44746: 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 | 33 ++++++++++++-------
1 file changed, 21 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..3c39c00 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,32 @@ 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;
+ for (i = 0; i < len; i++) {
+ let celem = result.rows.item(i);
+ priceScales.push({
+ id: celem.obdscal_scale_id,
+ promotionDiscount: celem.m_offer_id,
+ itemNo: celem.itemno,
+ percentage: celem.percentage
+ });
+ }
+
+ 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
From d72b9ccfa712fa5f792a73ea97d780c2d3671876 Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Thu, 20 Aug 2020 15:02:37 +0530
Subject: [PATCH] Related to BUG-44746: Changed hardcoded properties to based
on model definition
---
.../js/scaledprice-datahook.js | 22 +++++++++++++------
1 file changed, 15 insertions(+), 7 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 3c39c00..473b65d 100644
--- a/web/org.openbravo.retail.discounts.scaledprice/js/scaledprice-datahook.js
+++ b/web/org.openbravo.retail.discounts.scaledprice/js/scaledprice-datahook.js
@@ -17,14 +17,22 @@ function scaled_data_hook(args, c) {
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);
- priceScales.push({
- id: celem.obdscal_scale_id,
- promotionDiscount: celem.m_offer_id,
- itemNo: celem.itemno,
- percentage: celem.percentage
- });
+ 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);
--
2.20.1
I44746_Combo_V2.patch [^] (7,942 bytes) 2020-08-21 07:24 [Show Content] [Hide Content]From 140145adbc42997ecb1519779f3253a15eca4b62 Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Tue, 18 Aug 2020 14:27:40 +0530
Subject: [PATCH] Related to BUG-44746: 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 | 102 ++++++++++--------
1 file changed, 59 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..f18a1e1 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,26 @@ 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;
+ for (i = 0; i < len; i++) {
+ let celem = result.rows.item(i);
+ families.push({
+ id: celem.obcombo_family_id,
+ priceAdjustment: celem.m_offer_id,
+ name: celem.name,
+ discountType: celem.discount_type,
+ fixedPrice: celem.fixed_price,
+ percentage: celem.percentage,
+ quantity: celem.quantity,
+ fixedDiscount: celem.fixed_discount,
+ sequenceNumber: celem.seqno
+ });
+ }
+
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 +39,47 @@ 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 })
- );
- }
- });
- 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])
- );
- }
+ tx.executeSql(familyProductsQuery, args.params, (trx, result) => {
+ let i,
+ products = [],
+ len = result.rows.length;
+ for (i = 0; i < len; i++) {
+ let celem = result.rows.item(i);
+ products.push({
+ id: celem.obcombo_product_id,
+ obcomboFamily: celem.obcombo_family_id,
+ product: celem.m_product_id
});
- OB.UTIL.HookManager.callbackExecutor(args, c);
}
- );
- }
- );
+
+ 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
From 2dcfec221bdcc6102d17ebf32d43dbc0ea26c329 Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Thu, 20 Aug 2020 15:03:47 +0530
Subject: [PATCH] Related to BUG-44746: Changed hardcoded properties to based
on model definition
---
.../source/combo-datahook.js | 42 +++++++++++--------
1 file changed, 24 insertions(+), 18 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 f18a1e1..b98c62b 100644
--- a/web/org.openbravo.retail.discounts.combo/source/combo-datahook.js
+++ b/web/org.openbravo.retail.discounts.combo/source/combo-datahook.js
@@ -17,19 +17,21 @@ function combo_data_hook(args, c) {
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);
- families.push({
- id: celem.obcombo_family_id,
- priceAdjustment: celem.m_offer_id,
- name: celem.name,
- discountType: celem.discount_type,
- fixedPrice: celem.fixed_price,
- percentage: celem.percentage,
- quantity: celem.quantity,
- fixedDiscount: celem.fixed_discount,
- sequenceNumber: celem.seqno
- });
+ 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 =
@@ -44,13 +46,17 @@ function combo_data_hook(args, c) {
let i,
products = [],
len = result.rows.length;
+
for (i = 0; i < len; i++) {
- let celem = result.rows.item(i);
- products.push({
- id: celem.obcombo_product_id,
- obcomboFamily: celem.obcombo_family_id,
- product: celem.m_product_id
- });
+ 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);
--
2.20.1
I44746_ByTotal_V2.patch [^] (5,575 bytes) 2020-08-21 07:24 [Show Content] [Hide Content]From fa0be6b315c138a787303cebe2a27b26650a72f6 Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Tue, 18 Aug 2020 14:28:50 +0530
Subject: [PATCH] Related to BUG-44746: 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 | 37 ++++++++++++-------
1 file changed, 24 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..965b766 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,39 @@ 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;
+ for (i = 0; i < len; i++) {
+ let celem = result.rows.item(i);
+ freeProducts.push({
+ id: celem.disct_freeproduct_id,
+ promotionDiscount: celem.m_offer_id,
+ product: celem.m_product_id,
+ quantity: celem.HookManagerquantity
+ });
+ }
+
+ 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
From c96f4e28d24fbb2ea5c61396c9b0f21d96df6112 Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Wed, 19 Aug 2020 06:36:19 +0530
Subject: [PATCH] Related to BUG-44746: Fixed quantity property column name in
bytotal datahook
---
.../js/bytotal-datahook.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 965b766..ba1d104 100644
--- a/web/org.openbravo.retail.discounts.bytotal/js/bytotal-datahook.js
+++ b/web/org.openbravo.retail.discounts.bytotal/js/bytotal-datahook.js
@@ -24,7 +24,7 @@ function bytotal_data_hook(args, c) {
id: celem.disct_freeproduct_id,
promotionDiscount: celem.m_offer_id,
product: celem.m_product_id,
- quantity: celem.HookManagerquantity
+ quantity: celem.quantity
});
}
--
2.20.1
From 8e0f3f5fb672e425070c3db7471892bd210d40ae Mon Sep 17 00:00:00 2001
From: Prakash M <prakash@qualiantech.com>
Date: Thu, 20 Aug 2020 15:03:09 +0530
Subject: [PATCH] Related to BUG-44746: Changed hardcoded properties to based
on model definition
---
.../js/bytotal-datahook.js | 22 +++++++++++++------
1 file changed, 15 insertions(+), 7 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 ba1d104..dd36387 100644
--- a/web/org.openbravo.retail.discounts.bytotal/js/bytotal-datahook.js
+++ b/web/org.openbravo.retail.discounts.bytotal/js/bytotal-datahook.js
@@ -18,14 +18,22 @@ function bytotal_data_hook(args, c) {
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);
- freeProducts.push({
- id: celem.disct_freeproduct_id,
- promotionDiscount: celem.m_offer_id,
- product: celem.m_product_id,
- quantity: celem.quantity
- });
+ 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(
--
2.20.1
|