From 2387a1fccb259789836aa1a9da44528be4d63bec Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 15 Jan 2007 11:02:45 +0000 Subject: [PATCH] =?utf8?q?Beim=20Aufrufen=20der=20Masken=20f=C3=BCr=20Dial?= =?utf8?q?ogbuchen,=20Debitoren-=20und=20Kreditorenrechnungen=20wird=20das?= =?utf8?q?=20zuletzt=20bebuchte=20Datum=20als=20Datum=20f=C3=BCr=20die=20n?= =?utf8?q?eue=20Maske=20ausgew=C3=A4hlt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/AP.pm | 20 ++++++++++++++++++++ SL/AR.pm | 20 ++++++++++++++++++++ SL/GL.pm | 15 ++++++++------- bin/mozilla/ap.pl | 1 + bin/mozilla/ar.pl | 1 + 5 files changed, 50 insertions(+), 7 deletions(-) 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(); -- 2.20.1