From cab8b4ae2744638252ab50ab57003c74bdd23b3e Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Fri, 11 Nov 2016 08:43:37 +0100 Subject: [PATCH] Part CsvImport - Umbenennung parts_type nach part_type --- SL/Controller/CsvImport/Part.pm | 18 ++++++++++-------- scripts/csv-import-from-shell.sh | 4 ++-- t/controllers/csvimport/parts.t | 4 ++-- t/request/post_multipart.t | 4 ++-- t/request/post_multipart_1 | 2 +- templates/webpages/csv_import/_form_parts.html | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/SL/Controller/CsvImport/Part.pm b/SL/Controller/CsvImport/Part.pm index 4a0074812..79a11703c 100644 --- a/SL/Controller/CsvImport/Part.pm +++ b/SL/Controller/CsvImport/Part.pm @@ -39,7 +39,7 @@ sub set_profile_defaults { sellprice_adjustment_type => 'percent', article_number_policy => 'update_prices', shoparticle_if_missing => '0', - parts_type => 'part', + part_type => 'part', default_buchungsgruppe => ($bugru ? $bugru->id : undef), apply_buchungsgruppe => 'all', ); @@ -126,7 +126,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 default_unit) }; + shoparticle_if_missing part_type default_unit) }; } sub init_all_cvar_configs { @@ -173,7 +173,8 @@ sub check_objects { } continue { $i++; } - $self->add_columns(qw(type)) if $self->settings->{parts_type} eq 'mixed'; + + $self->add_columns(qw(part_type)) if $self->settings->{part_type} eq 'mixed'; $self->add_columns(qw(buchungsgruppen_id unit)); $self->add_columns(map { "${_}_id" } grep { exists $self->controller->data->[0]->{raw_data}->{$_} } qw (price_factor payment partsgroup warehouse bin)); $self->add_columns(qw(shop)) if $self->settings->{shoparticle_if_missing}; @@ -406,13 +407,14 @@ sub handle_shoparticle { sub check_type { my ($self, $entry) = @_; - my $type = $self->settings->{parts_type}; + my $type = $self->settings->{part_type}; if ($type eq 'mixed' && $entry->{raw_data}->{type}) { - $type = $entry->{raw_data}->{type} =~ m/^p/i ? 'part' - : $entry->{raw_data}->{type} =~ m/^s/i ? 'service' - : $entry->{raw_data}->{type} =~ m/^a/i ? 'assembly' - : undef; + $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/^a/i ? 'assembly' + : $entry->{raw_data}->{part_type} =~ m/^assor/i ? 'assortment' + : undef; } # when saving income_accno_id or expense_accno_id use ids from the selected diff --git a/scripts/csv-import-from-shell.sh b/scripts/csv-import-from-shell.sh index e8a1991c2..db705c89f 100755 --- a/scripts/csv-import-from-shell.sh +++ b/scripts/csv-import-from-shell.sh @@ -66,7 +66,7 @@ function do_curl { # "settings.apply_buchungsgruppe": Buchungsgruppe wo anwenden: # "never", "all", "missing" - # "settings.parts_type": Artikeltyp: "part", "service", "mixed" + # "settings.part_type": Artikeltyp: "part", "service", "mixed" # "settings.article_number_policy": Artikel mit existierender # Artikelnummer: "update_prices", "insert_new" @@ -127,7 +127,7 @@ function do_curl { -F 'settings.default_buchungsgruppe=395' \ -F 'settings.duplicates=no_check' \ -F 'settings.numberformat=1.000,00' \ - -F 'settings.parts_type=part' \ + -F 'settings.part_type=part' \ -F 'settings.sellprice_adjustment=0' \ -F 'settings.sellprice_adjustment_type=percent' \ -F 'settings.sellprice_places=2' \ diff --git a/t/controllers/csvimport/parts.t b/t/controllers/csvimport/parts.t index 92cd875cc..8a27d79c6 100644 --- a/t/controllers/csvimport/parts.t +++ b/t/controllers/csvimport/parts.t @@ -152,7 +152,7 @@ my $settings1 = { sellprice_adjustment_type => 'percent', article_number_policy => 'update_prices', shoparticle_if_missing => '0', - parts_type => 'part', + part_type => 'part', default_buchungsgruppe => ($bugru ? $bugru->id : undef), apply_buchungsgruppe => 'all', }; @@ -162,7 +162,7 @@ my $settings2 = { sellprice_adjustment_type => 'percent', article_number_policy => 'update_parts', shoparticle_if_missing => '0', - parts_type => 'part', + part_type => 'part', default_buchungsgruppe => ($bugru ? $bugru->id : undef), apply_buchungsgruppe => 'missing', default_unit => 'Stck', diff --git a/t/request/post_multipart.t b/t/request/post_multipart.t index 767807b90..bdec8a4ad 100644 --- a/t/request/post_multipart.t +++ b/t/request/post_multipart.t @@ -47,7 +47,7 @@ my $t_cmp = { 'charset' => undef, 'apply_buchungsgruppe' => undef, 'full_preview' => undef, - 'parts_type' => undef, + 'part_type' => undef, 'default_unit' => undef, 'default_buchungsgruppe' => undef, 'duplicates' => undef, @@ -83,7 +83,7 @@ is_deeply $tt, 'charset' => 'UTF-8', 'apply_buchungsgruppe' => 'all', 'full_preview' => '0', - 'parts_type' => 'part', + 'part_type' => 'part', 'default_unit' => 'g', 'default_buchungsgruppe' => '815', 'duplicates' => 'no_check', diff --git a/t/request/post_multipart_1 b/t/request/post_multipart_1 index c3ced0fc8..e471de6ec 100644 --- a/t/request/post_multipart_1 +++ b/t/request/post_multipart_1 @@ -67,7 +67,7 @@ Content-Disposition: form-data; name="settings.shoparticle_if_missing" 0 -----------------------------23281168279961 -Content-Disposition: form-data; name="settings.parts_type" +Content-Disposition: form-data; name="settings.part_type" part -----------------------------23281168279961 diff --git a/templates/webpages/csv_import/_form_parts.html b/templates/webpages/csv_import/_form_parts.html index 8615aa541..a54dd9377 100644 --- a/templates/webpages/csv_import/_form_parts.html +++ b/templates/webpages/csv_import/_form_parts.html @@ -36,7 +36,7 @@ [%- 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', opts, default = SELF.profile.get('parts_type'), style = 'width: 300px') %] + [% L.select_tag('settings.part_type', opts, default = SELF.profile.get('part_type'), style = 'width: 300px') %] -- 2.20.1