+ $entry->{part} = SL::DB::Manager::Part->get_first( query => [ partnumber => $object->partnumber ], limit => 1,
+ with_objects => [ 'translations', 'custom_variables' ], multi_many_ok => 1
+ );
+ if ( !$entry->{part} ) {
+ $entry->{part} = SL::DB::Manager::Part->get_first( query => [ partnumber => $object->partnumber ], limit => 1,
+ with_objects => [ 'translations' ], multi_many_ok => 1
+ );
+ }
+ }
+
+ if ($entry->{part}) {
+ if ($entry->{part}->type ne $object->type ) {
+ push(@{$entry->{errors}}, $::locale->text('Skipping due to existing entry in database with different type'));
+ return;
+ }
+ if ( $entry->{part}->unit ne $object->unit || $entry->{part}->inventory_accno_id != $object->inventory_accno_id ) {
+ if ( $entry->{part}->onhand != 0 || $self->_part_is_used($entry->{part})) {
+ push(@{$entry->{errors}}, $::locale->text('Skipping due to existing entry with different unit or inventory_accno_id'));
+ return;
+ }
+ }
+ }
+
+ if ($self->settings->{article_number_policy} eq 'update_prices_sn' || $self->settings->{article_number_policy} eq 'update_parts_sn') {
+ if (!$entry->{part}) {
+ push(@{$entry->{errors}}, $::locale->text('Skipping non-existent article'));
+ return;
+ }
+ }
+
+ ## checking also doubles in csv !!
+ foreach my $csventry (@{ $self->controller->data }) {
+ if ( $entry != $csventry && $object->partnumber eq $csventry->{object}->partnumber ) {
+ if ( $csventry->{doublechecked} ) {
+ push(@{$entry->{errors}}, $::locale->text('Skipping due to same partnumber in csv file'));
+ return;
+ }
+ }