Revision 696aad9c
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
2167 | 2167 |
|
2168 | 2168 |
my ($self, $dbh, $param) = @_; |
2169 | 2169 |
|
2170 |
my ($key, $bins_key, $q_access, @values);
|
|
2170 |
my ($key, $bins_key); |
|
2171 | 2171 |
|
2172 | 2172 |
if ('' eq ref $param) { |
2173 | 2173 |
$key = $param; |
2174 |
|
|
2174 | 2175 |
} else { |
2175 | 2176 |
$key = $param->{key}; |
2176 | 2177 |
$bins_key = $param->{bins}; |
2177 |
|
|
2178 |
if ($param->{access}) { |
|
2179 |
$q_access = |
|
2180 |
qq| AND EXISTS ( |
|
2181 |
SELECT wa.employee_id |
|
2182 |
FROM warehouse_access wa |
|
2183 |
WHERE (wa.employee_id = (SELECT id FROM employee WHERE login = ?)) |
|
2184 |
AND (wa.warehouse_id = w.id) |
|
2185 |
AND (wa.access IN ('ro', 'rw')))|; |
|
2186 |
push @values, $param->{access}; |
|
2187 |
} |
|
2188 |
|
|
2189 |
if ($param->{no_personal}) { |
|
2190 |
$q_access .= qq| AND (w.personal_warehouse_of IS NULL)|; |
|
2191 |
|
|
2192 |
} elsif ($param->{personal}) { |
|
2193 |
$q_access .= qq| AND (w.personal_warehouse_of = ?)|; |
|
2194 |
push @values, conv_i($param->{personal}); |
|
2195 |
} |
|
2196 | 2178 |
} |
2197 | 2179 |
|
2198 | 2180 |
my $query = qq|SELECT w.* FROM warehouse w |
2199 | 2181 |
WHERE (NOT w.invalid) AND |
2200 | 2182 |
((SELECT COUNT(b.*) FROM bin b WHERE b.warehouse_id = w.id) > 0) |
2201 |
$q_access |
|
2202 | 2183 |
ORDER BY w.sortkey|; |
2203 | 2184 |
|
2204 |
$self->{$key} = selectall_hashref_query($self, $dbh, $query, @values);
|
|
2185 |
$self->{$key} = selectall_hashref_query($self, $dbh, $query); |
|
2205 | 2186 |
|
2206 | 2187 |
if ($bins_key) { |
2207 | 2188 |
$query = qq|SELECT id, description FROM bin WHERE warehouse_id = ?|; |
Auch abrufbar als: Unified diff
Die Tabelle "warehouse_access" gibt es in der offiziellen Version nicht. Fix für Bug 820.