fix: refs #7141 catalog_calculate #2207
|
@ -32,7 +32,7 @@ BEGIN
|
||||||
WHERE c.available > 0
|
WHERE c.available > 0
|
||||||
GROUP BY c.item_id;
|
GROUP BY c.item_id;
|
||||||
|
|
||||||
CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode);
|
CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode, FALSE);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.item;
|
DROP TEMPORARY TABLE tmp.item;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -16,7 +16,7 @@ BEGIN
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT vSelf itemFk;
|
SELECT vSelf itemFk;
|
||||||
|
|
||||||
CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
|
CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE);
|
||||||
|
|
||||||
SELECT l.warehouseFk, w.name warehouse,
|
SELECT l.warehouseFk, w.name warehouse,
|
||||||
p.`grouping`, p.price, p.rate, l.available
|
p.`grouping`, p.price, p.rate, l.available
|
||||||
|
|
|
@ -27,7 +27,7 @@ BEGIN
|
||||||
WHERE orderFk = vSelf
|
WHERE orderFk = vSelf
|
||||||
GROUP BY itemFk;
|
GROUP BY itemFk;
|
||||||
|
|
||||||
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode);
|
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.item;
|
DROP TEMPORARY TABLE tmp.item;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -22,7 +22,7 @@ BEGIN
|
||||||
FROM `order`
|
FROM `order`
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
|
|
||||||
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode);
|
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
|
||||||
|
|
||||||
IF account.myUser_getName() = 'visitor' THEN
|
IF account.myUser_getName() = 'visitor' THEN
|
||||||
UPDATE tmp.ticketCalculateItem
|
UPDATE tmp.ticketCalculateItem
|
||||||
|
|
|
@ -20,7 +20,7 @@ BEGIN
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT vItemFk itemFk;
|
SELECT vItemFk itemFk;
|
||||||
|
|
||||||
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
|
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, TRUE);
|
||||||
DROP TEMPORARY TABLE tmp.item;
|
DROP TEMPORARY TABLE tmp.item;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_calculate`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`catalog_calculate`(
|
||||||
|
vLanded DATE,
|
||||||
|
vAddressFk INT,
|
||||||
|
vAgencyModeFk INT,
|
||||||
|
vShowExpiredZones BOOLEAN)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula los articulos disponibles y sus precios
|
* Calcula los articulos disponibles y sus precios
|
||||||
|
@ -25,7 +29,7 @@ BEGIN
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE);
|
CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, vShowExpiredZones);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot(
|
CREATE TEMPORARY TABLE tmp.ticketLot(
|
||||||
|
|
|
@ -77,7 +77,9 @@ BEGIN
|
||||||
vNewItemFk);
|
vNewItemFk);
|
||||||
|
|
||||||
SELECT price INTO vNewPrice
|
SELECT price INTO vNewPrice
|
||||||
FROM tmp.ticketCalculateItem;
|
FROM tmp.ticketComponentPrice
|
||||||
|
ORDER BY (vQuantity % `grouping`) ASC
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
IF vNewPrice IS NULL THEN
|
IF vNewPrice IS NULL THEN
|
||||||
CALL util.throw('price retrieval failed');
|
CALL util.throw('price retrieval failed');
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
||||||
SELECT id itemFk FROM vn.item
|
SELECT id itemFk FROM vn.item
|
||||||
WHERE typeFk = vTypeFk;
|
WHERE typeFk = vTypeFk;
|
||||||
|
|
||||||
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
|
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE);
|
||||||
DROP TEMPORARY TABLE tmp.item;
|
DROP TEMPORARY TABLE tmp.item;
|
||||||
DROP TEMPORARY TABLE tmp.ticketLot;
|
DROP TEMPORARY TABLE tmp.ticketLot;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -92,10 +92,11 @@ module.exports = Self => {
|
||||||
// Calculate items
|
// Calculate items
|
||||||
const order = await Self.findById(orderFk, null, myOptions);
|
const order = await Self.findById(orderFk, null, myOptions);
|
||||||
stmts.push(new ParameterizedSQL(
|
stmts.push(new ParameterizedSQL(
|
||||||
'CALL vn.catalog_calculate(?, ?, ?)', [
|
'CALL vn.catalog_calculate(?, ?, ?, ?)', [
|
||||||
order.landed,
|
order.landed,
|
||||||
order.address_id,
|
order.address_id,
|
||||||
order.agency_id,
|
order.agency_id,
|
||||||
|
false
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -64,10 +64,11 @@ module.exports = Self => {
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(
|
stmt = new ParameterizedSQL(
|
||||||
'CALL vn.catalog_calculate(?, ?, ?)', [
|
'CALL vn.catalog_calculate(?, ?, ?,?)', [
|
||||||
order.landed,
|
order.landed,
|
||||||
order.addressFk,
|
order.addressFk,
|
||||||
order.agencyModeFk,
|
order.agencyModeFk,
|
||||||
|
false
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
|
|
Loading…
Reference in New Issue