Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 265fa6a6

Von Sven Schöling vor mehr als 8 Jahren hinzugefügt

  • ID 265fa6a6f42909e4e27870a1dd838c4570ba61a8
  • Vorgänger fb1a574b
  • Nachfolger e78a50fc

Csv: mappings übersetzen jetzt auch header

Unterschiede anzeigen:

SL/Helper/Csv.pm
202 202
      my $h_aref = ($self->is_multiplexed)? $header : [ $header ];
203 203
      my $p_num  = 0;
204 204
      foreach my $h (@{ $h_aref }) {
205
        my @names = (
206
          keys %{ $self->profile->[$p_num]->{profile} || {} },
207
          keys %{ $self->profile->[$p_num]->{mapping} || {} },
205
        my %names = (
206
          (map { $_ => $_                                     } keys %{ $self->profile->[$p_num]->{profile} || {} }),
207
          (map { $_ => $self->profile->[$p_num]{mapping}{$_}  } keys %{ $self->profile->[$p_num]->{mapping} || {} }),
208 208
        );
209
        for my $name (@names) {
209
        for my $name (keys %names) {
210 210
          for my $i (0..$#$h) {
211
            $h->[$i] = $name if lc $h->[$i] eq lc $name;
211
            $h->[$i] = $names{$name} if lc $h->[$i] eq lc $name;
212 212
          }
213 213
        }
214 214
        $p_num++;
......
584 584
Without strict profiles, mappings can also directly map header fields that
585 585
should end up in the same accessor.
586 586

  
587
With case insensitive headings, mappings will also modify the headers, to fit
588
the expected profile.
589

  
587 590
Mappings can be identical to known fields and will be prefered during lookup,
588 591
but will not replace the field, meaning that:
589 592

  

Auch abrufbar als: Unified diff