X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FController%2FCsvImport%2FPart.pm;h=b5e9185736637ef9793d33ae19686f6a06454927;hb=20392548f2e8ed92478542893df9852d6987e031;hp=33301d140c4991dfb4969398f8c9fe337a87ecec;hpb=85f9e4958564847dc9917345b0437c013a77a6d2;p=kivitendo-erp.git diff --git a/SL/Controller/CsvImport/Part.pm b/SL/Controller/CsvImport/Part.pm index 33301d140..b5e918573 100644 --- a/SL/Controller/CsvImport/Part.pm +++ b/SL/Controller/CsvImport/Part.pm @@ -27,6 +27,24 @@ use Rose::Object::MakeMethods::Generic translation_columns all_pricegroups) ], ); +sub set_profile_defaults { + my ($self) = @_; + + my $bugru = SL::DB::Manager::Buchungsgruppe->find_by(description => { like => 'Standard%19%' }); + + $self->controller->profile->_set_defaults( + sellprice_places => 2, + sellprice_adjustment => 0, + sellprice_adjustment_type => 'percent', + article_number_policy => 'update_prices', + shoparticle_if_missing => '0', + parts_type => 'part', + default_buchungsgruppe => ($bugru ? $bugru->id : undef), + apply_buchungsgruppe => 'all', + ); +}; + + sub init_class { my ($self) = @_; $self->class('SL::DB::Part'); @@ -73,7 +91,7 @@ sub init_parts_by { # } my $parts_by = {}; - my $sth = prepare_execute_query($::form, $::form->get_standard_dbh, 'SELECT partnumber FROM parts'); + my $sth = prepare_execute_query($::form, SL::DB::Object->new->db->dbh, 'SELECT partnumber FROM parts'); while (my ($partnumber) = $sth->fetchrow_array()) { $parts_by->{partnumber}{$partnumber} = 1; } @@ -196,7 +214,7 @@ sub check_buchungsgruppe { return 1 if $object->buchungsgruppen_id; - push @{ $entry->{errors} }, $::locale->text('Error: Buchungsgruppe missing or invalid'); + push @{ $entry->{errors} }, $::locale->text('Error: booking group missing or invalid'); return 0; } @@ -462,7 +480,7 @@ sub init_profile { my ($self) = @_; my $profile = $self->SUPER::init_profile; - delete @{$profile}{qw(alternate assembly bom expense_accno_id income_accno_id inventory_accno_id makemodel priceupdate stockable type)}; + delete @{$profile}{qw(assembly bom expense_accno_id income_accno_id inventory_accno_id makemodel priceupdate stockable type)}; $profile->{"pricegroup_$_"} = '' for 1 .. scalar @{ $_[0]->all_pricegroups }; @@ -488,8 +506,8 @@ sub setup_displayable_columns { $self->add_cvar_columns_to_displayable_columns; $self->add_displayable_columns({ name => 'bin', description => $::locale->text('Bin') }, - { name => 'buchungsgruppen_id', description => $::locale->text('Buchungsgruppe (database ID)') }, - { name => 'buchungsgruppe', description => $::locale->text('Buchungsgruppe (name)') }, + { name => 'buchungsgruppen_id', description => $::locale->text('Booking group (database ID)') }, + { name => 'buchungsgruppe', description => $::locale->text('Booking group (name)') }, { name => 'description', description => $::locale->text('Description') }, { name => 'drawing', description => $::locale->text('Drawing') }, { name => 'ean', description => $::locale->text('EAN') }, @@ -516,7 +534,7 @@ sub setup_displayable_columns { { name => 'price_factor', description => $::locale->text('Price factor (name)') }, { name => 'rop', description => $::locale->text('ROP') }, { name => 'sellprice', description => $::locale->text('Sellprice') }, - { name => 'shop', description => $::locale->text('Shopartikel') }, + { name => 'shop', description => $::locale->text('Shop article') }, { name => 'type', description => $::locale->text('Article type') . ' [3]' }, { name => 'unit', description => $::locale->text('Unit (if missing or empty default unit will be used)') }, { name => 've', description => $::locale->text('Verrechnungseinheit') },