X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FMassInvoiceCreatePrint.pm;h=b7212c780b88f55deb02fb85b654441e35ac6893;hb=4d3be9c7cbf7d525181428a9b3697338aa066f0f;hp=0e62700bb66624d29cc76fa093d854ef9238f1b3;hpb=b74a00e5100336d13d1536870721796474599a08;p=kivitendo-erp.git diff --git a/SL/Controller/MassInvoiceCreatePrint.pm b/SL/Controller/MassInvoiceCreatePrint.pm index 0e62700bb..b7212c780 100644 --- a/SL/Controller/MassInvoiceCreatePrint.pm +++ b/SL/Controller/MassInvoiceCreatePrint.pm @@ -56,9 +56,9 @@ sub action_create_invoices { } my $db = SL::DB::Invoice->new->db; + my @invoices; - if (!$db->do_transaction(sub { - my @invoices; + if (!$db->with_transaction(sub { foreach my $id (@sales_delivery_order_ids) { my $delivery_order = SL::DB::DeliveryOrder->new(id => $id)->load; @@ -66,17 +66,17 @@ sub action_create_invoices { push @invoices, $invoice; } - my $key = sprintf('%d-%d', Time::HiRes::gettimeofday()); - $::auth->set_session_value("MassInvoiceCreatePrint::ids-${key}" => [ map { $_->id } @invoices ]); - - flash_later('info', t8('The invoices have been created. They\'re pre-selected below.')); - $self->redirect_to(action => 'list_invoices', ids => $key); - 1; })) { $::lxdebug->message(LXDebug::WARN(), "Error: " . $db->error); $::form->error($db->error); } + + my $key = sprintf('%d-%d', Time::HiRes::gettimeofday()); + $::auth->set_session_value("MassInvoiceCreatePrint::ids-${key}" => [ map { $_->id } @invoices ]); + + flash_later('info', t8('The invoices have been created. They\'re pre-selected below.')); + $self->redirect_to(action => 'list_invoices', ids => $key); } sub action_list_invoices { @@ -137,6 +137,7 @@ sub action_create_print_all_start { invoice_ids => [ ], conversion_errors => [ ], print_errors => [ ], + session_id => $::auth->get_session_id, )->update_next_run_at; @@ -216,7 +217,6 @@ sub _init_sales_delivery_order_models { query => [ '!customer_id' => undef, or => [ closed => undef, closed => 0 ], - or => [ delivered => undef, delivered => 0 ], ], ); } @@ -277,6 +277,9 @@ sub create_pdfs { template => $self->find_template(name => 'invoice', printer_id => $params{printer_id}), variables => Form->new(''), return => 'file_name', + variable_content_types => { longdescription => 'html', + partnotes => 'html', + notes => 'html',} ); $create_params{variables}->{$_} = $params{variables}->{$_} for keys %{ $params{variables} }; @@ -322,12 +325,7 @@ sub download_or_print_documents { } my $printer = SL::DB::Printer->new(id => $params{printer_id})->load; - my $command = SL::Template::create(type => 'ShellCommand', form => Form->new(''))->parse($printer->printer_command); - - open my $out, '|-', $command or die $!; - binmode $out; - print $out $merged_pdf; - close $out; + $printer->print_document(content => $merged_pdf); flash_later('info', t8('The documents have been sent to the printer \'#1\'.', $printer->printer_description)); return $self->redirect_to(action => 'list_invoices', printer_id => $params{printer_id}); @@ -346,8 +344,8 @@ sub make_filter_summary { my @filters = ( [ $filter->{customer}{"name:substr::ilike"}, t8('Customer') ], - [ $filter->{"transdate:date::ge"}, t8('Delivery Date') . " " . t8('From Date') ], - [ $filter->{"transdate:date::le"}, t8('Delivery Date') . " " . t8('To Date') ], + [ $filter->{"transdate:date::ge"}, t8('Transdate') . " " . t8('From Date') ], + [ $filter->{"transdate:date::le"}, t8('Transdate') . " " . t8('To Date') ], ); for (@filters) {