7430_devToTest #2490

Merged
alexm merged 306 commits from 7430_devToTest into test 2024-05-21 09:15:04 +00:00
3 changed files with 73 additions and 40 deletions
Showing only changes of commit d6451a94e3 - Show all commits

View File

@ -22,7 +22,6 @@ BEGIN
containerFk,
comissionValue,
packageValue,
packageFk,
price1,
price2,
price3,
@ -45,7 +44,6 @@ BEGIN
b.containerFk,
b.comissionValue,
b.packageValue,
b.packageFk,
b.price1,
b.price2,
b.price3,

View File

@ -1,23 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_cloneByBuy`(
OUT vBuyClonedFk INT,
IN vSelf INT,
IN vEntryFk INT
)
BEGIN
/**
* Clone a buy to an entry
*
* @param OUT vBuyClonedFk The new cloned buy id
* @param vSelf The buy id to clone
* @param vEntryFk The destination entry id
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.buy
SELECT vSelf id;
CALL buy_clone(vEntryFk);
SET vBuyClonedFk = LAST_INSERT_ID();
DROP TEMPORARY TABLE tmp.buy;
END$$
DELIMITER ;

View File

@ -308,21 +308,79 @@ BEGIN
WHERE id = vTargetItemShelvingFk;
END IF;
CALL buy_cloneByBuy(vA1BuyFk, vLastBuyFk, vTargetEntryFk);
UPDATE buy
SET quantity = - LEAST(vQuantity,vCurrentVisible),
isIgnored = TRUE,
buyingValue = vBuyingValue
WHERE id = vA1BuyFk;
CALL buy_cloneByBuy(vA2BuyFk, vLastBuyFk, vTargetEntryFk);
UPDATE buy
SET quantity = vQuantity,
isIgnored = TRUE,
buyingValue = vBuyingValue,
itemFk = vItemA2Fk
WHERE id = vA2BuyFk;
INSERT INTO buy(
entryFk,
itemFk,
quantity,
buyingValue,
freightValue,
isIgnored,
stickers,
packagingFk,
packing,
`grouping`,
groupingMode,
containerFk,
comissionValue,
packageValue,
price1,
price2,
price3,
minPrice,
isChecked,
location,
weight,
itemOriginalFk)
SELECT vTargetEntryFk,
itemFk,
- LEAST(vQuantity, vCurrentVisible),
vBuyingValue,
freightValue,
TRUE,
stickers,
packagingFk,
packing,
`grouping`,
groupingMode,
containerFk,
comissionValue,
packageValue,
price1,
price2,
price3,
minPrice,
isChecked,
location,
weight,
itemOriginalFk
FROM vn.buy
WHERE id = vLastBuyFk
UNION
SELECT vTargetEntryFk,
vItemA2Fk,
vQuantity,
vBuyingValue,
freightValue,
TRUE,
stickers,
packagingFk,
packing,
`grouping`,
groupingMode,
containerFk,
comissionValue,
packageValue,
price1,
price2,
price3,
minPrice,
isChecked,
location,
weight,
itemOriginalFk
FROM vn.buy
WHERE id = vLastBuyFk;
INSERT INTO itemShelving (
itemFk,
shelvingFk,