Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9a1c5b19

Von Sven Schöling vor fast 14 Jahren hinzugefügt

Taxbird-export: Mit Heuristik versuchen PLZ und Stadt aus dem Firmenadressfeld zu extrahieren

Teilfix für Bug 1488

Unterschiede anzeigen:

bin/mozilla/ustva.pl
919 919
        ::end_of_request();
920 920
      }
921 921

  
922
      # heuristics for address splitting
923
      # lx-office holds the entire address in a single field.
924
      # taxbird expects it to be splitted into street, zipcode and city
925
      if ($form->{co_street} =~ /\n/) {
926
        my $new_co_street;
927
        for (split /\n/, $form->{co_street}) {
928
          if (/(\d{3,5})\s+(\w+)/) {
929
            $form->{co_zip}  = $1;
930
            $form->{co_city} = $2;
931
          } else {
932
            $new_co_street .= $_;
933
          }
934
        }
935
        $form->{co_street} = $new_co_street;
936
      } else {
937
        $form->{co_zip} = $form->{co_city};
938
        $form->{co_zip} =~ s/\D//g;
939
        $form->{co_city} =~ s/\d//g;
940
        $form->{co_city} =~ s/^\s//g;
941
      }
942

  
922 943
      my $tax_office           = first { $_->{name} eq $form->{elsterland} } @{ $ustva->{tax_office_information} };
923 944
      $form->{taxbird_land_nr} = $tax_office->{taxbird_nr} if $tax_office;
924 945

  
925
      $form->{co_zip} = $form->{co_city};
926
      $form->{co_zip} =~ s/\D//g;
927
      $form->{co_city} =~ s/\d//g;
928
      $form->{co_city} =~ s/^\s//g;
929

  
930 946
      ($form->{co_phone_prefix}, $form->{co_phone}) = split("-", $form->{tel});
931 947
      $form->{co_phone_prefix} =~ s/\s//g;
932 948
      $form->{co_phone} =~ s/\s//g;

Auch abrufbar als: Unified diff