return $self->js->flash('error', t8('Media \'#1\' is not supported yet/anymore.', $media))->render;
}
- my $language;
- $language = SL::DB::Language->new(id => $::form->{print_options}->{language_id})->load if $::form->{print_options}->{language_id};
-
# create a form for generate_attachment_filename
my $form = Form->new;
$form->{$self->nr_key()} = $self->order->number;
$form->{type} = $self->type;
$form->{format} = $format;
$form->{formname} = $formname;
- $form->{language} = '_' . $language->template_code if $language;
+ $form->{language} = '_' . $self->order->language->template_code if $self->order->language;
my $pdf_filename = $form->generate_attachment_filename();
my $pdf;
my @errors = generate_pdf($self->order, \$pdf, { format => $format,
formname => $formname,
- language => $language,
+ language => $self->order->language,
groupitems => $groupitems });
if (scalar @errors) {
return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render;
$::form->{media} = 'email';
if (($::form->{attachment_policy} // '') !~ m{^(?:old_file|no_file)$}) {
- my $language;
- $language = SL::DB::Language->new(id => $::form->{print_options}->{language_id})->load if $::form->{print_options}->{language_id};
-
my $pdf;
my @errors = generate_pdf($self->order, \$pdf, {media => $::form->{media},
format => $::form->{print_options}->{format},
formname => $::form->{print_options}->{formname},
- language => $language,
+ language => $self->order->language,
groupitems => $::form->{print_options}->{groupitems}});
if (scalar @errors) {
return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render($self);
->val( '#order_payment_id', $self->order->payment_id)
->val( '#order_delivery_term_id', $self->order->delivery_term_id)
->val( '#order_intnotes', $self->order->intnotes)
- ->val( '#language_id', $self->order->$cv_method->language_id)
+ ->val( '#order_language_id', $self->order->$cv_method->language_id)
->focus( '#order_' . $self->cv . '_id')
->run('kivi.Order.update_exchangerate');
$self->{all_taxzones} = SL::DB::Manager::TaxZone->get_all_sorted();
$self->{all_currencies} = SL::DB::Manager::Currency->get_all_sorted();
$self->{all_departments} = SL::DB::Manager::Department->get_all_sorted();
+ $self->{all_languages} = SL::DB::Manager::Language->get_all_sorted();
$self->{all_employees} = SL::DB::Manager::Employee->get_all(where => [ or => [ id => $self->order->employee_id,
deleted => 0 ] ],
sort_by => 'name');
my $print_form = Form->new('');
$print_form->{type} = $self->type;
$print_form->{printers} = SL::DB::Manager::Printer->get_all_sorted;
- $print_form->{languages} = SL::DB::Manager::Language->get_all_sorted;
- $print_form->{language_id} = $self->order->language_id;
$self->{print_options} = SL::Helper::PrintOptions->get_print_options(
form => $print_form,
options => {dialog_name_prefix => 'print_options.',
if (warn_on_reqdate && !ns.check_valid_reqdate()) return;
var data = $('#order_form').serializeArray();
- data.push({ name: 'order.language_id', value: $('#language_id').val() }); // language from print options
data.push({ name: 'action', value: 'Order/' + action });
$.post("controller.pl", data, kivi.eval_json_result);
var data = $('#order_form').serializeArray();
data = data.concat($('#print_options_form').serializeArray());
- data.push({ name: 'order.language_id', value: $('#language_id').val() }); // language from print options
data.push({ name: 'action', value: 'Order/print' });
$.post("controller.pl", data, kivi.eval_json_result);
var data = $('#order_form').serializeArray();
data = data.concat($('[name^="email_form."]').serializeArray());
data = data.concat($('[name^="print_options."]').serializeArray());
- data.push({ name: 'order.language_id', value: $('#language_id').val() }); // language from print options
data.push({ name: 'action', value: 'Order/send_email' });
$.post("controller.pl", data, kivi.eval_json_result);
};