Revision 17b4e686
Von Jan Büren vor etwa 3 Jahren hinzugefügt
SL/Controller/CsvImport/Inventory.pm | ||
---|---|---|
53 | 53 |
my ($self) = @_; |
54 | 54 |
|
55 | 55 |
my $all_parts = SL::DB::Manager::Part->get_all; |
56 |
return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_parts } } ) } qw(id partnumber ean description) }; |
|
56 |
return { map { my $col = $_; ( $col => |
|
57 |
{ map { ( $_->$col => $_ ) } grep { defined $_->$col } @{ $all_parts } } ) } qw(id partnumber ean description) }; |
|
57 | 58 |
} |
58 | 59 |
|
59 | 60 |
sub init_warehouses_by { |
... | ... | |
70 | 71 |
my $bins_by; |
71 | 72 |
$bins_by->{_wh_id_and_id_ident()} = { map { ( _wh_id_and_id_maker($_->warehouse_id, $_->id) => $_ ) } @{ $all_bins } }; |
72 | 73 |
$bins_by->{_wh_id_and_description_ident()} = { map { ( _wh_id_and_description_maker($_->warehouse_id, $_->description) => $_ ) } @{ $all_bins } }; |
73 |
|
|
74 | 74 |
return $bins_by; |
75 | 75 |
} |
76 | 76 |
|
... | ... | |
127 | 127 |
|
128 | 128 |
my $object = $entry->{object}; |
129 | 129 |
|
130 |
$self->settings->{apply_warehouse} ||= ''; # avoid warnings if undefined |
|
131 |
|
|
130 | 132 |
# If warehouse from front-end is enforced for all transfers, use this, if valid. |
131 | 133 |
if ($self->settings->{apply_warehouse} eq 'all') { |
132 | 134 |
$object->warehouse_id(undef); |
... | ... | |
185 | 187 |
|
186 | 188 |
my $object = $entry->{object}; |
187 | 189 |
|
190 |
$self->settings->{apply_bin} ||= ''; # avoid warnings if undefined |
|
191 |
|
|
188 | 192 |
# If bin from front-end is enforced for all transfers, use this, if valid. |
189 | 193 |
if ($self->settings->{apply_bin} eq 'all') { |
190 | 194 |
$object->bin_id(undef); |
... | ... | |
217 | 221 |
} |
218 | 222 |
|
219 | 223 |
# Map description to ID if given. |
220 |
if (!$object->bin_id && $entry->{raw_data}->{bin}) { |
|
224 |
if (!$object->bin_id && $entry->{raw_data}->{bin} && $object->warehouse_id) {
|
|
221 | 225 |
my $bin = $self->bins_by->{_wh_id_and_description_ident()}->{ _wh_id_and_description_maker($object->warehouse_id, $entry->{raw_data}->{bin}) }; |
222 | 226 |
if (!$bin) { |
223 | 227 |
push @{ $entry->{errors} }, $::locale->text('Error: Invalid bin'); |
Auch abrufbar als: Unified diff
Lagerbewegungsimport: Testfehler wg. undef vermeiden