X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FCsvImport%2FPart.pm;h=d337550b0734d6fb314cfe8e268b0bcdc5a56769;hb=9bd7628ee8d5fb6e7243bc73d112fef00151e29d;hp=21a2982160c3caf60150314d8d8499f01fd84455;hpb=5067d7bd31514962af9730b33323b831d87164f8;p=kivitendo-erp.git diff --git a/SL/Controller/CsvImport/Part.pm b/SL/Controller/CsvImport/Part.pm index 21a298216..d337550b0 100644 --- a/SL/Controller/CsvImport/Part.pm +++ b/SL/Controller/CsvImport/Part.pm @@ -40,7 +40,7 @@ sub set_profile_defaults { article_number_policy => 'update_prices', shoparticle_if_missing => '0', part_type => 'part', - parts_classification => 0, + part_classification => 0, default_buchungsgruppe => ($bugru ? $bugru->id : undef), apply_buchungsgruppe => 'all', ); @@ -61,7 +61,7 @@ sub init_bg_by { sub init_classification_by { my ($self) = @_; - my $all_classifications = SL::DB::Manager::PartsClassification->get_all; + my $all_classifications = SL::DB::Manager::PartClassification->get_all; $_->abbreviation($::locale->text($_->abbreviation)) for @{ $all_classifications }; return { map { my $col = $_; ( $col => { map { ( $_->$col => $_ ) } @{ $all_classifications } } ) } qw(id abbreviation) }; } @@ -422,29 +422,29 @@ sub check_part_type { my $part_type = $self->settings->{part_type}; if ($part_type eq 'mixed' && $entry->{raw_data}->{part_type}) { - $part_type = $entry->{raw_data}->{part_type} =~ m/^p/i ? 'part' - : $entry->{raw_data}->{part_type} =~ m/^s/i ? 'service' + $part_type = $entry->{raw_data}->{part_type} =~ m/^p/i ? 'part' + : $entry->{raw_data}->{part_type} =~ m/^s/i ? 'service' : $entry->{raw_data}->{part_type} =~ m/^assem/i ? 'assembly' : $entry->{raw_data}->{part_type} =~ m/^assor/i ? 'assortment' - : $self->settings->{part_type}; + : $self->settings->{part_type}; } my $classification_id = $self->settings->{classification_id}; if ( $entry->{raw_data}->{pclass} && length($entry->{raw_data}->{pclass}) >= 2 ) { - my $abbr1 = substr($entry->{raw_data}->{pclass},0,1); - my $abbr2 = substr($entry->{raw_data}->{pclass},1); + my $abbr1 = substr($entry->{raw_data}->{pclass},0,1); + my $abbr2 = substr($entry->{raw_data}->{pclass},1); - if ( $self->classification_by->{abbreviation}->{$abbr2} ) { - my $tmp_classification_id = $self->classification_by->{abbreviation}->{$abbr2}->id; - $classification_id = $tmp_classification_id if $tmp_classification_id; - } - if ($part_type eq 'mixed') { - $part_type = $abbr1 eq $::locale->text('Part (typeabbreviation)') ? 'part' - : $abbr1 eq $::locale->text('Service (typeabbreviation)') ? 'service' - : $abbr1 eq $::locale->text('Assembly (typeabbreviation)') ? 'assembly' - : $abbr1 eq $::locale->text('Assortment (typeabbreviation)') ? 'assortment' - : undef; - } + if ( $self->classification_by->{abbreviation}->{$abbr2} ) { + my $tmp_classification_id = $self->classification_by->{abbreviation}->{$abbr2}->id; + $classification_id = $tmp_classification_id if $tmp_classification_id; + } + if ($part_type eq 'mixed') { + $part_type = $abbr1 eq $::locale->text('Part (typeabbreviation)') ? 'part' + : $abbr1 eq $::locale->text('Service (typeabbreviation)') ? 'service' + : $abbr1 eq $::locale->text('Assembly (typeabbreviation)') ? 'assembly' + : $abbr1 eq $::locale->text('Assortment (typeabbreviation)') ? 'assortment' + : undef; + } } # when saving income_accno_id or expense_accno_id use ids from the selected @@ -622,7 +622,7 @@ sub handle_pricegroups { foreach my $pricegroup (@{ $self->all_pricegroups }) { $idx++; my $sellprice = $entry->{raw_data}->{"pricegroup_${idx}"}; - next if $sellprice eq ''; + next if ($sellprice // '') eq ''; push @prices, SL::DB::Price->new(pricegroup_id => $pricegroup->id, price => $::form->parse_amount(\%::myconfig, $sellprice)); @@ -748,7 +748,7 @@ sub setup_displayable_columns { { name => 'partnumber', description => $::locale->text('Part Number') }, { name => 'partsgroup_id', description => $::locale->text('Partsgroup (database ID)') }, { name => 'partsgroup', description => $::locale->text('Partsgroup (name)') }, - { name => 'classification_by', description => $::locale->text('Article classification') . ' [3]' }, + { name => 'part_classification',description => $::locale->text('Article classification') . ' [3]' }, { name => 'payment_id', description => $::locale->text('Payment terms (database ID)') }, { name => 'payment', description => $::locale->text('Payment terms (name)') }, { name => 'price_factor_id', description => $::locale->text('Price factor (database ID)') },