Revision 1addbc3b
Von Jan Büren vor mehr als 1 Jahr hinzugefügt
SL/Controller/BankTransaction.pm | ||
---|---|---|
853 | 853 |
die ("invalid type") unless $type =~ m/^(ar|ap)$/; |
854 | 854 |
|
855 | 855 |
# recalc and set paid via database query |
856 |
# add: fx_gain and fx_loss |
|
857 | 856 |
my $query = qq|UPDATE $type SET paid = |
858 | 857 |
(SELECT COALESCE(abs(sum(amount)),0) FROM acc_trans |
859 | 858 |
WHERE trans_id = ? |
... | ... | |
865 | 864 |
WHERE id = ?|; |
866 | 865 |
|
867 | 866 |
die if (do_query($::form, $bank_transaction->db->dbh, $query, $trans_id, $trans_id) == -1); |
867 |
|
|
868 |
# undo datepaid if no payment exists |
|
869 |
$query = qq|UPDATE $type SET datepaid = null WHERE ID = ? AND paid = 0|; |
|
870 |
die if (do_query($::form, $bank_transaction->db->dbh, $query, $trans_id) == -1); |
|
868 | 871 |
} |
869 | 872 |
# 4. and delete all (if any) record links |
870 | 873 |
my $rl = SL::DB::Manager::RecordLink->delete_all(where => [ from_id => $bt_id, from_table => 'bank_transactions' ]); |
Auch abrufbar als: Unified diff
Kontoauszug verbuchen rückgängig, datepaid auch auf NULL setzen