7691-testToMaster #2703

Merged
alexm merged 268 commits from 7691-testToMaster into master 2024-07-09 05:38:28 +00:00
1 changed files with 18 additions and 8 deletions
Showing only changes of commit d0b926b2c5 - Show all commits

View File

@ -24,6 +24,16 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
UPDATE invoiceIn ii
JOIN entry e ON e.invoiceInFk = ii.id
JOIN duaEntry de ON de.entryFk = e.id
JOIN dua d ON d.id = de.duaFk
SET ii.booked = IFNULL(ii.booked, d.booked),
ii.operated = IFNULL(ii.operated, d.operated),
ii.issued = IFNULL(ii.issued, d.issued),
ii.bookEntried = IFNULL(ii.bookEntried, d.bookEntried)
WHERE d.id = vDuaFk;
SELECT ASIEN INTO vBookEntry FROM dua WHERE id = vDuaFk;
IF vBookEntry IS NULL THEN
@ -72,14 +82,14 @@ BEGIN
),
notBookedEntries AS (
SELECT e.id
FROM entries e
JOIN duaEntry de ON de.entryFk = e.id
JOIN dua d ON d.id = de.duaFk
WHERE d.ASIEN IS NULL)
FROM duaEntry
WHERE duaFk = vDuaFk
AND NOT customsValue
)
SELECT e.id
FROM entries e
LEFT JOIN notBookedEntries nbe ON nbe.id = e.id
WHERE nbe.id IS NULL
LEFT JOIN notBookedEntries nbe ON nbe.entryFk = e.id
WHERE nbe.entryFk IS NULL
) sub ON sub.id = e.id
SET e.isBooked = TRUE,
e.isConfirmed = TRUE;