From: Philip Reetz Date: Thu, 9 Jul 2009 10:53:22 +0000 (+0200) Subject: Fehler in der Funktion "Zahlung buchen" bei Kreditoren- und Debitorenbuchungen. X-Git-Tag: release-2.6.1beta1~357 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=939b2613acea28190a853083bd29e3791f0ed835;p=kivitendo-erp.git Fehler in der Funktion "Zahlung buchen" bei Kreditoren- und Debitorenbuchungen. Zahlungsdatum wurde nicht in der Datenbank gespeichert. --- diff --git a/SL/AP.pm b/SL/AP.pm index 206b9fd7a..50afccb52 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -346,8 +346,8 @@ sub post_transaction { } 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; diff --git a/SL/AR.pm b/SL/AR.pm index 68b9c1cbf..7ee12fad2 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -196,7 +196,8 @@ sub post_transaction { } 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 diff --git a/sql/Pg-upgrade2/update_date_paid.sql b/sql/Pg-upgrade2/update_date_paid.sql new file mode 100644 index 000000000..30b251f06 --- /dev/null +++ b/sql/Pg-upgrade2/update_date_paid.sql @@ -0,0 +1,5 @@ +-- @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;