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:

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);

Auch abrufbar als: Unified diff