2024-04-16 15:01:14 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_setProblemComponentLack`(
|
2024-04-16 15:01:14 +00:00
|
|
|
vSelf INT
|
|
|
|
)
|
|
|
|
BEGIN
|
|
|
|
/**
|
2024-05-02 16:13:12 +00:00
|
|
|
* Update the problems for sales lines that have or no longer have problems with components,
|
|
|
|
* verify whether all mandatory components are present or not
|
2024-04-16 15:01:14 +00:00
|
|
|
*
|
|
|
|
* @param vSelf Id del sale
|
|
|
|
*/
|
|
|
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
2024-06-27 11:01:42 +00:00
|
|
|
(INDEX(saleFk, isProblemCalcNeeded))
|
2024-04-16 15:01:14 +00:00
|
|
|
ENGINE = MEMORY
|
2024-06-27 11:01:42 +00:00
|
|
|
SELECT vSelf saleFk,
|
|
|
|
sale_hasComponentLack(vSelf) hasProblem,
|
2024-07-31 12:38:12 +00:00
|
|
|
(ticket_isProblemCalcNeeded(ticketFk) AND quantity > 0) isProblemCalcNeeded
|
2024-06-27 11:01:42 +00:00
|
|
|
FROM sale
|
|
|
|
WHERE id = vSelf;
|
2024-05-02 16:13:12 +00:00
|
|
|
|
2024-04-16 15:01:14 +00:00
|
|
|
CALL sale_setProblem('hasComponentLack');
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE tmp.sale;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|