]> wagnertech.de Git - mfinanz.git/commitdiff
CSV-Import Kunden/Lieferanten: Ungültige Zeichen (\r\n) durch Leerzeichen ersetzen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 15 Apr 2013 13:06:16 +0000 (15:06 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 15 Apr 2013 13:26:08 +0000 (15:26 +0200)
SL/Controller/CsvImport/Base.pm
SL/Controller/CsvImport/CustomerVendor.pm
locale/de/all

index 68d35d89dd72b292447795289c2043f68c0c7ba2..eb46b26d54f7c29933d6c402652388a3e8931e26 100644 (file)
@@ -422,4 +422,21 @@ sub fix_field_lengths {
   }
 }
 
   }
 }
 
+sub clean_fields {
+  my ($self, $illegal_chars, $object, @fields) = @_;
+
+  my @cleaned_fields;
+  foreach my $field (grep { $object->can($_) } @fields) {
+    my $value = $object->$field;
+    $::lxdebug->message(0, "field $field value $value ill $illegal_chars");
+
+    next unless defined($value) && ($value =~ s/$illegal_chars/ /g);
+
+    $object->$field($value);
+    push @cleaned_fields, $field;
+  }
+
+  return @cleaned_fields;
+}
+
 1;
 1;
index 0d6db32c57ee8a69609aaaf22243f3a52fb94e13..f8774dcfc5a923b08a56f55c0d9ec0fc219b78ec 100644 (file)
@@ -69,6 +69,12 @@ sub check_objects {
 
     next if @{ $entry->{errors} };
 
 
     next if @{ $entry->{errors} };
 
+    my @cleaned_fields = $self->clean_fields(qr{[\r\n]}, $object, qw(name department_1 department_2 street zipcode city country contact phone fax homepage email cc bcc
+                                                                     taxnumber account_number bank_code bank username greeting));
+
+    push @{ $entry->{information} }, $::locale->text('Illegal characters have been removed from the following fields: #1', join(', ', @cleaned_fields))
+      if @cleaned_fields;
+
     my $existing_vc = $vcs_by_number{ $object->$numbercolumn };
     if (!$existing_vc) {
       $vcs_by_number{ $object->$numbercolumn } = $object;
     my $existing_vc = $vcs_by_number{ $object->$numbercolumn };
     if (!$existing_vc) {
       $vcs_by_number{ $object->$numbercolumn } = $object;
index e4596339d35abf42e76f66edd8e610b55876e1ed..fc4697814065514a03d30666163197a22ae503fb 100644 (file)
@@ -993,7 +993,7 @@ $self->{texts} = {
   'If you want to change any of these parameters then press the &quot;Back&quot; button, edit the file &quot;config/kivitendo.conf&quot; and login into the admin module again.' => 'Wenn Sie einen der Parameter &auml;ndern wollen, so dr&uuml;cken Sie auf den &quot;Zur&uuml;ck&quot;-Button, bearbeiten Sie die Datei &quot;config/kivitendo.conf&quot;, und melden Sie sich erneut im Administrationsbereich an.',
   'If you want to delete such a dataset you have to edit the user(s) that are using the dataset in question and have them use another dataset.' => 'Wenn Sie eine solche Datenbank l&ouml;schen wollen, so m&uuml;ssen Sie zuerst die Benutzer bearbeiten, die die fragliche Datenbank benutzen, und sie so &auml;ndern, dass sie eine andere Datenbank benutzen.',
   'If you want to set up the authentication database yourself then log in to the administration panel. kivitendo will then create the database and tables for you.' => 'Wenn Sie die Authentifizierungs-Datenbank selber einrichten wollen, so melden Sie sich im Administrationsbereich an. kivitendo wird dann die Datenbank und die erforderlichen Tabellen für Sie anlegen.',
   'If you want to change any of these parameters then press the &quot;Back&quot; button, edit the file &quot;config/kivitendo.conf&quot; and login into the admin module again.' => 'Wenn Sie einen der Parameter &auml;ndern wollen, so dr&uuml;cken Sie auf den &quot;Zur&uuml;ck&quot;-Button, bearbeiten Sie die Datei &quot;config/kivitendo.conf&quot;, und melden Sie sich erneut im Administrationsbereich an.',
   'If you want to delete such a dataset you have to edit the user(s) that are using the dataset in question and have them use another dataset.' => 'Wenn Sie eine solche Datenbank l&ouml;schen wollen, so m&uuml;ssen Sie zuerst die Benutzer bearbeiten, die die fragliche Datenbank benutzen, und sie so &auml;ndern, dass sie eine andere Datenbank benutzen.',
   'If you want to set up the authentication database yourself then log in to the administration panel. kivitendo will then create the database and tables for you.' => 'Wenn Sie die Authentifizierungs-Datenbank selber einrichten wollen, so melden Sie sich im Administrationsbereich an. kivitendo wird dann die Datenbank und die erforderlichen Tabellen für Sie anlegen.',
-  'Illegal characters have been removed from the following fields: #1' => '',
+  'Illegal characters have been removed from the following fields: #1' => 'Ungültige Zeichen wurden aus den folgenden Feldern entfernt: #1',
   'Image'                       => 'Grafik',
   'Import'                      => 'Import',
   'Import CSV'                  => 'CSV-Import',
   'Image'                       => 'Grafik',
   'Import'                      => 'Import',
   'Import CSV'                  => 'CSV-Import',