Revision 696aad9c
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
2498 | 2498 |
return 0; |
2499 | 2499 |
} |
2500 | 2500 |
|
2501 |
do_query($form, $dbh, qq|DELETE FROM warehouse_access WHERE warehouse_id = ?|, conv_i($form->{id})); |
|
2502 |
do_query($form, $dbh, qq|DELETE FROM bin WHERE warehouse_id = ?|, conv_i($form->{id})); |
|
2503 |
do_query($form, $dbh, qq|DELETE FROM warehouse WHERE id = ?|, conv_i($form->{id})); |
|
2501 |
do_query($form, $dbh, qq|DELETE FROM bin WHERE warehouse_id = ?|, conv_i($form->{id})); |
|
2502 |
do_query($form, $dbh, qq|DELETE FROM warehouse WHERE id = ?|, conv_i($form->{id})); |
|
2504 | 2503 |
|
2505 | 2504 |
$dbh->commit(); |
2506 | 2505 |
|
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 = ?|; |
bin/mozilla/do.pl | ||
---|---|---|
936 | 936 |
my $units = AM->retrieve_units(\%myconfig, $form, "dimension"); |
937 | 937 |
my $units_data = AM->unit_select_data($units, undef, undef, $part_info->{unit}); |
938 | 938 |
|
939 |
my $access = $auth->check_right($form->{login}, 'all_warehouses') ? undef : $form->{login}; |
|
940 |
|
|
941 | 939 |
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES', |
942 |
'bins' => 'BINS', |
|
943 |
'access' => $access, }); |
|
940 |
'bins' => 'BINS' }); |
|
944 | 941 |
|
945 | 942 |
redo_stock_info('stock_info' => $stock_info, 'add_empty_row' => !$form->{closed}); |
946 | 943 |
|
Auch abrufbar als: Unified diff
Die Tabelle "warehouse_access" gibt es in der offiziellen Version nicht. Fix für Bug 820.