Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a5d4818c

Von Bernd Bleßmann vor etwa 5 Jahren hinzugefügt

  • ID a5d4818cb7437683707f042b99cbecff27ce6799
  • Vorgänger 1d6ab809
  • Nachfolger 9e433123

Massendruck: Kopieren ins Webdav in den Helper verschoben.

Damit erzeugen alle Druckvorgänge hierüber Kopien im Webdav

Unterschiede anzeigen:

SL/BackgroundJob/MassRecordCreationAndPrinting.pm
15 15
use SL::Helper::MassPrintCreatePDF qw(:all);
16 16
use SL::Helper::CreatePDF qw(:all);
17 17
use SL::Helper::File qw(store_pdf append_general_pdf_attachments doc_storage_enabled);
18
use SL::Webdav;
19 18

  
20 19
use constant WAITING_FOR_EXECUTION       => 0;
21 20
use constant CONVERTING_DELIVERY_ORDERS  => 1;
......
104 103
  foreach my $invoice (@{ $self->{invoices} }) {
105 104

  
106 105
    eval {
106
      my @errors = ();
107 107
      my %params = (
108 108
        variables => \%variables,
109 109
        return    => 'file_name',
110 110
        document  => $invoice,
111
        errors    => \@errors,
111 112
      );
112 113
      push @pdf_file_names, $self->create_massprint_pdf(%params);
113

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

  
116
      # OLD WebDAV Code, may be deleted:
117
      # copy file to webdav folder
118
      if ($::instance_conf->get_webdav_documents) {
119
        my $webdav = SL::Webdav->new(
120
          type     => 'invoice',
121
          number   => $invoice->invnumber,
122
        );
123
        my $webdav_file = SL::Webdav::File->new(
124
          webdav   => $webdav,
125
          filename => t8('Invoice') . '_' . $invoice->invnumber . '.pdf',
126
        );
127
        eval {
128
          $webdav_file->store(file => $pdf_file_names[-1]);
129
          1;
130
        } or do {
131
          push @{ $data->{print_errors} }, { id => $invoice->id, number => $invoice->invnumber, message => $@ };
132
        }
116
      if (scalar @errors) {
117
        push @{ $data->{print_errors} }, { id => $invoice->id, number => $invoice->invnumber, message => join(', ', @errors) };
133 118
      }
134 119

  
135 120
      1;
SL/Helper/MassPrintCreatePDF.pm
2 2

  
3 3
use strict;
4 4

  
5
use SL::Webdav;
6

  
5 7
use Exporter 'import';
6 8
our @EXPORT_OK = qw(create_massprint_pdf merge_massprint_pdf create_pdfs print_pdfs);
7 9
our %EXPORT_TAGS = (
......
46 48

  
47 49
  my $pdf_filename = $self->create_pdf(%create_params);
48 50

  
51
  if ($::instance_conf->get_webdav_documents && !$form->{preview}) {
52
    my $webdav = SL::Webdav->new(
53
      type     => $params{document}->type,
54
      number   => $params{document}->record_number,
55
    );
56
    my $webdav_file = SL::Webdav::File->new(
57
      webdav   => $webdav,
58
      filename => $form->{attachment_filename},
59
    );
60
    eval {
61
      $webdav_file->store(file => $pdf_filename);
62
      1;
63
    } or do {
64
      push @{ $params{errors} }, $@ if exists $params{errors};
65
    }
66
  }
67

  
49 68
  if ( $::instance_conf->get_doc_storage && ! $form->{preview}) {
50 69
    $self->append_general_pdf_attachments(filepath => $pdf_filename, type => $form->{type} );
51 70
    $form->{tmpfile} = $pdf_filename;
......
160 179

  
161 180
before printing is done
162 181

  
182
Recognized parameters are (not a complete list):
183

  
184
=over 2
185

  
186
=item * C<errors> – optional. If given, it must be an array ref. This will be
187
filled with potential errors.
188

  
189
=back
190

  
163 191

  
164 192
=head1 AUTHOR
165 193

  

Auch abrufbar als: Unified diff