Revision efeb279b
Von Sven Schöling vor mehr als 14 Jahren hinzugefügt
SL/Drafts.pm | ||
---|---|---|
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
sub list { |
128 |
$main::lxdebug->enter_sub(); |
|
129 |
|
|
130 |
my ($self, $myconfig, $form) = @_; |
|
131 |
|
|
132 |
my ($dbh, $sth, $query, @values); |
|
133 |
|
|
134 |
$dbh = $form->dbconnect($myconfig); |
|
135 |
|
|
136 |
my ($module, $submodule) = $self->get_module($form); |
|
137 |
|
|
138 |
my @list = (); |
|
139 |
$query = |
|
140 |
qq|SELECT d.id, d.description, d.itime::timestamp(0) AS itime, | . |
|
141 |
qq| e.name AS employee_name | . |
|
142 |
qq|FROM drafts d | . |
|
143 |
qq|LEFT JOIN employee e ON d.employee_id = e.id | . |
|
144 |
qq|WHERE (d.module = ?) AND (d.submodule = ?) | . |
|
145 |
qq|ORDER BY d.itime|; |
|
146 |
@values = ($module, $submodule); |
|
147 |
|
|
148 |
$sth = prepare_execute_query($form, $dbh, $query, @values); |
|
149 |
|
|
150 |
while (my $ref = $sth->fetchrow_hashref()) { |
|
151 |
push(@list, $ref); |
|
152 |
} |
|
153 |
$sth->finish(); |
|
154 |
|
|
155 |
$dbh->disconnect(); |
|
156 |
|
|
157 |
$main::lxdebug->leave_sub(); |
|
128 |
$::lxdebug->enter_sub; |
|
129 |
|
|
130 |
my $self = shift; |
|
131 |
my $myconfig = shift || \%::myconfig; |
|
132 |
my $form = shift || $::form; |
|
133 |
my $dbh = $form->get_standard_dbh; |
|
134 |
|
|
135 |
my @list = selectall_hashref_query($form, $dbh, <<SQL, $self->get_module($form)); |
|
136 |
SELECT d.id, d.description, d.itime::timestamp(0) AS itime, |
|
137 |
e.name AS employee_name |
|
138 |
FROM drafts d |
|
139 |
LEFT JOIN employee e ON d.employee_id = e.id |
|
140 |
WHERE (d.module = ?) AND (d.submodule = ?) |
|
141 |
ORDER BY d.itime |
|
142 |
SQL |
|
143 |
|
|
144 |
$::lxdebug->leave_sub; |
|
158 | 145 |
|
159 | 146 |
return @list; |
160 | 147 |
} |
Auch abrufbar als: Unified diff
Drafts->list umgeschrieben. Bruacht keine eigene Datenbankverbindung.