From efeb279bbb9b6a924b88c89e136fcb750ed6231a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 21 Jul 2010 14:46:36 +0200 Subject: [PATCH] Drafts->list umgeschrieben. Bruacht keine eigene Datenbankverbindung. --- SL/Drafts.pm | 47 +++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/SL/Drafts.pm b/SL/Drafts.pm index 49c7fcde2..891775bc0 100644 --- a/SL/Drafts.pm +++ b/SL/Drafts.pm @@ -125,36 +125,23 @@ sub remove { } sub list { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - my ($dbh, $sth, $query, @values); - - $dbh = $form->dbconnect($myconfig); - - my ($module, $submodule) = $self->get_module($form); - - my @list = (); - $query = - qq|SELECT d.id, d.description, d.itime::timestamp(0) AS itime, | . - qq| e.name AS employee_name | . - qq|FROM drafts d | . - qq|LEFT JOIN employee e ON d.employee_id = e.id | . - qq|WHERE (d.module = ?) AND (d.submodule = ?) | . - qq|ORDER BY d.itime|; - @values = ($module, $submodule); - - $sth = prepare_execute_query($form, $dbh, $query, @values); - - while (my $ref = $sth->fetchrow_hashref()) { - push(@list, $ref); - } - $sth->finish(); - - $dbh->disconnect(); - - $main::lxdebug->leave_sub(); + $::lxdebug->enter_sub; + + my $self = shift; + my $myconfig = shift || \%::myconfig; + my $form = shift || $::form; + my $dbh = $form->get_standard_dbh; + + my @list = selectall_hashref_query($form, $dbh, <get_module($form)); + SELECT d.id, d.description, d.itime::timestamp(0) AS itime, + e.name AS employee_name + FROM drafts d + LEFT JOIN employee e ON d.employee_id = e.id + WHERE (d.module = ?) AND (d.submodule = ?) + ORDER BY d.itime +SQL + + $::lxdebug->leave_sub; return @list; } -- 2.20.1