Compare commits

...

4 Commits

Author SHA1 Message Date
Robert Ferrús dda603b80f Merge branch 'dev' into 178899-buy_beforeDelete
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-05-03 05:22:44 +00:00
Robert Ferrús fb5c3778c9 Merge branch 'dev' into 178899-buy_beforeDelete
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-05-02 11:34:01 +00:00
Robert Ferrús 826cc837e3 feat: refs #17899
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-05-02 13:31:18 +02:00
Robert Ferrús 795e2250f9 feat: refs #178899 buy_beforeDelete restriction
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-05-02 12:29:13 +02:00
5 changed files with 7 additions and 103 deletions

View File

@ -3790,3 +3790,6 @@ INSERT INTO vn.workerTeam(id, team, workerFk)
INSERT INTO vn.workCenter (id, name, payrollCenterFk, counter, warehouseFk, street, geoFk, deliveryManAdjustment) INSERT INTO vn.workCenter (id, name, payrollCenterFk, counter, warehouseFk, street, geoFk, deliveryManAdjustment)
VALUES(100, 'workCenterOne', 1, NULL, 1, 'gotham', NULL, NULL); VALUES(100, 'workCenterOne', 1, NULL, 1, 'gotham', NULL, NULL);
UPDATE vn.buy
SET printedStickers=NULL;

View File

@ -1,101 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`fv_pca`()
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE vTicketFk INT;
DECLARE vSaleFk INT;
DECLARE vClonTicket INT DEFAULT 0;
DECLARE cur1 CURSOR FOR
SELECT s.ticketFk, s.id
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk
WHERE t.shipped BETWEEN '2020-10-18' AND '2020-10-31'
AND it.code IN ('ANT','ANS','ORQ','TRO')
and t.warehouseFk = 1;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN cur1;
FETCH cur1 INTO vTicketFk, vSaleFk;
WHILE done = 0 DO
SELECT t.id INTO vClonTicket
FROM vn.ticket t
JOIN (SELECT addressFk, shipped FROM vn.ticket WHERE id = vTicketFk) sub USING(addressFk, shipped)
WHERE t.warehouseFk = 44
LIMIT 1;
SELECT vTicketFk, vClonTicket;
IF vClonTicket = 0 THEN
INSERT INTO ticket (
clientFk,
shipped,
addressFk,
agencyModeFk,
nickname,
warehouseFk,
companyFk,
landed,
zoneFk,
zonePrice,
zoneBonus,
routeFk
)
SELECT
clientFk,
shipped,
addressFk,
agencyModeFk,
nickname,
44,
companyFk,
landed,
zoneFk,
zonePrice,
zoneBonus,
routeFk
FROM ticket
WHERE id = vTicketFk;
SET vClonTicket = LAST_INSERT_ID();
SELECT 'lstID', vClonTicket;
/*
INSERT INTO ticketObservation(ticketFk, observationTypeFk, description)
SELECT vTicketFk, ao.observationTypeFk, ao.description
FROM addressObservation ao
JOIN ticket t ON t.addressFk = ao.addressFk
WHERE t.id = vClonTicket;
*/
INSERT INTO ticketLog
SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert',
description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk);
END IF;
UPDATE vn.sale
SET ticketFk = vClonTicket
WHERE id = vSaleFk;
SET vClonTicket = 0;
SET done = 0;
FETCH cur1 INTO vTicketFk, vSaleFk;
END WHILE;
CLOSE cur1;
END$$
DELIMITER ;

View File

@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_beforeDelete`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
CALL entry_checkBooked(OLD.entryFk); CALL entry_checkBooked(OLD.entryFk);
IF OLD.printedStickers <> 0 THEN IF OLD.printedStickers IS NOT NULL THEN
CALL util.throw("it is not possible to delete buys with printed labels "); CALL util.throw("it is not possible to delete buys with printed labels ");
END IF; END IF;
END$$ END$$

View File

@ -0,0 +1 @@
ALTER TABLE vn.buy MODIFY COLUMN printedStickers int(10) unsigned DEFAULT NULL NULL;

View File

@ -30,6 +30,7 @@ describe('Travel cloneWithEntries()', () => {
await models.Entry.destroyAll({ await models.Entry.destroyAll({
travelFk: newTravelId travelFk: newTravelId
}, options); }, options);
await models.Travel.destroyById(newTravelId, options); await models.Travel.destroyById(newTravelId, options);
await tx.rollback(); await tx.rollback();
const travelRemoved = await models.Travel.findById(newTravelId, options); const travelRemoved = await models.Travel.findById(newTravelId, options);