From: Moritz Bunkus Date: Mon, 15 Jan 2007 11:02:45 +0000 (+0000) Subject: Beim Aufrufen der Masken für Dialogbuchen, Debitoren- und Kreditorenrechnungen wird... X-Git-Tag: release-2.4.1~1^2~40 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/2387a1fccb259789836aa1a9da44528be4d63bec?ds=inline Beim Aufrufen der Masken für Dialogbuchen, Debitoren- und Kreditorenrechnungen wird das zuletzt bebuchte Datum als Datum für die neue Maske ausgewählt. --- diff --git a/SL/AP.pm b/SL/AP.pm index b0e044032..6925c20d1 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -470,5 +470,25 @@ sub ap_transactions { $main::lxdebug->leave_sub(); } +sub get_transdate { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form) = @_; + + # connect to database + my $dbh = $form->dbconnect($myconfig); + + my $query = + "SELECT COALESCE(" . + " (SELECT transdate FROM gl WHERE id = " . + " (SELECT MAX(id) FROM gl) LIMIT 1), " . + " current_date)"; + ($form->{transdate}) = $dbh->selectrow_array($query); + + $dbh->disconnect; + + $main::lxdebug->leave_sub(); +} + 1; diff --git a/SL/AR.pm b/SL/AR.pm index 3240fb77c..5c588f37d 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -475,5 +475,25 @@ sub ar_transactions { $main::lxdebug->leave_sub(); } +sub get_transdate { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form) = @_; + + # connect to database + my $dbh = $form->dbconnect($myconfig); + + my $query = + "SELECT COALESCE(" . + " (SELECT transdate FROM gl WHERE id = " . + " (SELECT MAX(id) FROM gl) LIMIT 1), " . + " current_date)"; + ($form->{transdate}) = $dbh->selectrow_array($query); + + $dbh->disconnect; + + $main::lxdebug->leave_sub(); +} + 1; diff --git a/SL/GL.pm b/SL/GL.pm index c8c1ffeae..2b9a67a40 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -646,13 +646,14 @@ sub transaction { $sth->finish; } else { - $query = "SELECT current_date AS transdate, closedto, revtrans - FROM defaults"; - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - ($form->{transdate}, $form->{closedto}, $form->{revtrans}) = - $sth->fetchrow_array; + $query = "SELECT closedto, revtrans FROM defaults"; + ($form->{closedto}, $form->{revtrans}) = $dbh->selectrow_array($query); + $query = + "SELECT COALESCE(" . + " (SELECT transdate FROM gl WHERE id = " . + " (SELECT MAX(id) FROM gl) LIMIT 1), " . + " current_date)"; + ($form->{transdate}) = $dbh->selectrow_array($query); # get tax description $query = qq| SELECT * FROM tax t order by t.taxkey|; diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index b8d677735..a18c638a7 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -79,6 +79,7 @@ sub add { unless $form->{callback}; &create_links; + AP->get_transdate(\%myconfig, $form); &display_form; $lxdebug->leave_sub(); diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 3b4540457..4fb3d5171 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -79,6 +79,7 @@ sub add { unless $form->{callback}; &create_links; + AR->get_transdate(\%myconfig, $form); &display_form; $lxdebug->leave_sub();