feat: #6567 sale_replaceItem adaptado a code

This commit is contained in:
Javi Gallego 2024-01-30 10:03:21 +01:00
parent c96e380ba6
commit f0d4ae604b
3 changed files with 6 additions and 19 deletions

View File

@ -23,9 +23,6 @@ BEGIN
DECLARE vOldPrice DECIMAL(10,2);
DECLARE vOption INT DEFAULT NULL;
DECLARE vNewSaleFk INT;
DECLARE vChangePrice INT DEFAULT 1;
DECLARE vBuyerDiscount INT DEFAULT 4;
DECLARE vManaDiscount INT DEFAULT 3;
DECLARE vForceToGrouping INT DEFAULT 1;
DECLARE vForceToPacking INT DEFAULT 2;
DECLARE vFinalPrice DECIMAL(10,2);
@ -85,16 +82,13 @@ BEGIN
IF vNewPrice IS NULL THEN
CALL util.throw('price retrieval failed');
END IF;
IF vNewPrice > vOldPrice THEN
SET vFinalPrice = vOldPrice;
IF worker_isInDepartment('vt') THEN
SET vOption = vManaDiscount;
ELSE
SET vOption = vBuyerDiscount;
END IF;
SET vOption = 'substitution';
ELSE
SET vFinalPrice = vNewPrice;
SET vOption = vChangePrice;
SET vOption = 'renewPrices';
END IF;
START TRANSACTION;

View File

@ -1,14 +1,5 @@
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_replaceItem`() BEGIN END;
GRANT EXECUTE ON PROCEDURE `vn`.`sale_replaceItem` TO `employee`;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`worker_isInDepartment`()
RETURNS int(11)
DETERMINISTIC
BEGIN
RETURN 1;
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE `vn`.`sale_replaceItem` TO `employee`;
GRANT EXECUTE ON FUNCTION `vn`.`worker_isInDepartment` TO `employee`;
FLUSH PRIVILEGES;

View File

@ -0,0 +1,2 @@
INSERT IGNORE INTO vn.component (id, name, typeFk, classRate, tax, isRenewable, code, isRequired)
VALUES(49, 'sustitución', 4, NULL, NULL, 1, 'substitution', FALSE);