Zahlungsdatum wurde nicht in der Datenbank gespeichert.
}
if ($payments_only) {
- $query = qq|UPDATE ap SET paid = ? WHERE id = ?|;
- do_query($form, $dbh, $query, $form->{invpaid}, conv_i($form->{id}));
+ $query = qq|UPDATE ap SET paid = ?, datepaid = ? WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{invpaid}, $form->{invpaid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id}));
}
my $rc = 1;
} else {
# Record paid amount.
- do_query($form, $dbh, qq|UPDATE ar SET paid = ? WHERE id = ?|, $form->{paid}, conv_i($form->{id}));
+ $query = qq|UPDATE ar SET paid = ?, datepaid = ? WHERE id = ?|;
+ do_query($form, $dbh, $query, $form->{paid}, $form->{paid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id}));
}
# add paid transactions
--- /dev/null
+-- @tag: update_date_paid
+-- @description: Aktualisieren des Zahldatums in der Datenbank bei Kreditoren- und Debitorenbuchungen, wo die Funktion "Zahlung buchen" verwendet wurde
+-- @depends: release_2_6_0
+UPDATE ap a SET datepaid = (SELECT max(ac.transdate) FROM acc_trans ac LEFT JOIN chart c ON (ac.chart_id = c.id) WHERE ac.trans_id=a.id AND c.link LIKE '%paid%') WHERE paid > 0 AND datepaid IS null AND NOT invoice;
+UPDATE ar a SET datepaid = (SELECT max(ac.transdate) FROM acc_trans ac LEFT JOIN chart c ON (ac.chart_id = c.id) WHERE ac.trans_id=a.id AND c.link LIKE '%paid%') WHERE paid > 0 AND datepaid IS null AND NOT invoice;