2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_cloneHeader`(
|
2024-01-15 11:31:03 +00:00
|
|
|
vSelf INT,
|
|
|
|
OUT vNewEntryFk INT,
|
|
|
|
vTravelFk INT
|
|
|
|
)
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Clones an entry header.
|
|
|
|
*
|
|
|
|
* @param vSelf The entry id
|
2024-03-15 13:46:43 +00:00
|
|
|
* @param OUT vNewEntryFk The new entry id
|
2024-01-15 11:31:03 +00:00
|
|
|
* @param vTravelFk Travel for the new entry or %NULL to use the source entry travel
|
|
|
|
*/
|
|
|
|
INSERT INTO entry(
|
|
|
|
travelFk,
|
|
|
|
supplierFk,
|
|
|
|
dated,
|
|
|
|
isExcludedFromAvailable,
|
|
|
|
isRaid,
|
|
|
|
commission,
|
|
|
|
currencyFk,
|
|
|
|
companyFk,
|
|
|
|
clonedFrom,
|
|
|
|
typeFk
|
|
|
|
)
|
|
|
|
SELECT IFNULL(vTravelFk, travelFk),
|
|
|
|
supplierFk,
|
|
|
|
dated,
|
|
|
|
isExcludedFromAvailable,
|
|
|
|
isRaid,
|
|
|
|
commission,
|
|
|
|
currencyFk,
|
|
|
|
companyFk,
|
|
|
|
vSelf,
|
|
|
|
typeFk
|
|
|
|
FROM entry
|
|
|
|
WHERE id = vSelf;
|
|
|
|
|
|
|
|
SET vNewEntryFk = LAST_INSERT_ID();
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|