Revision 1b3cfa7b
Von Moritz Bunkus vor fast 11 Jahren hinzugefügt
sql/Pg-upgrade2/fix_datepaid_for_sepa_transfers.sql | ||
---|---|---|
1 |
-- @tag: fix_datepaid_for_sepa_transfers |
|
2 |
-- @description: Feld »datepaid« bei via SEPA durchgeführten Transfers richtig setzen |
|
3 |
-- @depends: release_3_0_0 |
|
4 |
UPDATE ar |
|
5 |
SET datepaid = ( |
|
6 |
SELECT MAX(acc.transdate) |
|
7 |
FROM acc_trans acc |
|
8 |
LEFT JOIN chart c ON (c.id = acc.chart_id) |
|
9 |
WHERE (acc.trans_id = ar.id) |
|
10 |
AND (c.link LIKE '%paid%') |
|
11 |
) |
|
12 |
WHERE (ar.amount != 0) |
|
13 |
AND NOT ar.storno |
|
14 |
AND ar.id IN ( |
|
15 |
SELECT sei.ar_id |
|
16 |
FROM sepa_export_items sei |
|
17 |
WHERE (sei.ar_id IS NOT NULL) |
|
18 |
AND sei.executed |
|
19 |
); |
Auch abrufbar als: Unified diff
Feld ar.datepaid bei durch SEPA-Zahlungen nachträglich richtig setzen
Behebt #1925.