From: Moritz Bunkus Date: Mon, 9 Nov 2020 14:28:35 +0000 (+0100) Subject: Neuer Angebots-/Auftragscontroller: Sprach-Drop-Down aus Print-Optionen in Hauptbeleg... X-Git-Tag: kivitendo-mebil_0.1-0~9^2~656 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a5038d8dfae7d3a5ad27f1fb4f219b347bb2c91c;p=kivitendo-erp.git Neuer Angebots-/Auftragscontroller: Sprach-Drop-Down aus Print-Optionen in Hauptbeleg verschoben --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 48bfe0781..9f1ca0ec5 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -273,22 +273,19 @@ sub action_print { 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; @@ -431,14 +428,11 @@ sub action_send_email { $::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); @@ -708,7 +702,7 @@ sub action_customer_vendor_changed { ->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'); @@ -1760,6 +1754,7 @@ sub pre_render { $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'); @@ -1777,8 +1772,6 @@ sub pre_render { 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.', diff --git a/js/kivi.Order.js b/js/kivi.Order.js index e52440691..e57d00937 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -51,7 +51,6 @@ namespace('kivi.Order', function(ns) { 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); @@ -83,7 +82,6 @@ namespace('kivi.Order', function(ns) { 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); @@ -139,7 +137,6 @@ namespace('kivi.Order', function(ns) { 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); }; diff --git a/templates/webpages/order/tabs/basic_data.html b/templates/webpages/order/tabs/basic_data.html index b7086a8ae..d7b84ff88 100644 --- a/templates/webpages/order/tabs/basic_data.html +++ b/templates/webpages/order/tabs/basic_data.html @@ -73,6 +73,15 @@ +[%- IF SELF.all_languages.size %] + + [% 'Language' | $T8 %] + + [% L.select_tag('order.language_id', SELF.all_languages, default=SELF.order.language_id, title_key='description', with_empty=1, style='width:300px') %] + + +[%- END %] + [%- IF SELF.all_departments.size %] [% 'Department' | $T8 %]