2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_cloneHeader`(
|
|
|
|
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 ;
|