From: Moritz Bunkus Date: Thu, 24 Feb 2011 08:54:15 +0000 (+0100) Subject: CSV-Importmasken um typspezifische Eingabefelder erweitert X-Git-Tag: release-2.7.0beta1~396^2~56 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1abd784542136a7ce095ae97c754aae088acf1bb;p=kivitendo-erp.git CSV-Importmasken um typspezifische Eingabefelder erweitert --- diff --git a/SL/Controller/CsvImport.pm b/SL/Controller/CsvImport.pm index 6bacf9242..d11747ad5 100644 --- a/SL/Controller/CsvImport.pm +++ b/SL/Controller/CsvImport.pm @@ -2,6 +2,7 @@ package SL::Controller::CsvImport; use strict; +use SL::DB::Buchungsgruppe; use SL::DB::CsvImportProfile; use SL::Helper::Flash; @@ -11,7 +12,7 @@ use parent qw(SL::Controller::Base); use Rose::Object::MakeMethods::Generic ( - scalar => [ qw(type profile all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars) ], + scalar => [ qw(type profile all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars all_buchungsgruppen) ], ); __PACKAGE__->run_before('check_auth'); @@ -110,9 +111,11 @@ sub render_inputs { my $title = $self->type eq 'customers_vendors' ? $::locale->text('CSV import: customers and vendors') : $self->type eq 'addresses' ? $::locale->text('CSV import: shipping addresses') : $self->type eq 'contacts' ? $::locale->text('CSV import: contacts') - : $self->type eq 'parts' ? $::locale->text('CSV import: parts, services and assemblies') + : $self->type eq 'parts' ? $::locale->text('CSV import: parts and services') : die; + $self->all_buchungsgruppen(SL::DB::Manager::Buchungsgruppe->get_all_sorted); + $self->render('csv_import/form', title => $title); } diff --git a/SL/DB/CsvImportProfile.pm b/SL/DB/CsvImportProfile.pm index c7c0f91ea..58e3d6838 100644 --- a/SL/DB/CsvImportProfile.pm +++ b/SL/DB/CsvImportProfile.pm @@ -38,19 +38,21 @@ sub set_defaults { escape_char => '"', charset => 'CP850', numberformat => $::myconfig{numberformat}, + duplicates => 'no_check', ); if ($self->type eq 'parts') { - my $bugru = SL::DB::Manager::Buchungsgruppe->find_by(name => { like => 'Standard%19%' }); + my $bugru = SL::DB::Manager::Buchungsgruppe->find_by(description => { like => 'Standard%19%' }); $self->_set_defaults(sellprice_places => 2, sellprice_adjustment => 0, sellprice_adjustment_type => 'percent', - article_number_policy => 'update_price', - price_group_sep_char => '!', - shoparticle_if_missing => 0, + article_number_policy => 'update_prices', + part_group_sep_char => '!', + shoparticle_if_missing => '0', parts_type => 'part', - default_buchungsgruppe => ($bugru ? $bugru->name : undef), + default_buchungsgruppe => ($bugru ? $bugru->description : undef), + apply_buchungsgruppe => 'all', ); } else { $self->_set_defaults(table => 'customer'); diff --git a/templates/webpages/csv_import/_form_customers_vendors.html b/templates/webpages/csv_import/_form_customers_vendors.html new file mode 100644 index 000000000..f53dcf3c9 --- /dev/null +++ b/templates/webpages/csv_import/_form_customers_vendors.html @@ -0,0 +1,7 @@ + + [%- LxERP.t8('Target table') %]: + + [% opts = [ [ 'customer', LxERP.t8('Customers') ], [ 'vendor', LxERP.t8('Vendors') ] ] %] + [% L.select_tag('settings.table', L.options_for_select(opts, default => SELF.profile.get('table')), style => 'width: 300px') %] + + diff --git a/templates/webpages/csv_import/_form_parts.html b/templates/webpages/csv_import/_form_parts.html new file mode 100644 index 000000000..26465aa9e --- /dev/null +++ b/templates/webpages/csv_import/_form_parts.html @@ -0,0 +1,57 @@ + + [%- LxERP.t8('Parts with existing part numbers') %]: + + [% opts = [ [ 'update_prices', LxERP.t8('Update prices of existing entries') ], [ 'insert_new', LxERP.t8('Insert with new part number') ] ] %] + [% L.select_tag('settings.article_number_policy', L.options_for_select(opts, default => SELF.profile.get('article_number_policy')), style => 'width: 300px') %] + + + + + [%- LxERP.t8('Sellprice significant places') %]: + + [% L.select_tag('settings.sellprice_places', L.options_for_select([ 0, 1, 2, 3, 4, 5 ], default => SELF.profile.get('sellprice_places')), style => 'width: 300px') %] + + + + + [%- LxERP.t8('Sellprice adjustment') %]: + + [% L.input_tag('settings.sellprice_adjustment', LxERP.format_amount(SELF.profile.get('sellprice_adjustment')), size => "5") %] + [% opts = [ [ 'percent', LxERP.t8('percental') ], [ 'absolute', LxERP.t8('absolute') ] ] %] + [% L.select_tag('settings.sellprice_adjustment_type', L.options_for_select(opts, default => SELF.profile.get('sellprice_adjustment_type'))) %] + + + + + [%- LxERP.t8('Separator for part groups') %]: + + [% L.input_tag('settings.part_group_sep_char', SELF.profile.get('part_group_sep_char'), size => 5) %] + + + + + [%- LxERP.t8('Mark as shop article if column missing') %]: + + [% opts = [ [ '1', LxERP.t8('yes') ], [ '0', LxERP.t8('no') ] ] %] + [% L.select_tag('settings.shoparticle_if_missing', L.options_for_select(opts, default => SELF.profile.get('shoparticle_if_missing')), style => 'width: 300px') %] + + + + + [%- LxERP.t8('Type') %]: + + [% opts = [ [ 'part', LxERP.t8('Parts') ], [ 'service', LxERP.t8('Services') ], [ 'mixed', LxERP.t8('Mixed (requires column "type")') ] ] %] + [% L.select_tag('settings.parts_type', L.options_for_select(opts, default => SELF.profile.get('parts_type')), style => 'width: 300px') %] + + + + + [%- LxERP.t8('Default buchungsgruppe') %]: + + [% opts = L.options_for_select(SELF.all_buchungsgruppen, tilte => 'description', value => 'description', default => SELF.profile.get('default_buchungsgruppe')) %] + [% L.select_tag('settings.default_buchungsgruppe', opts, style => 'width: 300px') %] +
+ [% opts = [ [ 'never', LxERP.t8('Do not set default buchungsgruppe') ], [ 'all', LxERP.t8('Apply to all parts') ], [ 'missing', LxERP.t8('Apply to parts without buchungsgruppe') ] ] %] + [% L.select_tag('settings.apply_buchungsgruppe', L.options_for_select(opts, default => SELF.profile.get('apply_buchungsgruppe')), style => 'width: 300px') %] + + diff --git a/templates/webpages/csv_import/form.html b/templates/webpages/csv_import/form.html index 0725a3f3c..32e91dbd1 100644 --- a/templates/webpages/csv_import/form.html +++ b/templates/webpages/csv_import/form.html @@ -109,6 +109,22 @@ + + [%- LxERP.t8('Check for duplicates') %]: + + [% opts = [ [ 'no_check', LxERP.t8('Do not check for duplicates') ], + [ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ], + [ 'check_db', LxERP.t8('Discard entries with duplicates in database and CSV file') ] ] %] + [% L.select_tag('settings.duplicates', L.options_for_select(opts, default => SELF.profile.get('duplicates')), style => 'width: 300px') %] + + + +[%- IF SELF.type == 'parts' %] + [%- INCLUDE 'csv_import/_form_parts.html' %] +[%- ELSIF SELF.type == 'customers_vendors' %] + [%- INCLUDE 'csv_import/_form_customers_vendors.html' %] +[%- END %] + [% L.submit_tag('action_test', LxERP.t8('Gogogo')) %]