From: Bernd Bleßmann Date: Fri, 27 Jul 2018 11:15:27 +0000 (+0200) Subject: Auftrags-Controller: Bei Angeboten das richtige Nummern-Feld nehmen X-Git-Tag: release-3.5.4~342 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2e9dddf1e0e218172404a4fd395c83228280fb09;p=kivitendo-erp.git Auftrags-Controller: Bei Angeboten das richtige Nummern-Feld nehmen Fehler waren hier: keine Angebotsnummer in Name des Anhangs, kein Speichern im Webdav oder Datei-Storage. --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index d39c7e648..f355167b4 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -212,13 +212,13 @@ sub action_print { $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->{ordnumber} = $self->order->ordnumber; - $form->{type} = $self->type; - $form->{format} = $format; - $form->{formname} = $formname; - $form->{language} = '_' . $language->template_code if $language; - my $pdf_filename = $form->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; + my $pdf_filename = $form->generate_attachment_filename(); my $pdf; my @errors = _create_pdf($self->order, \$pdf, { format => $format, @@ -254,10 +254,10 @@ sub action_print { } # copy file to webdav folder - if ($self->order->ordnumber && $::instance_conf->get_webdav_documents) { + if ($self->order->number && $::instance_conf->get_webdav_documents) { my $webdav = SL::Webdav->new( type => $self->type, - number => $self->order->ordnumber, + number => $self->order->number, ); my $webdav_file = SL::Webdav::File->new( webdav => $webdav, @@ -270,7 +270,7 @@ sub action_print { $self->js->flash('error', t8('Storing PDF to webdav folder failed: #1', $@)); } } - if ($self->order->ordnumber && $::instance_conf->get_doc_storage) { + if ($self->order->number && $::instance_conf->get_doc_storage) { eval { SL::File->save(object_id => $self->order->id, object_type => $self->type, @@ -321,11 +321,11 @@ sub action_show_email_dialog { # Todo: get addresses from shipto, if any my $form = Form->new; - $form->{ordnumber} = $self->order->ordnumber; - $form->{formname} = $self->type; - $form->{type} = $self->type; - $form->{language} = 'de'; - $form->{format} = 'pdf'; + $form->{$self->_nr_key()} = $self->order->number; + $form->{formname} = $self->type; + $form->{type} = $self->type; + $form->{language} = 'de'; + $form->{format} = 'pdf'; $email_form->{subject} = $form->generate_email_subject(); $email_form->{attachment_filename} = $form->generate_attachment_filename(); @@ -1445,10 +1445,10 @@ sub _pre_render { $item->active_discount_source($price_source->discount_from_source($item->active_discount_source)); } - if ($self->order->ordnumber && $::instance_conf->get_webdav) { + if ($self->order->number && $::instance_conf->get_webdav) { my $webdav = SL::Webdav->new( type => $self->type, - number => $self->order->ordnumber, + number => $self->order->number, ); my @all_objects = $webdav->get_all_objects; @{ $self->{template_args}->{WEBDAV} } = map { { name => $_->filename, @@ -1692,6 +1692,14 @@ sub _request_quotation_type { 'request_quotation'; } +sub _nr_key { + return $_[0]->type eq _sales_order_type() ? 'ordnumber' + : $_[0]->type eq _purchase_order_type() ? 'ordnumber' + : $_[0]->type eq _sales_quotation_type() ? 'quonumber' + : $_[0]->type eq _request_quotation_type() ? 'quonumber' + : ''; +} + 1; __END__