Revision 0a02b827
Von Sven Schöling vor mehr als 17 Jahren hinzugefügt
SL/AR.pm | ||
---|---|---|
645 | 645 |
do_query($form, $dbh, $query, $id); |
646 | 646 |
|
647 | 647 |
# now copy acc_trans entries |
648 |
$query = qq|SELECT * FROM acc_trans WHERE trans_id = ?|; |
|
649 |
for my $row (@{ selectall_hashref_query($form, $dbh, $query, $id) }) { |
|
650 |
delete @$row{qw(itime mtime)}; |
|
648 |
$query = qq|SELECT a.*, c.link FROM acc_trans a LEFT JOIN chart c ON a.chart_id = c.id WHERE a.trans_id = ?|; |
|
649 |
my $rowref = selectall_hashref_query($form, $dbh, $query, $id); |
|
650 |
|
|
651 |
# kill all entries containing payments, which are the last 2n rows, of which the last has link =~ /paid/ |
|
652 |
while ($rowref->[-1]{link} =~ /paid/) { |
|
653 |
splice(@$rowref, -2); |
|
654 |
} |
|
655 |
|
|
656 |
for my $row (@$rowref) { |
|
657 |
delete @$row{qw(itime mtime link)}; |
|
651 | 658 |
$query = sprintf 'INSERT INTO acc_trans (%s) VALUES (%s)', join(', ', keys %$row), join(', ', map '?', values %$row); |
652 | 659 |
$row->{trans_id} = $new_id; |
653 | 660 |
$row->{amount} *= -1; |
Auch abrufbar als: Unified diff
Storno Fix nr. 29283574983745
Es werden beim Storno jetzt nur noch die urspruenglichen acc_trans Eintraege storniert,
nachtraegliche Zahlungseingaenge bleiben unberuehrt.