Part CsvImport - Umbenennung parts_type nach part_type
authorG. Richardson <information@kivitendo-premium.de>
Fri, 11 Nov 2016 07:43:37 +0000 (08:43 +0100)
committerG. Richardson <information@kivitendo-premium.de>
Tue, 22 Nov 2016 13:42:50 +0000 (14:42 +0100)
SL/Controller/CsvImport/Part.pm
scripts/csv-import-from-shell.sh
t/controllers/csvimport/parts.t
t/request/post_multipart.t
t/request/post_multipart_1
templates/webpages/csv_import/_form_parts.html

index 4a00748..79a1170 100644 (file)
@@ -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
index e8a1991..db705c8 100755 (executable)
@@ -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' \
index 92cd875..8a27d79 100644 (file)
@@ -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',
index 767807b..bdec8a4 100644 (file)
@@ -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',
index c3ced0f..e471de6 100644 (file)
@@ -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
index 8615aa5..a54dd93 100644 (file)
@@ -36,7 +36,7 @@
  <th align="right">[%- LxERP.t8('Type') %]:</th>
  <td colspan="10">
   [% 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') %]
  </td>
 </tr>