]> wagnertech.de Git - mfinanz.git/commitdiff
CSV-Helper: Vergessenes Feld "raw_input" bei einigen Fehlermeldungen übergeben …
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 9 Jun 2021 11:03:20 +0000 (13:03 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 9 Jun 2021 11:53:47 +0000 (13:53 +0200)
… Auch, wenn es undefniert ist, aber sonst stimmen die Felder nicht bei
der Fehlerausgabe.

SL/Helper/Csv.pm
t/helper/csv.t

index e9fd45c6a24106cc850442f86d692e22ddb4969c..0d471eb09b740865de3d848a7db96770d6768275 100644 (file)
@@ -114,6 +114,7 @@ sub _check_multiplexed {
       # Each profile needs a class and a row_ident
       my $info_ok = all { defined $_->{class} && defined $_->{row_ident} } @profile;
       $self->_push_error([
       # Each profile needs a class and a row_ident
       my $info_ok = all { defined $_->{class} && defined $_->{row_ident} } @profile;
       $self->_push_error([
+        undef,
         0,
         "missing class or row_ident in one of the profiles for multiplexed data",
         0,
         0,
         "missing class or row_ident in one of the profiles for multiplexed data",
         0,
@@ -125,6 +126,7 @@ sub _check_multiplexed {
         my @header = @{ $self->header };
         my $t_ok = scalar @profile == scalar @header;
         $self->_push_error([
         my @header = @{ $self->header };
         my $t_ok = scalar @profile == scalar @header;
         $self->_push_error([
+          undef,
           0,
           "number of headers and number of profiles must be the same for multiplexed data",
           0,
           0,
           "number of headers and number of profiles must be the same for multiplexed data",
           0,
@@ -133,6 +135,7 @@ sub _check_multiplexed {
 
         $t_ok = all { scalar @$_ > 0} @header;
         $self->_push_error([
 
         $t_ok = all { scalar @$_ > 0} @header;
         $self->_push_error([
+          undef,
           0,
           "no empty headers are allowed for multiplexed data",
           0,
           0,
           "no empty headers are allowed for multiplexed data",
           0,
@@ -231,7 +234,8 @@ sub _check_multiplex_datatype_position {
     $self->_multiplex_datatype_position($first_pos);
     return 1;
   } else {
     $self->_multiplex_datatype_position($first_pos);
     return 1;
   } else {
-    $self->_push_error([0,
+    $self->_push_error([undef,
+                        0,
                         "datatype field must be at the same position for all datatypes for multiplexed data",
                         0,
                         0]);
                         "datatype field must be at the same position for all datatypes for multiplexed data",
                         0,
                         0]);
@@ -254,6 +258,7 @@ sub _parse_data {
       my $header = $self->_header_by_row($row);
       if (!$header) {
         push @errors, [
       my $header = $self->_header_by_row($row);
       if (!$header) {
         push @errors, [
+          undef,
           0,
           "Cannot get header for row. Maybe row name and datatype field not matching.",
           0,
           0,
           "Cannot get header for row. Maybe row name and datatype field not matching.",
           0,
index 13bcba7c7c762f8c28565342e3a82c622ddcda45..95ca14b36344c733d0e5f43015a4d5c3177bfd24 100644 (file)
@@ -629,7 +629,7 @@ EOL
   ignore_unknown_columns => 1,
 );
 ok !$csv->parse, 'multiplex check detects incosistent datatype field position';
   ignore_unknown_columns => 1,
 );
 ok !$csv->parse, 'multiplex check detects incosistent datatype field position';
-is_deeply( ($csv->errors)[0], [ 0, 'datatype field must be at the same position for all datatypes for multiplexed data', 0, 0 ], 'multiplex data with inconsistent datatype field posiotion throws error');
+is_deeply( ($csv->errors)[0], [ undef, 0, 'datatype field must be at the same position for all datatypes for multiplexed data', 0, 0 ], 'multiplex data with inconsistent datatype field posiotion throws error');
 
 #####
 
 
 #####