Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision dc3cd296

Von Moritz Bunkus vor fast 17 Jahren hinzugefügt

  • ID dc3cd296e62eb09a16fa694d9b3a7158e4cf63bf
  • Vorgänger 0aea1ede
  • Nachfolger 0c75bd00

Das Quoten/Unquoten von speziellen Zeichen in zentrale Hilfsfunktionen in Locale verlagert.

Unterschiede anzeigen:

SL/Form.pm
376 376

  
377 377
}
378 378

  
379
sub quote_html {
380
  $main::lxdebug->enter_sub(2);
381

  
382
  my ($self, $str) = @_;
383

  
384
  my %replace =
385
    ('order' => ['&', '"', '<', '>'],
386
     '<'     => '&lt;',
387
     '>'     => '&gt;',
388
     '"'     => '&quot;',
389
     '&'     => '&amp;',
390
    );
391

  
392
  map({ $str =~ s/$_/$replace{$_}/g; } @{ $replace{"order"} });
393

  
394
  $main::lxdebug->leave_sub(2);
395

  
396
  return $str;
397
}
398

  
399
sub unquote_html {
400
  $main::lxdebug->enter_sub(2);
401

  
402
  my ($self, $str) = @_;
403

  
404
  my %replace  =
405
    ('&auml;'  => '?',
406
     '&ouml;'  => '?',
407
     '&uuml;'  => '?',
408
     '&Auml;'  => '?',
409
     '&Ouml;'  => '?',
410
     '&Uuml;'  => '?',
411
     '&szlig;' => '?',
412
     '&gt;'    => '>',
413
     '&lt;'    => '<',
414
     '&quot;'  => '"',
415
    );
416

  
417
  map { $str =~ s/\Q$_\E/$replace{$_}/g; } keys %replace;
418
  $str =~ s/\&amp;/\&/g;
419

  
420
  $main::lxdebug->leave_sub(2);
421

  
422
  return $str;
423
}
424

  
425

  
426 379
sub hide_form {
427 380
  my $self = shift;
428 381

  
......
1279 1232
sub generate_attachment_filename {
1280 1233
  my ($self) = @_;
1281 1234

  
1282
  my $attachment_filename = $self->unquote_html($self->get_formname_translation());
1235
  my $attachment_filename = $main::locale->unquote_special_chars('HTML', $self->get_formname_translation());
1283 1236
  my $prefix =
1284 1237
      (first { $self->{type} eq $_ } qw(invoice credit_note)) ? 'inv'
1285 1238
    : ($self->{type} =~ /_quotation$/)                        ? 'quo'
......
1293 1246
                               : $self->{format} =~ /opendocument/i ? ".odt"
1294 1247
                               : $self->{format} =~ /html/i         ? ".html"
1295 1248
                               :                                      "");
1249
    $attachment_filename =  lc $main::locale->quote_special_chars('filenames', $attachment_filename);
1296 1250
    $attachment_filename =~ s/ /_/g;
1297
    my %umlaute = ( "?" => "ae", "?" => "oe", "?" => "ue", 
1298
                    "?" => "Ae", "?" => "Oe", "?" => "Ue", "?" => "ss");
1299
    map { $attachment_filename =~ s/$_/$umlaute{$_}/g } keys %umlaute;
1300 1251
  } else {
1301 1252
    $attachment_filename = "";
1302 1253
  }

Auch abrufbar als: Unified diff