2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-11 07:39:06 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_clone`(IN vSelf INT, OUT newEntryFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* clones an entry.
|
|
|
|
*
|
|
|
|
* @param vSelf The entry id
|
|
|
|
*/
|
|
|
|
DECLARE vNewEntryFk INT;
|
|
|
|
|
2024-05-23 10:39:30 +00:00
|
|
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
|
|
BEGIN
|
|
|
|
ROLLBACK;
|
|
|
|
RESIGNAL;
|
|
|
|
END;
|
|
|
|
|
2024-01-15 11:31:03 +00:00
|
|
|
START TRANSACTION;
|
|
|
|
|
|
|
|
CALL entry_cloneHeader(vSelf, vNewEntryFk, NULL);
|
|
|
|
CALL entry_copyBuys(vSelf, vNewEntryFk);
|
|
|
|
|
|
|
|
COMMIT;
|
2024-07-11 07:39:06 +00:00
|
|
|
SET newEntryFk = vNewEntryFk;
|
2024-01-15 11:31:03 +00:00
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|