From 31b1b2c2a84f79d030033a3974957a94a11f752c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 29 Dec 2011 15:12:03 +0100 Subject: [PATCH] =?utf8?q?CSV-Import=20von=20Waren:=20Standardeinheit=20f?= =?utf8?q?=C3=BCr=20Zeilen=20ohne=20Einheit=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/CsvImport.pm | 4 +++- SL/Controller/CsvImport/Part.pm | 6 ++++-- locale/de/all | 4 ++-- templates/webpages/csv_import/_form_parts.html | 8 ++++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/SL/Controller/CsvImport.pm b/SL/Controller/CsvImport.pm index b00bcf356..e603faa40 100644 --- a/SL/Controller/CsvImport.pm +++ b/SL/Controller/CsvImport.pm @@ -4,6 +4,7 @@ use strict; use SL::DB::Buchungsgruppe; use SL::DB::CsvImportProfile; +use SL::DB::Unit; use SL::Helper::Flash; use SL::SessionFile; use SL::Controller::CsvImport::Contact; @@ -17,7 +18,7 @@ use parent qw(SL::Controller::Base); use Rose::Object::MakeMethods::Generic ( - scalar => [ qw(type profile file all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars all_buchungsgruppen + scalar => [ qw(type profile file all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars all_buchungsgruppen all_units import_status errors headers raw_data_headers info_headers data num_imported num_importable displayable_columns) ], ); @@ -144,6 +145,7 @@ sub render_inputs { if ($self->{type} eq 'parts') { $self->all_buchungsgruppen(SL::DB::Manager::Buchungsgruppe->get_all_sorted); + $self->all_units(SL::DB::Manager::Unit->get_all_sorted); } $self->setup_help; diff --git a/SL/Controller/CsvImport/Part.pm b/SL/Controller/CsvImport/Part.pm index 5ae7bddcf..c032921cb 100644 --- a/SL/Controller/CsvImport/Part.pm +++ b/SL/Controller/CsvImport/Part.pm @@ -83,7 +83,7 @@ sub init_settings { return { map { ( $_ => $self->controller->profile->get($_) ) } qw(apply_buchungsgruppe default_buchungsgruppe article_number_policy sellprice_places sellprice_adjustment sellprice_adjustment_type - shoparticle_if_missing parts_type) }; + shoparticle_if_missing parts_type default_unit) }; } sub init_all_cvar_configs { @@ -312,6 +312,8 @@ sub check_unit { my $object = $entry->{object}; + $object->unit($self->settings->{default_unit}) unless $object->unit; + # Check whether or unit is valid. if (!$self->units_by->{name}->{ $object->unit }) { push @{ $entry->{errors} }, $::locale->text('Error: Unit missing or invalid'); @@ -442,7 +444,7 @@ sub setup_displayable_columns { { name => 'sellprice', description => $::locale->text('Sellprice') }, { name => 'shop', description => $::locale->text('Shopartikel') }, { name => 'type', description => $::locale->text('Article type (see below)') }, - { name => 'unit', description => $::locale->text('Unit') }, + { name => 'unit', description => $::locale->text('Unit (if missing or empty default unit will be used)') }, { name => 've', description => $::locale->text('Verrechnungseinheit') }, { name => 'weight', description => $::locale->text('Weight') }, ); diff --git a/locale/de/all b/locale/de/all index b8c8999b9..1084c33b9 100644 --- a/locale/de/all +++ b/locale/de/all @@ -557,6 +557,7 @@ $self->{texts} = { 'Default output medium' => 'Standardausgabekanal', 'Default printer' => 'Standarddrucker', 'Default template format' => 'Standardvorlagenformat', + 'Default unit' => 'Standardeinheit', 'Default value' => 'Standardwert', 'Defaults saved.' => 'Die Standardeinstellungen wurden gespeichert.', 'Delete' => 'Löschen', @@ -1969,6 +1970,7 @@ $self->{texts} = { 'Unchecked custom variables will not appear in orders and invoices.' => 'Unmarkierte Variablen werden für diesen Artikel nicht in Aufträgen und Rechnungen angezeigt.', 'Unfinished follow-ups' => 'Nicht erledigte Wiedervorlagen', 'Unit' => 'Einheit', + 'Unit (if missing or empty default unit will be used)' => 'Einheit (falls nicht vorhanden oder leer wird die Standardeinheit benutzt)', 'Unit missing.' => 'Die Einheit fehlt.', 'Unit of measure' => 'Maßeinheit', 'Units marked for deletion will be deleted upon saving.' => 'Einheiten, die zum Löschen markiert sind, werden beim Speichern gelöscht.', @@ -2197,7 +2199,6 @@ $self->{texts} = { 'month' => 'Monatliche Abgabe', 'monthly' => 'monatlich', 'new Window' => 'neues Fenster', - 'next' => 'Nächste', 'no' => 'nein', 'no bestbefore' => 'keine Mindesthaltbarkeit', 'no chargenumber' => 'keine Chargennummer', @@ -2221,7 +2222,6 @@ $self->{texts} = { 'pos_eur' => 'E/ÜR', 'pos_ustva' => 'UStVA', 'posted!' => 'gebucht', - 'prev' => 'Vorherige', 'print' => 'drucken', 'proforma' => 'Proforma', 'project_list' => 'projektliste', diff --git a/templates/webpages/csv_import/_form_parts.html b/templates/webpages/csv_import/_form_parts.html index 129113e9d..4962981b1 100644 --- a/templates/webpages/csv_import/_form_parts.html +++ b/templates/webpages/csv_import/_form_parts.html @@ -50,3 +50,11 @@ [% L.select_tag('settings.apply_buchungsgruppe', L.options_for_select(opts, default => SELF.profile.get('apply_buchungsgruppe')), style => 'width: 300px') %] + + + [%- LxERP.t8('Default unit') %]: + + [% opts = L.options_for_select(SELF.all_units, title => 'name', value => 'name', default => SELF.profile.get('default_unit')) %] + [% L.select_tag('settings.default_unit', opts, style => 'width: 300px') %] + + -- 2.20.1