Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a5038d8d

Von Moritz Bunkus vor etwa 4 Jahren hinzugefügt

  • ID a5038d8dfae7d3a5ad27f1fb4f219b347bb2c91c
  • Vorgänger 473431b1
  • Nachfolger b7afa934

Neuer Angebots-/Auftragscontroller: Sprach-Drop-Down aus Print-Optionen in Hauptbeleg verschoben

Unterschiede anzeigen:

SL/Controller/Order.pm
273 273
    return $self->js->flash('error', t8('Media \'#1\' is not supported yet/anymore.', $media))->render;
274 274
  }
275 275

  
276
  my $language;
277
  $language = SL::DB::Language->new(id => $::form->{print_options}->{language_id})->load if $::form->{print_options}->{language_id};
278

  
279 276
  # create a form for generate_attachment_filename
280 277
  my $form   = Form->new;
281 278
  $form->{$self->nr_key()}  = $self->order->number;
282 279
  $form->{type}             = $self->type;
283 280
  $form->{format}           = $format;
284 281
  $form->{formname}         = $formname;
285
  $form->{language}         = '_' . $language->template_code if $language;
282
  $form->{language}         = '_' . $self->order->language->template_code if $self->order->language;
286 283
  my $pdf_filename          = $form->generate_attachment_filename();
287 284

  
288 285
  my $pdf;
289 286
  my @errors = generate_pdf($self->order, \$pdf, { format     => $format,
290 287
                                                   formname   => $formname,
291
                                                   language   => $language,
288
                                                   language   => $self->order->language,
292 289
                                                   groupitems => $groupitems });
293 290
  if (scalar @errors) {
294 291
    return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render;
......
431 428
  $::form->{media}  = 'email';
432 429

  
433 430
  if (($::form->{attachment_policy} // '') !~ m{^(?:old_file|no_file)$}) {
434
    my $language;
435
    $language = SL::DB::Language->new(id => $::form->{print_options}->{language_id})->load if $::form->{print_options}->{language_id};
436

  
437 431
    my $pdf;
438 432
    my @errors = generate_pdf($self->order, \$pdf, {media      => $::form->{media},
439 433
                                                    format     => $::form->{print_options}->{format},
440 434
                                                    formname   => $::form->{print_options}->{formname},
441
                                                    language   => $language,
435
                                                    language   => $self->order->language,
442 436
                                                    groupitems => $::form->{print_options}->{groupitems}});
443 437
    if (scalar @errors) {
444 438
      return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render($self);
......
708 702
    ->val(        '#order_payment_id',       $self->order->payment_id)
709 703
    ->val(        '#order_delivery_term_id', $self->order->delivery_term_id)
710 704
    ->val(        '#order_intnotes',         $self->order->intnotes)
711
    ->val(        '#language_id',            $self->order->$cv_method->language_id)
705
    ->val(        '#order_language_id',      $self->order->$cv_method->language_id)
712 706
    ->focus(      '#order_' . $self->cv . '_id')
713 707
    ->run('kivi.Order.update_exchangerate');
714 708

  
......
1760 1754
  $self->{all_taxzones}               = SL::DB::Manager::TaxZone->get_all_sorted();
1761 1755
  $self->{all_currencies}             = SL::DB::Manager::Currency->get_all_sorted();
1762 1756
  $self->{all_departments}            = SL::DB::Manager::Department->get_all_sorted();
1757
  $self->{all_languages}              = SL::DB::Manager::Language->get_all_sorted();
1763 1758
  $self->{all_employees}              = SL::DB::Manager::Employee->get_all(where => [ or => [ id => $self->order->employee_id,
1764 1759
                                                                                              deleted => 0 ] ],
1765 1760
                                                                           sort_by => 'name');
......
1777 1772
  my $print_form = Form->new('');
1778 1773
  $print_form->{type}        = $self->type;
1779 1774
  $print_form->{printers}    = SL::DB::Manager::Printer->get_all_sorted;
1780
  $print_form->{languages}   = SL::DB::Manager::Language->get_all_sorted;
1781
  $print_form->{language_id} = $self->order->language_id;
1782 1775
  $self->{print_options}     = SL::Helper::PrintOptions->get_print_options(
1783 1776
    form => $print_form,
1784 1777
    options => {dialog_name_prefix => 'print_options.',
js/kivi.Order.js
51 51
    if (warn_on_reqdate    && !ns.check_valid_reqdate())   return;
52 52

  
53 53
    var data = $('#order_form').serializeArray();
54
    data.push({ name: 'order.language_id', value: $('#language_id').val() }); // language from print options
55 54
    data.push({ name: 'action', value: 'Order/' + action });
56 55

  
57 56
    $.post("controller.pl", data, kivi.eval_json_result);
......
83 82

  
84 83
    var data = $('#order_form').serializeArray();
85 84
    data = data.concat($('#print_options_form').serializeArray());
86
    data.push({ name: 'order.language_id', value: $('#language_id').val() }); // language from print options
87 85
    data.push({ name: 'action', value: 'Order/print' });
88 86

  
89 87
    $.post("controller.pl", data, kivi.eval_json_result);
......
139 137
    var data = $('#order_form').serializeArray();
140 138
    data = data.concat($('[name^="email_form."]').serializeArray());
141 139
    data = data.concat($('[name^="print_options."]').serializeArray());
142
    data.push({ name: 'order.language_id', value: $('#language_id').val() }); // language from print options
143 140
    data.push({ name: 'action', value: 'Order/send_email' });
144 141
    $.post("controller.pl", data, kivi.eval_json_result);
145 142
  };
templates/webpages/order/tabs/basic_data.html
73 73
            </td>
74 74
          </tr>
75 75

  
76
[%- IF SELF.all_languages.size %]
77
          <tr>
78
            <th align="right">[% 'Language' | $T8 %]</th>
79
            <td>
80
              [% L.select_tag('order.language_id', SELF.all_languages, default=SELF.order.language_id, title_key='description', with_empty=1, style='width:300px') %]
81
            </td>
82
          </tr>
83
[%- END %]
84

  
76 85
[%- IF SELF.all_departments.size %]
77 86
          <tr>
78 87
            <th align="right">[% 'Department' | $T8 %]</th>

Auch abrufbar als: Unified diff