#6514 - gestDocSupplier #2209

Merged
alexm merged 4 commits from 6514-gestDocSupplier into dev 2024-03-28 07:12:52 +00:00
10 changed files with 38 additions and 5 deletions
Showing only changes of commit 415b829db0 - Show all commits

View File

@ -1980,10 +1980,10 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`)
(5, 1102), (5, 1102),
(9, 1201); (9, 1201);
INSERT INTO `vn`.`professionalCategory` (`id`, `name`, `level`, `dayBreak`) INSERT INTO `vn`.`professionalCategory` (`id`, `description`)
VALUES VALUES
(1, 'employee', NULL, NULL), (1, 'employee'),
(2, 'florist', NULL, NULL); (2, 'florist');
INSERT INTO `vn`.`calendarType` (`id`, `description`, `hoursWeek`, `isPartial`) INSERT INTO `vn`.`calendarType` (`id`, `description`, `hoursWeek`, `isPartial`)
VALUES VALUES

View File

@ -0,0 +1,22 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_checkBooked`(
vSelf INT
)
BEGIN
/**
* Comprueba si una entrada está contabilizada,
* y si lo está retorna un throw.
*
* @param vSelf Id de entrada
*/
DECLARE vIsBooked BOOL;
SELECT isBooked INTO vIsBooked
FROM `entry`
WHERE id = vSelf;
IF vIsBooked THEN
CALL util.throw('Entry is already booked');
END IF;
END$$
DELIMITER ;

View File

@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`buy_beforeDelete`
BEFORE DELETE ON `buy` BEFORE DELETE ON `buy`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
CALL entry_checkBooked(OLD.entryFk);
IF OLD.printedStickers <> 0 THEN IF OLD.printedStickers <> 0 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;

View File

@ -15,6 +15,7 @@ trig: BEGIN
LEAVE trig; LEAVE trig;
END IF; END IF;
CALL entry_checkBooked(NEW.entryFk);
IF NEW.printedStickers <> 0 THEN IF NEW.printedStickers <> 0 THEN
CALL util.throw('it is not possible to create buy lines with printedstickers other than 0'); CALL util.throw('it is not possible to create buy lines with printedstickers other than 0');
END IF; END IF;

View File

@ -13,6 +13,7 @@ trig:BEGIN
LEAVE trig; LEAVE trig;
END IF; END IF;
CALL entry_checkBooked(OLD.entryFk);
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
SELECT defaultEntry INTO vDefaultEntry SELECT defaultEntry INTO vDefaultEntry

View File

@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entry_beforeDelete`
BEFORE DELETE ON `entry` BEFORE DELETE ON `entry`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
CALL entry_checkBooked(OLD.id);
DELETE FROM buy WHERE entryFk = OLD.id; DELETE FROM buy WHERE entryFk = OLD.id;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -7,6 +7,10 @@ BEGIN
DECLARE vPrintedCount INT; DECLARE vPrintedCount INT;
DECLARE vHasDistinctWarehouses BOOL; DECLARE vHasDistinctWarehouses BOOL;
IF NEW.isBooked = OLD.isBooked THEN
CALL entry_checkBooked(OLD.id);
END IF;
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN IF NOT (NEW.travelFk <=> OLD.travelFk) THEN

View File

@ -12,5 +12,5 @@ FROM (
`pc`.`id` = `b`.`workerBusinessProfessionalCategoryFk` `pc`.`id` = `b`.`workerBusinessProfessionalCategoryFk`
) )
) )
WHERE `pc`.`name` = 'Aux ventas' WHERE `pc`.`description` = 'Aux ventas'
GROUP BY `b`.`workerFk` GROUP BY `b`.`workerFk`

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.professionalCategory DROP COLUMN dayBreak, DROP COLUMN `level`;
ALTER TABLE vn.professionalCategory
CHANGE name description varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;