Compare commits

..

5 Commits

Author SHA1 Message Date
Robert Ferrús ad16eddf6b Merge pull request 'fix: refs #7141 catalog_calculate' (!2207) from 7141-sale_replaceItem into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #2207
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-03-27 10:57:08 +00:00
Robert Ferrús c3e3d72182 Merge branch 'master' into 7141-sale_replaceItem
gitea/salix/pipeline/pr-master This commit looks good Details
2024-03-27 10:53:31 +00:00
Robert Ferrús 8e2770aa56 feat: refs #7141
gitea/salix/pipeline/pr-master This commit looks good Details
2024-03-26 16:27:49 +01:00
Robert Ferrús 3e2e0ccadb Merge branch 'master' into 7141-sale_replaceItem
gitea/salix/pipeline/pr-master This commit looks good Details
2024-03-26 11:00:44 +00:00
Robert Ferrús dd977fab83 fix: refs #7141 catalog_calculate
gitea/salix/pipeline/pr-master This commit looks good Details
2024-03-25 14:56:12 +01:00
10 changed files with 19 additions and 11 deletions

View File

@ -32,7 +32,7 @@ BEGIN
WHERE c.available > 0
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;
END$$

View File

@ -16,7 +16,7 @@ BEGIN
ENGINE = MEMORY
SELECT vSelf itemFk;
CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE);
SELECT l.warehouseFk, w.name warehouse,
p.`grouping`, p.price, p.rate, l.available

View File

@ -27,7 +27,7 @@ BEGIN
WHERE orderFk = vSelf
GROUP BY itemFk;
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode);
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
DROP TEMPORARY TABLE tmp.item;
END$$

View File

@ -22,7 +22,7 @@ BEGIN
FROM `order`
WHERE id = vSelf;
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode);
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
IF account.myUser_getName() = 'visitor' THEN
UPDATE tmp.ticketCalculateItem

View File

@ -20,7 +20,7 @@ BEGIN
ENGINE = MEMORY
SELECT vItemFk itemFk;
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, TRUE);
DROP TEMPORARY TABLE tmp.item;
END$$
DELIMITER ;

View File

@ -1,5 +1,9 @@
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
/**
* Calcula los articulos disponibles y sus precios
@ -25,7 +29,7 @@ BEGIN
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;
CREATE TEMPORARY TABLE tmp.ticketLot(

View File

@ -77,7 +77,9 @@ BEGIN
vNewItemFk);
SELECT price INTO vNewPrice
FROM tmp.ticketCalculateItem;
FROM tmp.ticketComponentPrice
ORDER BY (vQuantity % `grouping`) ASC
LIMIT 1;
IF vNewPrice IS NULL THEN
CALL util.throw('price retrieval failed');

View File

@ -11,7 +11,7 @@ BEGIN
SELECT id itemFk FROM vn.item
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.ticketLot;
END$$

View File

@ -92,10 +92,11 @@ module.exports = Self => {
// Calculate items
const order = await Self.findById(orderFk, null, myOptions);
stmts.push(new ParameterizedSQL(
'CALL vn.catalog_calculate(?, ?, ?)', [
'CALL vn.catalog_calculate(?, ?, ?, ?)', [
order.landed,
order.address_id,
order.agency_id,
false
]
));

View File

@ -64,10 +64,11 @@ module.exports = Self => {
stmts.push(stmt);
stmt = new ParameterizedSQL(
'CALL vn.catalog_calculate(?, ?, ?)', [
'CALL vn.catalog_calculate(?, ?, ?,?)', [
order.landed,
order.addressFk,
order.agencyModeFk,
false
]
);
stmts.push(stmt);