Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 94944f08

Von Bernd Blessmann vor fast 13 Jahren hinzugefügt

Sprache bei Mahnungen

In den Auflistungen wird zu den Rechnungen die jeweilige Rechnungssprache
mit angezeigt. Diese Sprache wird beim Drucken der Mahnungen auch verwendet
(Bei Rechnung zusammenfassen nur die erste Sprache).
Mit der SelectionBox unten kann man die Sprachauswahl überschreiben
(, sofern man nicht den Link zur Mahnung in der Auflistung verwendet).

Unterschiede anzeigen:

SL/DN.pm
509 509

  
510 510
  $query =
511 511
    qq|SELECT
512
         a.id, a.ordnumber, a.transdate, a.invnumber, a.amount,
512
         a.id, a.ordnumber, a.transdate, a.invnumber, a.amount, a.language_id,
513 513
         ct.name AS customername, a.customer_id, a.duedate,
514 514
         a.amount - a.paid AS open_amount,
515 515

  
......
669 669
  my $sortorder = join ', ', map { "$_ $sortdir" } @{ $sort_columns{$sortkey} };
670 670

  
671 671
  my $query =
672
    qq|SELECT a.id, a.ordnumber, a.invoice, a.transdate, a.invnumber, a.amount,
672
    qq|SELECT a.id, a.ordnumber, a.invoice, a.transdate, a.invnumber, a.amount, a.language_id,
673 673
         ct.name AS customername, ct.id AS customer_id, a.duedate, da.fee,
674 674
         da.interest, dn.dunning_description, da.transdate AS dunning_date,
675 675
         da.duedate AS dunning_duedate, da.dunning_id, da.dunning_config_id,
bin/mozilla/dn.pl
133 133
      map { $_->{SELECTED} = $_->{id} == $row->{next_dunning_config_id} } @{ $row->{DUNNING_CONFIG } };
134 134
    }
135 135
    map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount open_amount fee interest);
136

  
137
    if ($row->{'language_id'}) {
138
      $row->{language} = SL::DB::Manager::Language->find_by('id' => $row->{'language_id'})->{'description'};
139
    }
136 140
  }
137 141

  
138 142
  $form->get_lists('printers'  => 'printers',
......
150 154
                                          'no_opendocument' => 1,);
151 155

  
152 156
  $form->header();
157
  $form->{onload} = "document.getElementsByName('language_id')[0].disabled =
158
        !document.getElementsByName('force_lang')[0].checked;";
153 159
  print $form->parse_html_template("dunning/show_invoices");
154 160

  
155 161
  $main::lxdebug->leave_sub();
......
199 205
  my @rows = ();
200 206
  undef($form->{DUNNING_PDFS});
201 207

  
208
  my $saved_language_id = $form->{language_id};
209

  
202 210
  if ($form->{groupinvoices}) {
203 211
    my %dunnings_for;
204 212

  
......
214 222
      push @{ $level }, { "row"                    => $i,
215 223
                          "invoice_id"             => $form->{"inv_id_$i"},
216 224
                          "customer_id"            => $form->{"customer_id_$i"},
225
                          "language_id"            => $form->{"language_id_$i"},
217 226
                          "next_dunning_config_id" => $form->{"next_dunning_config_id_$i"},
218 227
                          "email"                  => $form->{"email_$i"}, };
219 228
    }
......
221 230
    foreach my $levels (values %dunnings_for) {
222 231
      foreach my $level (values %{ $levels }) {
223 232
        next unless scalar @{ $level };
224

  
233
        if (!$form->{force_lang}) {
234
          $form->{language_id} = @{$level}[0]->{language_id};
235
        }
225 236
        DN->save_dunning(\%myconfig, $form, $level);
226 237
      }
227 238
    }
......
233 244
      my $level = [ { "row"                    => $i,
234 245
                      "invoice_id"             => $form->{"inv_id_$i"},
235 246
                      "customer_id"            => $form->{"customer_id_$i"},
247
                      "language_id"            => $form->{"language_id_$i"},
236 248
                      "next_dunning_config_id" => $form->{"next_dunning_config_id_$i"},
237 249
                      "email"                  => $form->{"email_$i"}, } ];
250
      if (!$form->{force_lang}) {
251
        $form->{language_id} = @{$level}[0]->{language_id};
252
      }
238 253
      DN->save_dunning(\%myconfig, $form, $level);
239 254
    }
240 255
  }
241 256

  
257
  $form->{language_id} = $saved_language_id;
258

  
242 259
  if($form->{DUNNING_PDFS}) {
243 260
    DN->melt_pdfs(\%myconfig, $form, $form->{copies});
244 261
  }
......
352 369
    'checkbox'            => { 'text' => '', 'visible' => 'HTML' },
353 370
    'dunning_description' => { 'text' => $locale->text('Dunning Level') },
354 371
    'customername'        => { 'text' => $locale->text('Customername') },
372
    'language'            => { 'text' => $locale->text('Language') },
355 373
    'invnumber'           => { 'text' => $locale->text('Invnumber') },
356 374
    'transdate'           => { 'text' => $locale->text('Invdate') },
357 375
    'duedate'             => { 'text' => $locale->text('Invoice Duedate') },
......
364 382
  );
365 383

  
366 384
  $report->set_columns(%column_defs);
367
  $report->set_column_order(qw(checkbox dunning_description customername invnumber transdate
385
  $report->set_column_order(qw(checkbox dunning_description customername language invnumber transdate
368 386
                               duedate amount dunning_date dunning_duedate fee interest salesman));
369 387
  $report->set_sort_indicator($form->{sort}, $form->{sortdir});
370 388

  
371 389
  my $edit_url  = sub { build_std_url('script=' . ($_[0]->{invoice} ? 'is' : 'ar') . '.pl', 'action=edit', 'callback') . '&id=' . $::form->escape($_[0]->{id}) };
372
  my $print_url = build_std_url('action=print_dunning', 'format=pdf', 'media=screen') . '&dunning_id=';
390
  my $print_url = sub { build_std_url('action=print_dunning', 'format=pdf', 'media=screen', 'dunning_id='.$_[0]->{dunning_id}, 'language_id=' . $_[0]->{language_id}) };
373 391
  my $sort_url  = build_std_url('action=show_dunning', grep { $form->{$_} } @filter_field_list);
374 392

  
375 393
  foreach my $name (qw(dunning_description customername invnumber transdate duedate dunning_date dunning_duedate salesman)) {
......
396 414
      $first_row_for_dunning = 1;
397 415
    }
398 416

  
417
    if ($ref->{'language_id'}) {
418
      $ref->{language} = SL::DB::Manager::Language->find_by('id' => $ref->{'language_id'})->{'description'};
419
    }
420

  
399 421
    my $row = { };
400 422
    foreach my $column (keys %{ $ref }) {
401 423
      $row->{$column} = {
......
404 426
        'align' => $alignment{$column},
405 427

  
406 428
        'link'  => (  $column eq 'invnumber'           ? $edit_url->($ref)
407
                    : $column eq 'dunning_description' ? $print_url . E($ref->{dunning_id})
429
                    : $column eq 'dunning_description' ? $print_url->($ref)
408 430
                    :                                    ''),
409 431
      };
410 432
    }
......
416 438
      'align'    => 'center',
417 439
    };
418 440

  
441
    if ($first_row_for_dunning) {
442
      $row->{language} = {'raw_data' => $cgi->hidden('-name' => "language_id_$i", '-value' => $ref->{language_id})
443
                                        . " $ref->{language}" };
444
    } else {
445
      $row->{language} = { };
446
    }
447

  
419 448
    push @{ $current_dunning_rows }, $row;
420 449

  
421 450
    $previous_dunning_id   = $ref->{dunning_id};
......
432 461

  
433 462
  $report->set_options_from_form();
434 463

  
464
  $form->{onload} = "document.getElementsByName('language_id')[0].disabled =
465
        !document.getElementsByName('force_lang')[0].checked;";
435 466
  $report->generate_with_headers();
436 467

  
437 468
  $main::lxdebug->leave_sub();
......
448 479
  $form->{rowcount}     = 1;
449 480
  $form->{selected_1}   = 1;
450 481
  $form->{dunning_id_1} = $form->{dunning_id};
482
  $form->{language_id_1} = $form->{language_id};
451 483

  
452 484
  print_multiple();
453 485

  
......
466 498
  $form->{title} = $locale->text('Print dunnings');
467 499

  
468 500
  my @dunning_ids = map { $form->{"dunning_id_$_"} } grep { $form->{"selected_$_"} } (1..$form->{rowcount});
501
  my @language_ids = map { $form->{"language_id_$_"} } grep { $form->{"selected_$_"} } (1..$form->{rowcount});
469 502

  
470 503
  if (!scalar @dunning_ids) {
471 504
    $form->error($locale->text('No dunnings have been selected for printing.'));
......
473 506

  
474 507
  $form->{DUNNING_PDFS} = [];
475 508

  
509
  my $saved_language_id = $form->{language_id};
510
  my $i = 0;
476 511
  foreach my $dunning_id (@dunning_ids) {
512
    if (!$form->{force_lang}) {
513
      $form->{language_id} = $language_ids[$i];
514
    }
477 515
    DN->print_invoice_for_fees(\%myconfig, $form, $dunning_id);
478 516
    DN->print_dunning(\%myconfig, $form, $dunning_id);
517
    $i++;
479 518
  }
519
  $form->{language_id} = $saved_language_id;
480 520

  
481 521
  if (scalar @{ $form->{DUNNING_PDFS} }) {
482 522
    $form->{dunning_id} = strftime("%Y%m%d", localtime time);
locale/de/all
1280 1280
  'Output Number Format'        => 'Zahlenformat (Ausgabe)',
1281 1281
  'Outputformat'                => 'Ausgabeformat',
1282 1282
  'Overdue sales quotations and requests for quotations' => 'Überfällige Angebote und Preisanfragen',
1283
  'Override invoice language'   => 'Diese Sprache verwenden',
1283 1284
  'PAYMENT POSTED'              => 'Rechung gebucht',
1284 1285
  'PDF'                         => 'PDF',
1285 1286
  'PDF (OpenDocument/OASIS)'    => 'PDF (OpenDocument/OASIS)',
locale/en/all
1180 1180
  'Output Number Format'        => '',
1181 1181
  'Outputformat'                => '',
1182 1182
  'Overdue sales quotations and requests for quotations' => '',
1183
  'Override invoice language'   => '',
1183 1184
  'Own Product'                 => '',
1184 1185
  'PAYMENT POSTED'              => '',
1185 1186
  'PDF'                         => '',
templates/webpages/dunning/show_dunning_bottom.html
1 1
[%- USE T8 %]
2 2
[% USE HTML %]  <input type="hidden" name="rowcount" value="[% rowcount %]">
3 3

  
4
  <p>[% PRINT_OPTIONS %]</p>
4
  <p>
5
    <input type="checkbox" name="force_lang" size="6" value="1" onclick="document.getElementsByName('language_id')[0].disabled = !document.getElementsByName('force_lang')[0].checked;">
6
    [% 'Override invoice language' | T8 %]
7
    [% PRINT_OPTIONS %]
8
  </p>
5 9

  
6 10
  <p>
7 11
   [% 'Dunnings' | $T8 %]<br>
templates/webpages/dunning/show_invoices.html
4 4
[% L.javascript_tag('jquery.checkall') %]
5 5
[% SET all_active = 1 %][% FOREACH row = DUNNINGS %][% IF !row.active %][% SET all_active = 0 %][% LAST %][% END %][% END %]
6 6
[% SET all_email = 1 %][% FOREACH row = DUNNINGS %][% IF !row.email %][% SET all_email = 0 %][% LAST %][% END %][% END %]
7
<body>
7
<body [% IF onload %] onload="[% onload %]"[% END %]>
8

  
8 9
 <script type="text/javascript" src="js/common.js"></script>
9 10
 <script type="text/javascript" src="js/dunning.js"></script>
10 11

  
......
28 29
   </th>
29 30

  
30 31
   <th class="listheading">[% 'Customername' | $T8 %]</th>
32
   <th class="listheading">[% 'Language' | $T8 %]</th>
31 33
   <th class="listheading">[% 'Invno.' | $T8 %]</th>
32 34
   <th class="listheading">[% 'Invdate' | $T8 %]</th>
33 35
   <th class="listheading">[% 'Inv. Duedate' | $T8 %]</th>
......
57 59
     <td><input type="checkbox" name="active_[% loop.count %]" value="1" [% IF row.active %]checked[% END %]></td>
58 60
     <td><input type="checkbox" name="email_[% loop.count %]" value="1" [% IF row.email %]checked[% END %]></td>
59 61
     <td><input type="hidden" name="customername_[% loop.count %]" size="6" value="[% HTML.escape(row.customername) %]">[% HTML.escape(row.customername) %]</td>
62
     <td><input type="hidden" name="language_id_[% loop.count %]" size="6" value="[% HTML.escape(row.language_id) %]">[% HTML.escape(row.language) %]</td>
60 63
     <td>
61 64
      <input type="hidden" name="invnumber_[% loop.count %]" size="6" value="[% HTML.escape(row.invnumber) %]">
62 65
      <a href="is.pl?action=edit&type=invoice&id=[% row.id | url %]">[% HTML.escape(row.invnumber) %]</a>
......
74 77

  
75 78
  <hr size=3 noshade>
76 79

  
80
  <input type="checkbox" name="force_lang" size="6" value="1" onclick="document.getElementsByName('language_id')[0].disabled = !document.getElementsByName('force_lang')[0].checked;">
81
  [% 'Override invoice language' | T8 %]
77 82
  [% PRINT_OPTIONS %]
78 83

  
79 84
  <br>
templates/webpages/report_generator/html_report.html
1 1
[%- USE T8 %]
2
[% USE HTML %]<body>
2
[% USE HTML %]<body[% IF onload %] onload="[% onload %]"[% END %]>
3 3

  
4 4
 <style type="text/css">
5 5
  <!--

Auch abrufbar als: Unified diff