# my $data = {
# record_ids => [ 123, 124, 127, ],
# printer_id => 4711,
# my $data = {
# record_ids => [ 123, 124, 127, ],
# printer_id => 4711,
# num_created => 0,
# num_printed => 0,
# invoice_ids => [ 234, 235, ],
# conversion_errors => [ { id => 124, number => 'A981723', message => "Stuff went boom" }, ],
# print_errors => [ { id => 234, number => 'L87123123', message => "Printer is out of coffee" }, ],
# pdf_file_name => 'qweqwe.pdf',
# num_created => 0,
# num_printed => 0,
# invoice_ids => [ 234, 235, ],
# conversion_errors => [ { id => 124, number => 'A981723', message => "Stuff went boom" }, ],
# print_errors => [ { id => 234, number => 'L87123123', message => "Printer is out of coffee" }, ],
# pdf_file_name => 'qweqwe.pdf',
- $invoice = $sales_delivery_order->convert_to_invoice(item_filter => \&delivery_order_item_filter, queue_sort => 1) || die $db->error;
- # $delivery_order->post_save_sanity_check; # just a hint at e8521eee (#90 od)
+ $invoice = $sales_delivery_order->convert_to_invoice(sub { $data->{transdate} ? ('attributes' => { transdate => $data->{transdate} }) :
+ undef }->() ) || die $db->error;
template => $ctrl->find_template(name => 'invoice', printer_id => $printer_id),
variables => Form->new(''),
return => 'file_name',
template => $ctrl->find_template(name => 'invoice', printer_id => $printer_id),
variables => Form->new(''),
return => 'file_name',
$create_params{variables}->{$_} = $variables{$_} for keys %variables;
$invoice->flatten_to_form($create_params{variables}, format_amounts => 1);
$create_params{variables}->{$_} = $variables{$_} for keys %variables;
$invoice->flatten_to_form($create_params{variables}, format_amounts => 1);
- my $job_obj = $self->{job_obj};
- my $data = $job_obj->data_as_hash;
- my $printer_id = $data->{printer_id};
+ my $job_obj = $self->{job_obj};
+ my $data = $job_obj->data_as_hash;
+ my $printer_id = $data->{printer_id};
+ my $copy_printer_id = $data->{copy_printer_id};
- if (!open $out, '|-', $command) {
- push @{ $data->{print_errors} }, { message => $::locale->text('Could not execute printer command: #1', $!) };
- $job_obj->update_attributes(data_as_hash => $data);
- return;
+ foreach my $local_printer_id ($printer_id, $copy_printer_id) {
+ next unless $local_printer_id;
+ SL::DB::Printer
+ ->new(id => $local_printer_id)
+ ->load
+ ->print_document(content => $self->{merged_pdf});
)->set_data(
record_ids => [ map { $_->id } @records[0..$num - 1] ],
printer_id => $::form->{printer_id},
)->set_data(
record_ids => [ map { $_->id } @records[0..$num - 1] ],
printer_id => $::form->{printer_id},
Converts the source objects (DeliveryOrder) to destination objects (Invoice).
On success objects will be saved.
Converts the source objects (DeliveryOrder) to destination objects (Invoice).
On success objects will be saved.
+If param C<data->{transdate}> is set, this will be the transdate. No safety checks are done.
+The original conversion from order to delivery order had a post_save_sanity_check
+C<$delivery_order-E<gt>post_save_sanity_check; # just a hint at e8521eee (#90 od)>
+The params of convert_to_invoice are created on the fly with a anonym sub, as a alternative check
+ perlsecret Enterprise ()x!!
Currently the calculation from the gui (form) differs from the calculation via convert (PTC).
Furthermore mass conversion with foreign currencies could lead to problems (daily rate check).
Currently the calculation from the gui (form) differs from the calculation via convert (PTC).
Furthermore mass conversion with foreign currencies could lead to problems (daily rate check).