Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 54ce5144

Von Martin Helmling vor fast 8 Jahren hinzugefügt

  • ID 54ce51443886623bb785e7c54492ecbc8dc9b3aa
  • Vorgänger 0bfbcce6
  • Nachfolger 65922b0d

Dateimanagement: Massendruck

Der Massendruck per BackgroundJob nutzt nun das FileManagement

Die erzeugten Dateien werden ggf. mit PDF Anhängen erweitert
und entsprechend abgespeichert.

Per Flag kann dem massendruck mitgeteilt werden,
dass eine leere Seite ggf hinzugefügt wird
(Template in templates/print/Standard/emptyPage.pdf o.ä.),
damit nächster Lieferschein auf neuem Blatt beginnt.

pdfinfo wird beim installationscheck gesucht,
leere Seite in Druckvorlagen

Vereinheitlichen der HTML -> PDF Konvertierung

Der HASH "variable_content_types" wird an unterschiedlichsten Stellen mit
unterschiedlichen oder unvollständiger Information befüllt.

Nun wird es an zentraler Stelle gemacht

Unterschiede anzeigen:

SL/BackgroundJob/CreatePeriodicInvoices.pm
337 337
  $form->{OUT}          = $config->printer->printer_command;
338 338
  $form->{OUT_MODE}     = '|-';
339 339

  
340
  $form->{TEMPLATE_DRIVER_OPTIONS} = {
341
    variable_content_types => {
342
      longdescription => 'html',
343
      partnotes       => 'html',
344
      notes           => 'html',
345
    },
346
  };
340
  $form->{TEMPLATE_DRIVER_OPTIONS} = { };
341
  $form->{TEMPLATE_DRIVER_OPTIONS}->{variable_content_types} = $form->get_variable_content_types();
347 342

  
348 343
  $form->prepare_for_printing;
349 344

  
SL/BackgroundJob/MassDeliveryOrderPrinting.pm
1
package SL::BackgroundJob::MassDeliveryOrderPrinting;
2

  
3
use strict;
4
use warnings;
5

  
6
use parent qw(SL::BackgroundJob::Base);
7

  
8
use SL::DB::DeliveryOrder;
9
use SL::DB::Order;  # origin order to delivery_order
10
use SL::DB::Printer;
11
use SL::SessionFile;
12
use SL::Template;
13
use SL::Helper::MassPrintCreatePDF qw(:all);
14
use SL::Helper::CreatePDF qw(:all);
15
use SL::Helper::File qw(store_pdf append_general_pdf_attachments);
16

  
17
use constant WAITING_FOR_EXECUTION       => 0;
18
use constant PRINTING_DELIVERY_ORDERS    => 1;
19
use constant DONE                        => 2;
20

  
21
# Data format:
22
# my $data             = {
23
#   record_ids          => [ 123, 124, 127, ],
24
#   printer_id         => 4711,
25
#   num_created        => 0,
26
#   num_printed        => 0,
27
#   printed_ids        => [ 234, 235, ],
28
#   conversion_errors  => [ { id => 124, number => 'A981723', message => "Stuff went boom" }, ],
29
#   print_errors       => [ { id => 234, number => 'L87123123', message => "Printer is out of coffee" }, ],
30
#   pdf_file_name      => 'qweqwe.pdf',
31
#   session_id         => $::auth->get_session_id,
32
# };
33

  
34

  
35
sub convert_deliveryorders_to_pdf {
36
  my ($self) = @_;
37

  
38
  my $job_obj = $self->{job_obj};
39
  my $db      = $job_obj->db;
40

  
41
  $job_obj->set_data(status => PRINTING_DELIVERY_ORDERS())->save;
42
  my $data   = $job_obj->data_as_hash;
43

  
44
  my $printer_id = $data->{printer_id};
45
  if ( $data->{media} ne 'printer' ) {
46
      undef $printer_id;
47
      $data->{media} = 'file';
48
  }
49
  my %variables  = (
50
    type         => 'delivery_order',
51
    formname     =>  $data->{formname},
52
    format       =>  $data->{format},
53
    media        =>  $data->{media},
54
    printer_id   =>  $printer_id,
55
    copies       =>  $data->{copies},
56
  );
57

  
58
  my @pdf_file_names;
59
  foreach my $delivery_order_id (@{ $data->{record_ids} }) {
60
    my $number = $delivery_order_id;
61
    my $delivery_order = SL::DB::DeliveryOrder->new(id => $delivery_order_id)->load;
62

  
63
    eval {
64
      $number = $delivery_order->donumber;
65

  
66
      my %params = (
67
        variables  => \%variables,
68
        document   => $delivery_order,
69
        return     => 'file_name',
70
       );
71

  
72
      push @pdf_file_names, $self->create_massprint_pdf(%params);
73

  
74
      $data->{num_created}++;
75

  
76
      1;
77

  
78
    } or do {
79
      push @{ $data->{conversion_errors} }, { id => $delivery_order->id, number => $number, message => $@ };
80
    };
81

  
82
    $job_obj->update_attributes(data_as_hash => $data);
83
  }
84

  
85
  $self->merge_massprint_pdf(file_names => \@pdf_file_names, type => 'delivery_order' ) if scalar(@pdf_file_names) > 0;
86
}
87

  
88
sub run {
89
  my ($self, $job_obj) = @_;
90

  
91
  $self->{job_obj}         = $job_obj;
92

  
93
  $self->convert_deliveryorders_to_pdf;
94
  $self->print_pdfs;
95

  
96
  my $data       = $job_obj->data_as_hash;
97
  $data->{num_printed} =  $data->{num_created};
98
  $job_obj->update_attributes(data_as_hash => $data);
99
  $job_obj->set_data(status => DONE())->save;
100

  
101
  return 1;
102
}
103

  
104
1;
105

  
SL/BackgroundJob/MassRecordCreationAndPrinting.pm
12 12
use SL::SessionFile;
13 13
use SL::Template;
14 14
use SL::Locale::String qw(t8);
15
use SL::Helper::MassPrintCreatePDF qw(:all);
16
use SL::Helper::CreatePDF qw(:all);
17
use SL::Helper::File qw(store_pdf append_general_pdf_attachments);
15 18
use SL::Webdav;
16 19

  
17 20
use constant WAITING_FOR_EXECUTION       => 0;
18 21
use constant CONVERTING_DELIVERY_ORDERS  => 1;
19 22
use constant PRINTING_INVOICES           => 2;
20 23
use constant DONE                        => 3;
24

  
21 25
# Data format:
22 26
# my $data             = {
23 27
#   record_ids          => [ 123, 124, 127, ],
......
46 50
    my $data   = $job_obj->data_as_hash;
47 51

  
48 52
    eval {
53
      my $invoice;
49 54
      my $sales_delivery_order = SL::DB::DeliveryOrder->new(id => $delivery_order_id)->load;
50 55
      $number                  = $sales_delivery_order->donumber;
51
      my %conversion_params    = $data->{transdate} ? ('attributes' => { transdate => $data->{transdate} }) : ();
52
      my $invoice              = $sales_delivery_order->convert_to_invoice(%conversion_params);
53 56

  
54
      die $db->error if !$invoice;
57
      if (!$db->with_transaction(sub {
58
        $invoice = $sales_delivery_order->convert_to_invoice(sub { $data->{transdate} ? ('attributes' => { transdate => $data->{transdate} }) :
59
                                                                         undef }->() ) || die $db->error;
60
        1;
61
      })) {
62
        die $db->error;
63
      }
55 64

  
56 65
      $data->{num_created}++;
57 66
      push @{ $data->{invoice_ids} }, $invoice->id;
......
75 84
  my $db      = $job_obj->db;
76 85

  
77 86
  $job_obj->set_data(status => PRINTING_INVOICES())->save;
87
  my $data = $job_obj->data_as_hash;
78 88

  
79
  require SL::Controller::MassInvoiceCreatePrint;
80

  
81
  my $printer_id = $job_obj->data_as_hash->{printer_id};
82
  my $ctrl       = SL::Controller::MassInvoiceCreatePrint->new;
89
  my $printer_id = $data->{printer_id};
90
  if ( $data->{media} ne 'printer' ) {
91
      undef $printer_id;
92
      $data->{media} = 'file';
93
  }
83 94
  my %variables  = (
84 95
    type         => 'invoice',
85 96
    formname     => 'invoice',
86 97
    format       => 'pdf',
87 98
    media        => $printer_id ? 'printer' : 'file',
99
    printer_id   => $printer_id,
88 100
  );
89 101

  
90 102
  my @pdf_file_names;
91 103

  
92 104
  foreach my $invoice (@{ $self->{invoices} }) {
93
    my $data = $job_obj->data_as_hash;
94 105

  
95 106
    eval {
96
      my %create_params = (
97
        template  => $ctrl->find_template(name => 'invoice', printer_id => $printer_id),
98
        variables => Form->new(''),
107
      my %params = (
108
        variables => \%variables,
99 109
        return    => 'file_name',
100
        variable_content_types => { longdescription => 'html',
101
                                    partnotes       => 'html',
102
                                    notes           => 'html',}
110
        document  => $invoice,
103 111
      );
112
      push @pdf_file_names, $self->create_massprint_pdf(%params);
104 113

  
114
      $data->{num_printed}++;
105 115

  
106

  
107
      $create_params{variables}->{$_} = $variables{$_} for keys %variables;
108

  
109
      $invoice->flatten_to_form($create_params{variables}, format_amounts => 1);
110
      $create_params{variables}->prepare_for_printing;
111

  
112
      push @pdf_file_names, $ctrl->create_pdf(%create_params);
113

  
116
      # OLD WebDAV Code, may be deleted:
114 117
      # copy file to webdav folder
115 118
      if ($::instance_conf->get_webdav_documents) {
116 119
        my $webdav = SL::Webdav->new(
......
129 132
        }
130 133
      }
131 134

  
132
      $data->{num_printed}++;
133

  
134 135
      1;
135 136

  
136 137
    } or do {
......
140 141
    $job_obj->update_attributes(data_as_hash => $data);
141 142
  }
142 143

  
143
  if (@pdf_file_names) {
144
    my $data = $job_obj->data_as_hash;
145

  
146
    eval {
147
      $self->{merged_pdf} = $ctrl->merge_pdfs(file_names => \@pdf_file_names);
148
      unlink @pdf_file_names;
149

  
150
      if (!$printer_id) {
151
        my $file_name = 'mass_invoice' . $job_obj->id . '.pdf';
152
        my $sfile     = SL::SessionFile->new($file_name, mode => 'w', session_id => $data->{session_id});
153
        $sfile->fh->print($self->{merged_pdf});
154
        $sfile->fh->close;
155

  
156
        $data->{pdf_file_name} = $file_name;
157
      }
158

  
159
      1;
160

  
161
    } or do {
162
      push @{ $data->{print_errors} }, { message => $@ };
163
    };
164

  
165
    $job_obj->update_attributes(data_as_hash => $data);
166
  }
167
}
168

  
169
sub print_pdfs {
170
  my ($self)     = @_;
171

  
172
  my $job_obj         = $self->{job_obj};
173
  my $data            = $job_obj->data_as_hash;
174
  my $printer_id      = $data->{printer_id};
175
  my $copy_printer_id = $data->{copy_printer_id};
176

  
177
  return if !$printer_id;
178

  
179
  my $out;
180

  
181
  foreach  my $local_printer_id ($printer_id, $copy_printer_id) {
182
    next unless $local_printer_id;
183
    SL::DB::Printer
184
      ->new(id => $local_printer_id)
185
      ->load
186
      ->print_document(content => $self->{merged_pdf});
187
  }
188

  
144
  $self->merge_massprint_pdf(file_names => \@pdf_file_names, type => 'invoice' ) if scalar(@pdf_file_names) > 0;
189 145
}
190 146

  
191 147
sub run {
SL/Controller/MassDeliveryOrderPrint.pm
1
package SL::Controller::MassDeliveryOrderPrint;
2

  
3
use strict;
4

  
5
use parent qw(SL::Controller::Base);
6

  
7
use File::Slurp ();
8
use File::Copy;
9
use List::MoreUtils qw(uniq);
10
use List::Util qw(first);
11

  
12
use SL::Controller::Helper::GetModels;
13
use SL::BackgroundJob::MassDeliveryOrderPrinting;
14
use SL::DB::Customer;
15
use SL::DB::DeliveryOrder;
16
use SL::DB::Order;
17
use SL::DB::Part;
18
use SL::DB::Printer;
19
use SL::Helper::MassPrintCreatePDF qw(:all);
20
use SL::Helper::CreatePDF qw(:all);
21
use SL::Helper::PrintOptions;
22
use SL::Helper::Flash;
23
use SL::Locale::String;
24
use SL::SessionFile;
25
use SL::System::TaskServer;
26

  
27
use Rose::Object::MakeMethods::Generic
28
(
29
  'scalar --get_set_init' => [ qw(delivery_order_models delivery_order_ids printers filter_summary temp_files) ],
30
);
31

  
32
__PACKAGE__->run_before('setup');
33

  
34
#
35
# actions
36
#
37
sub action_list_delivery_orders {
38
  my ($self) = @_;
39

  
40
  my $show = ($::form->{noshow}?0:1);
41
  delete $::form->{noshow};
42

  
43
  if ($::form->{ids}) {
44
    my $key = 'MassDeliveryOrderPrint::ids-' . $::form->{ids};
45
    $self->delivery_order_ids($::auth->get_session_value($key) || []);
46
    $self->delivery_order_models->add_additional_url_params(ids => $::form->{ids});
47
  }
48

  
49
  my %selected_ids = map { +($_ => 1) } @{ $self->delivery_order_ids };
50

  
51
  my $pr = SL::DB::Manager::Printer->find_by(
52
      printer_description => $::locale->text("sales_delivery_order_printer"));
53
  if ($pr ) {
54
      $::form->{printer_id} = $pr->id;
55
  }
56
  $self->render('mass_delivery_order_print/list_delivery_orders',
57
                title        => $::locale->text('Print delivery orders'),
58
                nowshow      => $show,
59
                print_opt    => $self->print_options(hide_language_id => 1),
60
                selected_ids => \%selected_ids);
61
}
62

  
63
sub action_mass_mdo_download {
64
  my ($self) = @_;
65
  my $job    = SL::DB::BackgroundJob->new(id => $::form->{job_id})->load;
66

  
67
  my $sfile  = SL::SessionFile->new($job->data_as_hash->{pdf_file_name}, mode => 'r');
68
  die $! if !$sfile->fh;
69

  
70
  my $merged_pdf = do { local $/; my $fh = $sfile->fh; <$fh> };
71
  $sfile->fh->close;
72

  
73
  my $file_name =  t8('Sales Delivery Orders') . '-' . DateTime->now_local->strftime('%Y%m%d%H%M%S') . '.pdf';
74
  $file_name    =~ s{[^\w\.]+}{_}g;
75

  
76
  return $self->send_file(
77
    \$merged_pdf,
78
    type => 'application/pdf',
79
    name => $file_name,
80
  );
81
}
82

  
83
sub action_mass_mdo_status {
84
  my ($self) = @_;
85
  $::lxdebug->enter_sub();
86
  eval {
87
    my $job = SL::DB::BackgroundJob->new(id => $::form->{job_id})->load;
88
    my $html = $self->render('mass_delivery_order_print/_print_status', { output => 0 }, job => $job);
89

  
90
    $self->js->html('#mass_print_dialog', $html);
91
    if ( $job->data_as_hash->{status} == SL::BackgroundJob::MassDeliveryOrderPrinting->DONE() ) {
92
      foreach my $dorder_id (@{$job->data_as_hash->{record_ids}}) {
93
        $self->js->prop('#multi_id_id_'.$dorder_id,'checked',0);
94
      }
95
      $self->js->prop('#multi_all','checked',0);
96
      $self->js->run('kivi.MassDeliveryOrderPrint.massConversionFinished');
97
    }
98
    1;
99
  } or do {
100
    $self->js->run('kivi.MassDeliveryOrderPrint.massConversionFinished')
101
      ->run('kivi.MassDeliveryOrderPrint.massConversionFinishProcess')
102
      ->flash('error', t8('No such job #1 in the database.',$::form->{job_id}));
103
  };
104
  $self->js->render;
105

  
106
  $::lxdebug->leave_sub();
107
}
108

  
109
sub action_mass_mdo_print {
110
  my ($self) = @_;
111
  $::lxdebug->enter_sub();
112

  
113
  eval {
114
    my @do_ids = @{ $::form->{id} || [] };
115
    push @do_ids, map { $::form->{"trans_id_$_"} } grep { $::form->{"multi_id_$_"} } (1..$::form->{rowcount});
116

  
117
    my @delivery_orders = map { SL::DB::DeliveryOrder->new(id => $_)->load } @do_ids;
118

  
119
    if (!@delivery_orders) {
120
      $self->js->flash('error', t8('No delivery orders have been selected.'));
121
    } else {
122
      my $job              = SL::DB::BackgroundJob->new(
123
        type               => 'once',
124
        active             => 1,
125
        package_name       => 'MassDeliveryOrderPrinting',
126

  
127
      )->set_data(
128
        record_ids         => [ @do_ids ],
129
        printer_id         => $::form->{printer_id},
130
        formname           => $::form->{formname},
131
        format             => $::form->{format},
132
        media              => $::form->{media},
133
        bothsided          => ($::form->{bothsided}?1:0),
134
        copies             => $::form->{copies},
135
        status             => SL::BackgroundJob::MassDeliveryOrderPrinting->WAITING_FOR_EXECUTION(),
136
        num_created        => 0,
137
        num_printed        => 0,
138
        printed_ids        => [ ],
139
        conversion_errors  => [ ],
140
        print_errors       => [ ],
141
        session_id         => $::auth->get_session_id,
142

  
143
      )->update_next_run_at;
144

  
145
      SL::System::TaskServer->new->wake_up;
146
      my $html = $self->render('mass_delivery_order_print/_print_status', { output => 0 }, job => $job);
147

  
148
      $self->js
149
        ->html('#mass_print_dialog', $html)
150
        ->run('kivi.MassDeliveryOrderPrint.massConversionPopup')
151
        ->run('kivi.MassDeliveryOrderPrint.massConversionStarted');
152
    }
153
    1;
154
  } or do {
155
    my $errstr = $@;
156
    my $htmlstr = $errstr;
157
    $htmlstr =~ s/\n/<br>/g;
158
    $self->js->flash('error', t8('Document generating failed. Please check Templates an LateX !'));
159
    $self->js->flash_detail('error', $htmlstr);
160
  };
161
  $self->js->render;
162
  $::lxdebug->leave_sub();
163
}
164

  
165
sub action_downloadpdf {
166
  my ($self) = @_;
167
  $::lxdebug->enter_sub();
168
  if ( $::form->{filename} ) {
169
    my $content = scalar File::Slurp::read_file($::form->{filename});
170
    my $file_name = $::form->get_formname_translation($::form->{formname}) .
171
      '-' . DateTime->now_local->strftime('%Y%m%d%H%M%S') . '.pdf';
172
    $file_name    =~ s{[^\w\.]+}{_}g;
173

  
174
    unlink($::form->{filename});
175

  
176
    return $self->send_file(
177
      \$content,
178
      type => 'application/pdf',
179
      name => $file_name,
180
    );
181
  } else {
182
    flash('error', t8('No filename exists!'));
183
  }
184
  $::lxdebug->leave_sub();
185
}
186

  
187
#
188
# filters
189
#
190

  
191
sub init_printers { SL::DB::Manager::Printer->get_all_sorted }
192
sub init_delivery_order_ids { [] }
193
sub init_temp_files { [] }
194

  
195
sub init_delivery_order_models {
196
  my ($self)             = @_;
197
  my @delivery_order_ids = @{ $self->delivery_order_ids };
198

  
199
  SL::Controller::Helper::GetModels->new(
200
    controller   => $_[0],
201
    model        => 'DeliveryOrder',
202
    (paginated   => 0,) x !!@delivery_order_ids,
203
    sorted       => {
204
      _default     => {
205
        by           => 'reqdate',
206
        dir          => 0,
207
      },
208
      customer     => t8('Customer'),
209
      donumber     => t8('Delivery Order Number'),
210
      employee     => t8('Employee'),
211
      ordnumber    => t8('Order Number'),
212
      reqdate      => t8('Delivery Date'),
213
      transdate    => t8('Date'),
214
    },
215
    with_objects => [ qw(customer employee) ],
216
    query        => [
217
      '!customer_id' => undef,
218
      or             => [ closed    => undef, closed    => 0 ],
219
      (id            => \@delivery_order_ids) x !!@delivery_order_ids,
220
    ],
221
  );
222
}
223

  
224
sub init_filter_summary {
225
  my ($self) =@_;
226
  my $filter = $::form->{filter} || { customer => {}, shipto => {}, };
227

  
228
  my @filters;
229
  push @filters, t8('Customer')                              . ' ' . $filter->{customer}->{'name:substr::ilike'}     if $filter->{customer}->{'name:substr::ilike'};
230
  push @filters, t8('Shipping address (name)')               . ' ' . $filter->{shipto}->{'shiptoname:substr::ilike'} if $filter->{shipto}->{'shiptoname:substr::ilike'};
231
  push @filters, t8('Delivery Date') . ' ' . t8('From Date') . ' ' . $filter->{'reqdate:date::ge'}                   if $filter->{'reqdate:date::ge'};
232
  push @filters, t8('Delivery Date') . ' ' . t8('To Date')   . ' ' . $filter->{'reqdate:date::le'}                   if $filter->{'reqdate:date::le'};
233

  
234
  return join ', ', @filters;
235
}
236

  
237
sub setup {
238
  my ($self) = @_;
239
  $::auth->assert('sales_delivery_order_edit');
240
  $::request->layout->use_javascript("${_}.js")  for qw(kivi.MassDeliveryOrderPrint);
241
}
242

  
243

  
244
sub generate_documents {
245
  my ($self, @delivery_orders) = @_;
246

  
247
  my %pdf_params = (
248
    'documents'       => \@delivery_orders ,
249
    'variables'       => {
250
      'type'            => $::form->{type},
251
      'formname'        => $::form->{formname},
252
      'language_id'     => '',
253
      'format'          => 'pdf',
254
      'media'           => 'file',
255
      'printer_id'      => $::form->{printer_id},
256
    });
257

  
258
  my ($temp_fh, $outname) = File::Temp::tempfile(
259
    'kivitendo-outfileXXXXXX',
260
    SUFFIX => '.pdf',
261
    DIR    => $::lx_office_conf{paths}->{userspath},
262
    UNLINK => 0,
263
  );
264
  close $temp_fh;
265

  
266
  my @pdf_file_names = $self->create_pdfs(%pdf_params);
267
  my $fcount = scalar(@pdf_file_names);
268
  if ( $fcount < 2 ) {
269
    copy($pdf_file_names[0],$outname);
270
  } else {
271
    if ( !$self->merge_pdfs(file_names => \@pdf_file_names, out_path => $outname, bothsided => $::form->{bothsided} )) {
272
      $::lxdebug->leave_sub();
273
      return 0;
274
    }
275
  }
276
  foreach my $dorder (@delivery_orders) {
277
    $self->js->prop('#multi_id_id_'.$dorder->id,'checked',0);
278
  }
279
  $self->js->prop('#multi_all','checked',0);
280
  return $outname;
281
}
282

  
283
1;
SL/Controller/MassInvoiceCreatePrint.pm
13 13
use SL::DB::DeliveryOrder;
14 14
use SL::DB::Order;
15 15
use SL::DB::Printer;
16
use SL::Helper::MassPrintCreatePDF qw(:all);
16 17
use SL::Helper::CreatePDF qw(:all);
17 18
use SL::Helper::Flash;
18 19
use SL::Locale::String;
19 20
use SL::SessionFile;
20 21
use SL::System::TaskServer;
21

  
22 22
use Rose::Object::MakeMethods::Generic
23 23
(
24 24
  'scalar --get_set_init' => [ qw(invoice_models invoice_ids sales_delivery_order_models printers default_printer_id today) ],
......
130 130
    record_ids         => [ map { $_->id } @records[0..$num - 1] ],
131 131
    printer_id         => $::form->{printer_id},
132 132
    copy_printer_id    => $::form->{copy_printer_id},
133
    bothsided          => ($::form->{bothsided}?1:0),
133 134
    transdate          => $::form->{transdate},
134 135
    status             => SL::BackgroundJob::MassRecordCreationAndPrinting->WAITING_FOR_EXECUTION(),
135 136
    num_created        => 0,
......
172 173
  $sfile->fh->close;
173 174

  
174 175
  my $type      = 'Invoices';
175
  my $file_name =  t8($type) . '-' . DateTime->today_local->strftime('%Y%m%d%H%M%S') . '.pdf';
176
  my $file_name =  t8($type) . '-' . DateTime->now_local->strftime('%Y%m%d%H%M%S') . '.pdf';
176 177
  $file_name    =~ s{[^\w\.]+}{_}g;
177 178

  
178 179
  return $self->send_file(
......
187 188
#
188 189

  
189 190
sub init_printers { SL::DB::Manager::Printer->get_all_sorted }
191
#sub init_att      { require SL::Controller::Attachments; SL::Controller::Attachments->new() }
190 192
sub init_invoice_ids { [] }
191 193
sub init_today         { DateTime->today_local }
192 194

  
......
268 270
# helpers
269 271
#
270 272

  
271
sub create_pdfs {
272
  my ($self, %params) = @_;
273

  
274
  my @pdf_file_names;
275
  foreach my $invoice (@{ $params{invoices} }) {
276
    my %create_params = (
277
      template  => $self->find_template(name => 'invoice', printer_id => $params{printer_id}),
278
      variables => Form->new(''),
279
      return    => 'file_name',
280
      variable_content_types => { longdescription => 'html',
281
                                  partnotes       => 'html',
282
                                  notes           => 'html',}
283
    );
284

  
285
    $create_params{variables}->{$_} = $params{variables}->{$_} for keys %{ $params{variables} };
286

  
287
    $invoice->flatten_to_form($create_params{variables}, format_amounts => 1);
288
    $create_params{variables}->prepare_for_printing;
289

  
290
    push @pdf_file_names, $self->create_pdf(%create_params);
291
  }
292

  
293
  return @pdf_file_names;
294
}
295 273

  
296 274
sub download_or_print_documents {
297 275
  my ($self, %params) = @_;
......
300 278

  
301 279
  eval {
302 280
    my %pdf_params = (
303
      invoices        => $params{invoices},
304
      printer_id      => $params{printer_id},
281
      documents       => $params{invoices},
305 282
      variables       => {
306 283
        type        => 'invoice',
307 284
        formname    => 'invoice',
308 285
        format      => 'pdf',
309 286
        media       => $params{printer_id} ? 'printer' : 'file',
287
        printer_id  => $params{printer_id},
310 288
      });
311 289

  
312 290
    @pdf_file_names = $self->create_pdfs(%pdf_params);
......
314 292
    unlink @pdf_file_names;
315 293

  
316 294
    if (!$params{printer_id}) {
317
      my $file_name =  t8("Invoices") . '-' . DateTime->today_local->strftime('%Y%m%d%H%M%S') . '.pdf';
295
      my $file_name =  t8("Invoices") . '-' . DateTime->now_local->strftime('%Y%m%d%H%M%S') . '.pdf';
318 296
      $file_name    =~ s{[^\w\.]+}{_}g;
319 297

  
320 298
      return $self->send_file(
SL/DB/Helper/FlattenToForm.pm
82 82

  
83 83
    $idx++;
84 84

  
85
    $form->{"partsgroup_${idx}"} = $item->part->partsgroup->partsgroup if _has($item->part, 'partsgroup_id');
85
    $form->{"std_warehouse_${idx}"} = $item->part->warehouse->description if _has($item->part, 'warehouse_id');
86
    $form->{"std_bin_${idx}"}       = $item->part->bin->description       if _has($item->part, 'bin_id');
87
    $form->{"partsgroup_${idx}"}    = $item->part->partsgroup->partsgroup if _has($item->part, 'partsgroup_id');
86 88
    _copy($item,          $form, "${items_name}_", "_${idx}", 0,               qw(id)) if $items_name;
87 89
    # TODO: is part_type correct here? Do we need to set part_type as default?
88 90
    _copy($item->part,    $form, '',               "_${idx}", 0,               qw(id partnumber weight part_type));
SL/Form.pm
2846 2846
  $main::lxdebug->leave_sub();
2847 2847
}
2848 2848

  
2849
sub get_variable_content_types {
2850
  my %html_variables  = (
2851
      longdescription => 'html',
2852
      partnotes       => 'html',
2853
      notes           => 'html',
2854
      orignotes       => 'html',
2855
      notes1          => 'html',
2856
      notes2          => 'html',
2857
      notes3          => 'html',
2858
      notes4          => 'html',
2859
      header_text     => 'html',
2860
      footer_text     => 'html',
2861
  );
2862
  return \%html_variables;
2863
}
2864

  
2849 2865
sub current_date {
2850 2866
  $main::lxdebug->enter_sub();
2851 2867

  
SL/Helper/File.pm
80 80

  
81 81
 $self->store_pdf($self);
82 82

  
83
 $self->append_general_pdf_attachments($self) if ( $ext_for_format eq 'pdf' );
83
 $self->append_general_pdf_attachments(filepath => $pdf_filename, type => $form->{type}) if ( $ext_for_format eq 'pdf' );
84

  
85
#It is also used in MassPrint Helper
86
# 
84 87

  
85 88
=head1 DESCRIPTION
86 89

  
SL/Helper/MassPrintCreatePDF.pm
1
package SL::Helper::MassPrintCreatePDF;
2

  
3
use strict;
4

  
5
use Exporter 'import';
6
our @EXPORT_OK = qw(create_massprint_pdf merge_massprint_pdf create_pdfs print_pdfs);
7
our %EXPORT_TAGS = (
8
  all => \@EXPORT_OK,
9
);
10
use SL::Helper::CreatePDF qw(:all);
11
use SL::Helper::File qw(store_pdf append_general_pdf_attachments);
12

  
13
sub create_pdfs {
14
  my ($self, %params) = @_;
15
  my @pdf_file_names;
16
  foreach my $document (@{ $params{documents} }) {
17
    $params{document} = $document;
18
    push @pdf_file_names, $self->create_massprint_pdf(%params);
19
  }
20

  
21
  return @pdf_file_names;
22
}
23

  
24
sub create_massprint_pdf {
25
  my ($self, %params) = @_;
26
  my $form = Form->new('');
27
  my %create_params = (
28
      variables => $form,
29
      return    => 'file_name',
30
  );
31
  ## find_template may return a list !
32
  $create_params{template} = $self->find_template(name => $params{variables}->{formname}, printer_id => $params{printer_id});
33
  $form->{cwd}= POSIX::getcwd();
34

  
35
  $form->{$_} = $params{variables}->{$_} for keys %{ $params{variables} };
36

  
37
  $create_params{variable_content_types} = $form->get_variable_content_types();
38
  $params{document}->flatten_to_form($form, format_amounts => 1);
39
  # flatten_to_form sets payment_terms from customer/vendor - we do not want that here
40
  # really ??
41
  delete $form->{payment_terms} if !$form->{payment_id};
42

  
43
  $form->prepare_for_printing;
44
  $form->{attachment_filename} = $form->generate_attachment_filename;
45

  
46
  my $pdf_filename = $self->create_pdf(%create_params);
47

  
48
  if ( $::instance_conf->get_doc_storage && ! $form->{preview}) {
49
    $self->append_general_pdf_attachments(filepath => $pdf_filename, type => $form->{type} );
50
    $form->{tmpfile} = $pdf_filename;
51
    $form->{id}      = $params{document}->id;
52
    $self->store_pdf($form);
53
  }
54
  $form->{id} = $params{document}->id;
55
  if ( ! $form->{preview} ) {
56
    if ( ref($params{document}) eq 'SL::DB::DeliveryOrder' ) {
57
      $form->{snumbers} = "ordnumber_" . $params{document}->donumber;
58
    }
59
    else {
60
      $form->{snumbers} = "unknown";
61
    }
62
    $form->{addition} = "PRINTED";
63
    $form->{what_done} = $::form->{type};
64
    $form->save_history;
65
  }
66
  return $pdf_filename;
67
}
68

  
69
sub merge_massprint_pdf {
70
  my ($self, %params)     = @_;
71
  return unless $params{file_names} && $params{type};
72

  
73
  my $job_obj = $self->{job_obj};
74
  my $data    = $job_obj->data_as_hash;
75
  my @pdf_file_names = @{$params{file_names}};
76

  
77
  eval {
78
    my $file_name = 'mass_'.$params{type}.'_'.$job_obj->id . '.pdf';
79
    my $sfile     = SL::SessionFile->new($file_name, mode => 'w', session_id => $data->{session_id});
80
    $sfile->fh->close;
81
    $data->{pdf_file_name} = $sfile->file_name;
82

  
83
    $self->merge_pdfs(file_names => \@pdf_file_names, bothsided => $data->{bothsided}, out_path => $data->{pdf_file_name});
84
    unlink @pdf_file_names;
85

  
86
    1;
87

  
88
  } or do {
89
    push @{ $data->{print_errors} }, { message => $@ };
90
  };
91

  
92
  $job_obj->update_attributes(data_as_hash => $data);
93
}
94

  
95
sub print_pdfs {
96
  my ($self)     = @_;
97

  
98
  my $job_obj         = $self->{job_obj};
99
  my $data            = $job_obj->data_as_hash;
100
  my $printer_id      = $data->{printer_id};
101
  my $copy_printer_id = $data->{copy_printer_id};
102

  
103
  return if !$printer_id;
104

  
105
  my $out;
106

  
107
  foreach  my $local_printer_id ($printer_id, $copy_printer_id) {
108
    next unless $local_printer_id;
109
    SL::DB::Printer
110
      ->new(id => $local_printer_id)
111
      ->load
112
      ->print_document(file_name => $data->{pdf_file_name});
113
  }
114

  
115
}
116

  
117
1;
118

  
119
__END__
120

  
121
=encoding utf-8
122

  
123
=head1 NAME
124

  
125
SL::Helper::MassPrint_CreatePDF
126

  
127

  
128
=head1 DESCRIPTION
129

  
130
This Helper used bei Background Processing for Mass Printing.
131
The redundant way to fill data for createPDF is concentrated into this helper.
132
There are some additional settings for printing which are missed in CreatePDF Helper
133
and also the appending of generic PDF-Documents.
134

  
135
(This extension may be included in the CreatePDF Helper).
136

  
137

  
138
=head1 REQUIRES
139

  
140
L<SL::Helper::CreatePDF>
141

  
142
=head1 METHODS
143

  
144
=head2 C<create_massprint_pdf PARAMS>
145

  
146
a tempory $form is used to set
147

  
148
=over 2
149

  
150
=item 1. content types
151

  
152
=item 2. flatten_to_form
153

  
154
=item 3. prepare_for_printing
155

  
156
=item 4. set history
157

  
158
=back
159

  
160
before printing is done
161

  
162

  
163
=head1 AUTHOR
164

  
165
Martin Helmling E<lt>martin.helmling@opendynamic.deE<gt>
166

  
167

  
168
=cut
169

  
bin/mozilla/do.pl
302 302

  
303 303
  $form->{follow_up_trans_info} = $form->{donumber} .'('. $form->{VC_OBJ}->name .')';
304 304

  
305
  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.File kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part));
305
  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.File kivi.MassDeliveryOrderPrint kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part));
306 306

  
307 307
  my @custom_hidden;
308 308
  push @custom_hidden, map { "shiptocvar_" . $_->name } @{ SL::DB::Manager::CustomVariableConfig->get_all(where => [ module => 'ShipTo' ]) };
......
507 507
  my $locale   = $main::locale;
508 508
  my $cgi      = $::request->{cgi};
509 509

  
510
  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.MassDeliveryOrderPrint));
510 511
  ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} });
511 512

  
512 513
  report_generator_set_default_sort('transdate', 1);
......
544 545
  my $href = build_std_url('action=orders', grep { $form->{$_} } @hidden_variables);
545 546

  
546 547
  my %column_defs = (
547
    'ids'                     => { 'text' => '', },
548
    'ids'                     => { 'text' => '<input type="checkbox" id="multi_all" value="1">', 'align' => 'center' },
548 549
    'transdate'               => { 'text' => $locale->text('Delivery Order Date'), },
549 550
    'reqdate'                 => { 'text' => $locale->text('Reqdate'), },
550 551
    'id'                      => { 'text' => $locale->text('ID'), },
......
642 643
    push @options, $locale->text('Not delivered');
643 644
  }
644 645

  
646
  # all_vc ruft get_employee auf, dort wird emloyee überschrieben, deshalb retten:
647
  my $save_employee_id = $form->{'employee_id'};
648
  my $save_employee    = $form->{'employee'};
649
  $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
650
  $form->{'employee_id'} = $save_employee_id;
651
  $form->{'employee'}    = $save_employee;
652

  
653
  my $pr = SL::DB::Manager::Printer->find_by(
654
      printer_description => $::locale->text("sales_delivery_order_printer"));
655
  if ($pr ) {
656
      $form->{printer_id} = $pr->id;
657
  }
658

  
645 659
  $report->set_options('top_info_text'        => join("\n", @options),
646 660
                       'raw_top_info_text'    => $form->parse_html_template('do/orders_top'),
647
                       'raw_bottom_info_text' => $form->parse_html_template('do/orders_bottom'),
661
                       'raw_bottom_info_text' => $form->parse_html_template('do/orders_bottom',
662
                        {
663
                           print_options   => print_options(inline => 1,hide_language_id => 1),
664
                        }),
648 665
                       'output_format'        => 'HTML',
649 666
                       'title'                => $form->{title},
650 667
                       'attachment_basename'  => $attachment_basename . strftime('_%Y%m%d', localtime time),
......
669 686

  
670 687
    my $row = { map { $_ => { 'data' => $dord->{$_} } } @columns };
671 688

  
689
    my $ord_id = $dord->{id};
672 690
    $row->{ids}  = {
673
      'raw_data' =>   $cgi->hidden('-name' => "trans_id_${idx}", '-value' => $dord->{id})
674
                    . $cgi->checkbox('-name' => "multi_id_${idx}", '-value' => 1, '-label' => ''),
691
      'raw_data' =>   $cgi->hidden('-name' => "trans_id_${idx}", '-value' => $ord_id)
692
                    . $cgi->checkbox('-name' => "multi_id_${idx}",' id' => "multi_id_id_".$ord_id, '-value' => 1, '-label' => ''),
675 693
      'valign'   => 'center',
676 694
      'align'    => 'center',
677 695
    };
bin/mozilla/io.pl
1294 1294

  
1295 1295
  $form->{TEMPLATE_DRIVER_OPTIONS} = { };
1296 1296
  if (any { $form->{type} eq $_ } qw(sales_quotation sales_order sales_delivery_order invoice request_quotation purchase_order purchase_delivery_order credit_note)) {
1297
    $form->{TEMPLATE_DRIVER_OPTIONS}->{variable_content_types} = {
1298
      longdescription => 'html',
1299
      partnotes       => 'html',
1300
      notes           => 'html',
1301
    };
1297
    $form->{TEMPLATE_DRIVER_OPTIONS}->{variable_content_types} = $form->get_variable_content_types();
1302 1298
  }
1303 1299

  
1304 1300
  $form->isblank("email", $locale->text('E-mail address missing!'))
config/kivitendo.conf.default
64 64
# Set language for login and admin forms. Currently "de" (German)
65 65
# and "en" (English, not perfect) are available.
66 66
language = de
67
# MassPrint Timeout
68
# must be less than cgi timeout
69
#
70
massprint_timeout = 30
67 71

  
68 72
# Set default_manager for admin forms. Currently "german"
69 73
# and "swiss" are available.
js/kivi.MassDeliveryOrderPrint.js
1
namespace('kivi.MassDeliveryOrderPrint', function(ns) {
2
    
3
  ns.massConversionFinishProcess = function() {
4
    $('#mass_print_dialog').dialog('close');
5
  };
6

  
7
  ns.massConversionStarted = function() {
8
   $('#mdo_start_process_button,.ui-dialog-titlebar button.ui-dialog-titlebar-close').prop('disabled', 'disabled');
9
   $('#mdo_start_process_abort_link').remove();
10
   $('#mass_print_dialog').data('timerId', setInterval(function() {
11
      $.get("controller.pl", {
12
        action: 'MassDeliveryOrderPrint/mass_mdo_status',
13
        job_id: $('#mdo_job_id').val()
14
      }, kivi.eval_json_result);
15
    }, 5000));
16
  };
17

  
18
  ns.massConversionPopup = function() {
19
    kivi.popup_dialog({
20
      id: 'mass_print_dialog',
21
      dialog: {
22
        title: kivi.t8('Generate and print sales delivery orders')
23
      }
24
    });
25
  };
26

  
27
  ns.massConversionFinished = function() {
28
    clearInterval($('#mass_print_dialog').data('timerId'));
29
    $('.ui-dialog-titlebar button.ui-dialog-titlebar-close').prop('disabled', '')
30
  };
31

  
32
  ns.submitMultiOrders = function () {
33
      $("#old_table_id").remove();
34
      var checkboxes = $('input[type=checkbox]').filter(function () { return  $(this).prop('checked'); });
35
      if (checkboxes.size() == 0) {
36
          alert(kivi.t8("No delievery orders selected, please set one checkbox!"));
37
          return false;
38
      }
39
      
40
      var tmpform = $("#report_table_id").clone();
41
      tmpform.hide();
42
      tmpform.attr('id',"old_table_id");
43
      tmpform.appendTo("#print_multi_id");
44
      return kivi.submit_ajax_form('controller.pl?action=MassDeliveryOrderPrint/mass_mdo_print',$('#print_multi_id'));
45
  };
46

  
47
  ns.setup = function() {
48
    $('#multi_all').checkall("input[name^='multi_id']");
49
    $('#print_multi_button').click(kivi.MassDeliveryOrderPrint.submitMultiOrders);
50
  };
51
});
52

  
53
$(kivi.MassDeliveryOrderPrint.setup);
js/kivi.MassInvoiceCreatePrint.js
45 45
    var data = {
46 46
      action:             'MassInvoiceCreatePrint/create_print_all_start',
47 47
      number_of_invoices: $('#cpa_number_of_invoices').val(),
48
      bothsided:          $('#cpa_bothsided').val(),
48 49
      printer_id:         $('#cpa_printer_id').val(),
49 50
      copy_printer_id:    $('#cpa_copy_printer_id').val(),
50 51
      transdate:          $('#transdate').val()
js/locale/de.js
50 50
"Enter longdescription":"Langtext eingeben",
51 51
"Error: Name missing":"Fehler: Name fehlt",
52 52
"Function block actions":"Funktionsblockaktionen",
53
"Generate and print sales delivery orders":"Erzeuge und drucke Lieferscheine",
53 54
"Hide all details":"Alle Details verbergen",
54 55
"Hide details":"Details verbergen",
55 56
"History":"Historie",
56 57
"If you switch to a different tab without saving you will lose the data you've entered in the current tab.":"Wenn Sie auf einen anderen Tab wechseln, ohne vorher zu speichern, so gehen die im aktuellen Tab eingegebenen Daten verloren.",
57 58
"Map":"Karte",
58 59
"No":"Nein",
60
"No delievery orders selected, please set one checkbox!":"Kein Lieferschein selektiert, bitte eine Box anklicken!",
59 61
"No delivery orders have been selected.":"Es wurden keine Lieferscheine ausgewählt.",
60 62
"No entries have been selected.":"Es wurden keine Einträge ausgewählt.",
61 63
"No invoices have been selected.":"Es wurden keine Rechnungen ausgewählt.",
locale/de/all
723 723
  'Created by'                  => 'Erstellt von',
724 724
  'Created for'                 => 'Erstellt f&uuml;r',
725 725
  'Created on'                  => 'Erstellt am',
726
  'Creating Documents'          => 'Erzeuge Dokumente',
726 727
  'Creating invoices'           => 'Erzeuge Rechnungen',
727 728
  'Creating the PDF failed:'    => 'PDF-Erzeugung fehlgeschlagen:',
728 729
  'Creation Date'               => 'Erstelldatum',
......
995 996
  'Document Project (description)' => 'Projektnummer des Belegs (Beschreibung)',
996 997
  'Document Project (number)'   => 'Projektnummer des Belegs',
997 998
  'Document Project Number'     => 'Projektnummer des Belegs',
999
  'Document generating failed. Please check Templates an LateX !' => 'Das Dokument konnte nicht erzeugt werden. Bitte Vorlagen und LateX prüfen!',
998 1000
  'Documentation'               => 'Dokumentation',
999 1001
  'Documentation (in German)'   => 'Dokumentation',
1000 1002
  'Documents in the WebDAV repository' => 'Dokumente im WebDAV-Repository',
......
1002 1004
  'Done.'                       => 'Fertig.',
1003 1005
  'Double partnumbers'          => 'Doppelte Artikelnummern',
1004 1006
  'Download PDF'                => 'PDF herunterladen',
1005
  'Download PDF, do not print'  => 'PDF herunterladen, nicht drucken',
1007
  'Download PDF, do not print'  => 'Nicht drucken, sondern PDF herunterladen',
1006 1008
  'Download SEPA XML export file' => 'SEPA-XML-Exportdatei herunterladen',
1007 1009
  'Download picture'            => 'Bild herunterladen',
1008 1010
  'Download sample file'        => 'Beispieldatei herunterladen',
......
1383 1385
  'General ledger corrections'  => 'Korrekturen im Hauptbuch',
1384 1386
  'General ledger transaction \'#1\' posted' => 'Dialogbuchung \'#1\' verbucht.',
1385 1387
  'General settings'            => 'Allgemeine Einstellungen',
1388
  'Generate and print sales delivery orders' => 'Erzeuge und drucke Lieferscheine',
1386 1389
  'Generic Tax Report'          => 'USTVA Bericht',
1387 1390
  'Germany'                     => 'Deutschland',
1388 1391
  'Git revision: #1, #2 #3'     => 'Git-Revision: #1, #2 #3',
......
1830 1833
  'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
1831 1834
  'No data was found.'          => 'Es wurden keine Daten gefunden.',
1832 1835
  'No default currency'         => 'Keine Standardwährung',
1836
  'No delievery orders selected, please set one checkbox!' => 'Kein Lieferschein selektiert, bitte eine Box anklicken!',
1833 1837
  'No delivery orders have been selected.' => 'Es wurden keine Lieferscheine ausgewählt.',
1834 1838
  'No delivery term has been created yet.' => 'Es wurden noch keine Lieferbedingungen angelegt',
1835 1839
  'No department has been created yet.' => 'Es wurde noch keine Abteilung erfasst.',
......
1840 1844
  'No entries have been selected.' => 'Es wurden keine Einträge ausgewählt.',
1841 1845
  'No errors have occurred.'    => 'Es sind keine Fehler aufgetreten.',
1842 1846
  'No file has been uploaded yet.' => 'Es wurde noch keine Datei hochgeladen.',
1847
  'No file selected, please set one checkbox!' => 'Kein Element selektiert,bitte eine Box anklicken',
1848
  'No file uploaded yet'        => 'Keine Datei hochgeladen',
1849
  'No filename exists!'         => 'Kein Dateiname angegeben',
1843 1850
  'No function blocks have been created yet.' => 'Es wurden noch keine Funktionsblöcke angelegt.',
1844 1851
  'No groups have been created yet.' => 'Es wurden noch keine Gruppen angelegt.',
1845 1852
  'No internal phone extensions have been configured yet.' => 'Es wurden noch keine internen Durchwahlen konfiguriert.',
......
1871 1878
  'No sections have been created yet.' => 'Es wurden noch keine Abschnitte angelegt.',
1872 1879
  'No shipto selected to delete' => 'Keine Lieferadresse zum Löschen ausgewählt',
1873 1880
  'No start date given, setting to #1' => 'Kein Startdatum gegeben, setze Startdatum auf #1',
1881
  'No such job #1 in the database.' => 'Hintergrund-Job #1 existiert nicht mehr.',
1874 1882
  'No summary account'          => 'Kein Sammelkonto',
1875 1883
  'No text blocks have been created for this position.' => 'Für diese Position wurden noch keine Textblöcke angelegt.',
1876 1884
  'No text has been entered yet.' => 'Es wurde noch kein Text eingegeben.',
......
1919 1927
  'Number of bins'              => 'Anzahl Lagerpl&auml;tze',
1920 1928
  'Number of columns of custom variables in form details (second row)' => 'Anzahl der Spalten für benutzerdef. Variablen in den Formulardetails (zweite Positionszeile)',
1921 1929
  'Number of copies'            => 'Anzahl Kopien',
1930
  'Number of deliveryorders created:' => 'Anzahl erzeugter Lieferscheine:',
1931
  'Number of deliveryorders printed:' => 'Anzahl gedruckter Lieferscheine:',
1922 1932
  'Number of entries changed: #1' => 'Anzahl geänderter Einträge: #1',
1923 1933
  'Number of invoices'          => 'Anzahl Rechnungen',
1924 1934
  'Number of invoices created:' => 'Anzahl erstellter Rechnungen:',
......
2184 2194
  'Print'                       => 'Drucken',
2185 2195
  'Print and Post'              => 'Drucken und Buchen',
2186 2196
  'Print automatically'         => 'Automatisch ausdrucken',
2187
  'Print destination'           => 'Druckausgabe',
2197
  'Print both sided'            => 'Beidseitig ausdrucken',
2198
  'Print delivery orders'       => 'Drucke Lieferscheine',
2199
  'Print destination'           => 'Druckort',
2188 2200
  'Print destination (copy)'    => 'Druckausgabe (Kopie)',
2189 2201
  'Print dunnings'              => 'Mahnungen drucken',
2190 2202
  'Print list'                  => 'Liste ausdrucken',
2191 2203
  'Print options'               => 'Druckoptionen',
2204
  'Print selected'              => 'Drucken',
2205
  'Print selected delivery orders both sided' => 'Ausgewählte Lieferscheine (ggf beidseitig)',
2192 2206
  'Print template base file name' => 'Druckvorlagen-Basisdateiname',
2193 2207
  'Print templates'             => 'Druckvorlagen',
2194 2208
  'Print templates to use'      => 'Zu verwendende Druckvorlagen',
......
2199 2213
  'Printer Management'          => 'Druckeradministration',
2200 2214
  'Printer management'          => 'Druckerverwaltung',
2201 2215
  'Printing ... '               => 'Es wird gedruckt.',
2216
  'Printing Documents'          => 'Drucke Dokumente',
2202 2217
  'Printing invoices (this can take a while)' => 'Drucke Rechnungen (kann eine Weile dauern)',
2203 2218
  'Prior year'                  => 'Vorheriges Jahr',
2204 2219
  'Priority'                    => 'Priorität',
......
2576 2591
  'Ship via'                    => 'Transportmittel',
2577 2592
  'Shipping Address'            => 'Lieferadresse',
2578 2593
  'Shipping Point'              => 'Versandort',
2594
  'Shipping address (name)'     => '',
2579 2595
  'Shipping date'               => 'Lieferdatum',
2580 2596
  'Shipto'                      => 'Lieferanschriften',
2581 2597
  'Shipto deleted.'             => 'Lieferadresse gelöscht',
......
3156 3172
  'There are Bins defined in your Inventory.' => 'Unter Stammdaten/Waren sind Lagerplätze definiert.',
3157 3173
  'There are Bins defined in your master data.' => 'Unter Stammdaten/Waren sind Lagerplätze defininert',
3158 3174
  'There are bookings to the account 3803 after 01.01.2007. If you didn\'t change this account manually to 19% the bookings are probably incorrect.' => 'Das Konto 3803 wurde nach dem 01.01.2007 bebucht. Falls Sie dieses Konto nicht manuell auf 19% gestellt haben sind die Buchungen wahrscheinlich mit falscher Umsatzsteuer gebucht worden.',
3175
  'There are currently no delivery orders, or none matches your filter conditions.' => 'kein Lieferschein vorhanden',
3159 3176
  'There are currently no open invoices, or none matches your filter conditions.' => 'Es gibt momentan keine offenen Rechnungen, oder keine erfüllt die Filterkriterien.',
3160 3177
  'There are currently no open sales delivery orders.' => 'Es gibt zur Zeit keine offenen Verkaufslieferscheine.',
3161 3178
  'There are double partnumbers in your database.' => 'In ihrer Datenbank befinden sich mehrfach vergebene Artikelnummern.',
......
3491 3508
  'Warning'                     => 'Warnung',
3492 3509
  'Warning! Loading a draft will discard unsaved data!' => 'Achtung! Beim Laden eines Entwurfs werden ungespeicherte Daten verworfen!',
3493 3510
  'Warnings and errors'         => 'Warnungen und Fehler',
3511
  'Watch status'                => 'Hintergrund-Job Status',
3494 3512
  'WebDAV'                      => 'WebDAV',
3495 3513
  'WebDAV link'                 => 'WebDAV-Link',
3496 3514
  'WebDAV save documents'       => 'Belege in WebDAV-Ablage speichern',
......
3767 3785
  'running'                     => 'läuft',
3768 3786
  'sales tax identification number' => 'USt-IdNr.',
3769 3787
  'sales_delivery_order_list'   => 'lieferscheinliste_verkauf',
3788
  'sales_delivery_order_printer' => '',
3770 3789
  'sales_invoice_printer'       => 'Rechnungsdrucker',
3771 3790
  'sales_order'                 => 'Kundenauftrag',
3772 3791
  'sales_order_list'            => 'auftragsliste',
scripts/installation_check.pl
202 202
EOL
203 203
  }
204 204
}
205
sub check_pdfinfo {
206
  my $line = "Looking for pdfinfo executable";
207
  my $shell_out = `pdfinfo -v 2>&1 | grep version 2> /dev/null`;
208
  my ($label,$vers,$ver_string)  = split / /,$shell_out;
209
  if ( $label && $label eq 'pdfinfo' ) {
210
    print_line($line, $ver_string, 'green');
211
  } else {
212
    print_line($line, 'not installed','red');
213
    my %modinfo = ( name => 'pdfinfo' );
214
    push @missing_modules, \%modinfo;
215

  
216
  }
217
}
205 218

  
206 219
sub check_pdfinfo {
207 220
  my $line = "Looking for pdfinfo executable";
templates/webpages/do/orders_bottom.html
1 1
[%- USE T8 %]
2 2
[% USE HTML %]
3
 [% 'New invoice' | $T8 %]<br>
3
<table  width="100%">
4
   <tr><td width = "200px" >
5
 [% 'New invoice' | $T8 %]</td><td width = "150px">
4 6
 <input class="submit" type="submit" name="action" value="[% 'Continue' | $T8 %]">
5 7
 <input type="hidden" name="nextsub" value="invoice_multi">
6 8
 <input type="hidden" name="type" value="[% HTML.escape(type) %]">
7 9
 <input type="hidden" name="vc" value="[% HTML.escape(vc) %]">
8 10
 <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
9 11
 <input type="hidden" name="rowcount" value="[% HTML.escape(rowcount) %]">
10
</form>
12
</td><td></td></tr></table></form>
13
<form method="post" id="print_multi_id">
14
[% print_options %]
15
<div id="mass_print_dialog" style="display: none"></div>
16
<table  width="100%">
17
  <tr><td width="300px" align="right">[% 'Print selected delivery orders both sided' | $T8 %]</td>
18
      <td><input type="checkbox" name="bothsided" value="1">
19
<input type="hidden" name="type" value="[% HTML.escape(type) %]">
20
<input type="hidden" name="rowcount" value="[% HTML.escape(rowcount) %]">
21
<input class="submit" type="button" name="action" id="print_multi_button" value="[% 'Print selected' | $T8 %]">
22
</td><td></td></tr></table></form>
templates/webpages/do/orders_top.html
1
<form method="post" action="do.pl">
1
[%- INCLUDE 'common/flash.html' %]
2
<form method="post" id="do_id" action="do.pl">
templates/webpages/mass_delivery_order_print/_filter.html
1
[%- USE L %][%- USE LxERP %][%- USE HTML %]
2
<div>
3
 <form action="controller.pl" method="post">
4
  <div class="filter_toggle" [% IF nowshow==0 %]style="display:none"[% END %]>
5
   <a href="#" onClick="javascript:$('.filter_toggle').toggle()">[% LxERP.t8('Show Filter') %]</a>
6
   [% IF SELF.filter_summary %]([% LxERP.t8("Current filter") %]: [% SELF.filter_summary %])[% END %]
7
  </div>
8

  
9
  <div class="filter_toggle" [% IF nowshow==1 %]style="display:none"[% END %]>
10
   <a href="#" onClick="javascript:$('.filter_toggle').toggle()">[% LxERP.t8('Hide Filter') %]</a>
11
   <table id="filter_table">
12
    <tr>
13
     <th align="right">[% LxERP.t8('Customer') %]</th>
14
     <td>[% L.input_tag('filter.customer.name:substr::ilike', filter.customer.name_substr__ilike, size = 20) %]</td>
15
    </tr>
16
    <tr>
17
     <th align="right">[% LxERP.t8('Shipping address (name)') %]</th>
18
     <td>[% L.input_tag('filter.shipto.shiptoname:substr::ilike', filter.shipto.shiptoname_substr__ilike, size = 20) %]</td>
19
    </tr>
20
    <tr>
21
     <th align="right">[% LxERP.t8('Delivery Date') %] [% LxERP.t8('From Date') %]</th>
22
     <td>[% L.date_tag('filter.reqdate:date::ge', filter.reqdate_date__ge) %]</td>
23
    </tr>
24
    <tr>
25
     <th align="right">[% LxERP.t8('Delivery Date') %] [% LxERP.t8('To Date') %]</th>
26
     <td>[% L.date_tag('filter.reqdate:date::le', filter.reqdate_date__le) %]</td>
27
    </tr>
28
   </table>
29

  
30
   [% L.hidden_tag('action', 'ODMassPrint/dispatch') %]
31
   [% L.hidden_tag('sort_by', FORM.sort_by) %]
32
   [% L.hidden_tag('sort_dir', FORM.sort_dir) %]
33
   [% L.hidden_tag('page', FORM.page) %]
34
   [% L.submit_tag(LIST_ACTION, LxERP.t8('Continue'))%]
35

  
36
   <a href="#" onClick="javascript:$('#filter_table input,#filter_table select').val('');">[% LxERP.t8('Reset') %]</a>
37

  
38
  </div>
39

  
40
 </form>
41
</div>
templates/webpages/mass_delivery_order_print/_print_status.html
1
[%- USE LxERP -%][%- USE L -%][%- USE HTML -%]
2
[% SET data = job.data_as_hash %]
3
<h2>[% LxERP.t8("Watch status") %]</h2>
4

  
5
[% L.hidden_tag('', job.id, id="mdo_job_id") %]
6

  
7
<p>
8
 [% LxERP.t8("This status output will be refreshed every five seconds.") %]
9
</p>
10

  
11
<p>
12
 [% IF data.status < 2 %]
13
  [% L.link("login.pl?action=company_logo", LxERP.t8("Open new tab"), target="_blank") %]
14

  
15
 [% ELSE %]
16
 [% IF data.pdf_file_name %]
17
   [% L.link(SELF.url_for(action="mass_mdo_download", job_id=job.id), LxERP.t8("Download PDF")) %]
18
 [% END %]
19
 [% L.link("#", LxERP.t8("Close window"), onclick="kivi.MassDeliveryOrderPrint.massConversionFinishProcess();") %]
20
[% END %]
21
</p>
22

  
23
<p>
24
 <table>
25
  <tr>
26
   <th valign="top" align="left">[% LxERP.t8("Current status:") %]</th>
27
   <td valign="top">
28
    [% IF !data.status %]
29
     [% LxERP.t8("waiting for job to be started") %]
30
    [% ELSIF data.status == 1 %]
31
     [% LxERP.t8("Creating Documents") %]
32
    [% ELSIF data.status == 2 %]
33
     [% LxERP.t8("Printing Documents") %]
34
    [% ELSE %]
35
     [% LxERP.t8("Done.") %]
36
     [% IF data.pdf_file_name %]
37
      [% LxERP.t8("The file is available for download.") %]
38
     [% ELSIF data.printer_id %]
39
      [% LxERP.t8("The file has been sent to the printer.") %]
40
     [% END %]
41
    [% END %]
42
   </td>
43
  </tr>
44

  
45
  <tr>
46
   <th valign="top" align="left">[% LxERP.t8("Number of deliveryorders created:") %]</th>
47
   <td valign="top">[% IF data.status > 0 %][% HTML.escape(data.num_created) %] / [% HTML.escape(data.record_ids.size) %][% ELSE %]–[% END %]</td>
48
  </tr>
49

  
50
  <tr>
51
   <th valign="top" align="left">[% LxERP.t8("Number of deliveryorders printed:") %]</th>
52
   <td valign="top">[% IF data.status > 1 %][% HTML.escape(data.num_printed) %] / [% HTML.escape(data.record_ids.size) %][% ELSE %]–[% END %]</td>
53
  </tr>
54

  
55
  <tr>
56
   <th valign="top" align="left">[% LxERP.t8("Errors during conversion:") %]</th>
57
   <td valign="top">
58
[% IF !data.status %]
59
60
[% ELSIF !data.conversion_errors.size %]
61
 [% LxERP.t8("No errors have occurred.") %]
62
[% ELSE %]
63
    <table>
64
     <tr class="listheader">
65
      <th>[% LxERP.t8("Delivery Order") %]</th>
66
      <th>[% LxERP.t8("Error") %]</th>
67
     </tr>
68

  
69
 [% FOREACH error = data.conversion_errors %]
70
     <tr>
71
      <td valign="top">[% IF error.id %][% L.link(SELF.url_for(controller='do.pl', action='edit', type='sales_delivery_order', id=error.id), HTML.escape(error.number), target="_blank") %][% ELSE %]–[% END %]</td>
72
      <td valign="top">[% HTML.escape(error.message) %]</td>
73
     </tr>
74
 [% END %]
75
    </table>
76
[% END %]
77
   </td>
78
  </tr>
79

  
80
  <tr>
81
   <th valign="top" align="left">[% LxERP.t8("Errors during printing:") %]</th>
82
   <td valign="top">
83
[% IF data.status < 2 %]
84
85
[% ELSIF !data.print_errors.size %]
86
 [% LxERP.t8("No errors have occurred.") %]
87
[% ELSE %]
88
    <table>
89
     <tr class="listheader">
90
      <th>[% LxERP.t8("Invoice") %]</th>
91
      <th>[% LxERP.t8("Error") %]</th>
92
     </tr>
93

  
94
 [% FOREACH error = data.print_errors %]
95
     <tr>
96
      <td valign="top">[% IF error.id %][% L.link(SELF.url_for(controller='is.pl', action='edit', type='sales_invoice',id=error.id), HTML.escape(error.number), target="_blank") %][% ELSE %]–[% END %]</td>
97
      <td valign="top">[% HTML.escape(error.message) %]</td>
98
     </tr>
99
 [% END %]
100
    </table>
101
[% END %]
102
   </td>
103
  </tr>
104

  
105
 </table>
106
</p>
templates/webpages/mass_delivery_order_print/list_delivery_orders.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2

  
3
<h1>[% FORM.title %]</h1>
4

  
5
[%- INCLUDE "common/flash.html" %]
6

  
7
[% LIST_ACTION     = 'action_list_delivery_orders' %]
8
[%- PROCESS 'mass_delivery_order_print/_filter.html' filter=SELF.filter %]
9

  
10
[% IF nowshow==1 %]
11
[% delivery_orders = SELF.delivery_order_models.get;
12
   MODELS          = SELF.delivery_order_models %]
13
[%- IF !delivery_orders.size %]
14
 <p>
15
  [%- LxERP.t8("There are currently no delivery orders, or none matches your filter conditions.") %]
... Dieser Diff wurde abgeschnitten, weil er die maximale Anzahl anzuzeigender Zeilen überschreitet.

Auch abrufbar als: Unified diff