Beim Aufrufen der Masken für Dialogbuchen, Debitoren- und Kreditorenrechnungen wird...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 15 Jan 2007 11:02:45 +0000 (11:02 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 15 Jan 2007 11:02:45 +0000 (11:02 +0000)
SL/AP.pm
SL/AR.pm
SL/GL.pm
bin/mozilla/ap.pl
bin/mozilla/ar.pl

index b0e0440..6925c20 100644 (file)
--- 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;
 
index 3240fb7..5c588f3 100644 (file)
--- 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;
 
index c8c1ffe..2b9a67a 100644 (file)
--- 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|;
index b8d6777..a18c638 100644 (file)
@@ -79,6 +79,7 @@ sub add {
     unless $form->{callback};
 
   &create_links;
+  AP->get_transdate(\%myconfig, $form);
   &display_form;
 
   $lxdebug->leave_sub();
index 3b45404..4fb3d51 100644 (file)
@@ -79,6 +79,7 @@ sub add {
     unless $form->{callback};
 
   &create_links;
+  AR->get_transdate(\%myconfig, $form);
   &display_form;
 
   $lxdebug->leave_sub();