Revision 50f1c0c8
Von Moritz Bunkus vor fast 5 Jahren hinzugefügt
SL/BackgroundJob/CreatePeriodicInvoices.pm | ||
---|---|---|
9 | 9 |
use English qw(-no_match_vars); |
10 | 10 |
use List::MoreUtils qw(uniq); |
11 | 11 |
|
12 |
use SL::Common; |
|
12 | 13 |
use SL::DB::AuthUser; |
13 | 14 |
use SL::DB::Default; |
14 | 15 |
use SL::DB::Order; |
... | ... | |
18 | 19 |
use SL::Helper::CreatePDF qw(create_pdf find_template); |
19 | 20 |
use SL::Mailer; |
20 | 21 |
use SL::Util qw(trim); |
22 |
use SL::System::Process; |
|
21 | 23 |
|
22 | 24 |
sub create_job { |
23 | 25 |
$_[0]->create_standard_job('0 3 1 * *'); # first day of month at 3:00 am |
... | ... | |
329 | 331 |
$mail->send; |
330 | 332 |
} |
331 | 333 |
|
334 |
sub _store_pdf_in_webdav { |
|
335 |
my ($self, $pdf_file_name, $invoice) = @_; |
|
336 |
|
|
337 |
return unless $::instance_conf->get_webdav_documents; |
|
338 |
|
|
339 |
my $form = Form->new(''); |
|
340 |
|
|
341 |
$form->{cwd} = SL::System::Process->exe_dir; |
|
342 |
$form->{tmpdir} = ($pdf_file_name =~ m{(.+)/})[0]; |
|
343 |
$form->{tmpfile} = ($pdf_file_name =~ m{.+/(.+)})[0]; |
|
344 |
$form->{format} = 'pdf'; |
|
345 |
$form->{formname} = 'invoice'; |
|
346 |
$form->{type} = 'invoice'; |
|
347 |
$form->{vc} = 'customer'; |
|
348 |
$form->{invnumber} = $invoice->invnumber; |
|
349 |
$form->{recipient_locale} = $invoice->language ? $invoice->language->template_code : ''; |
|
350 |
|
|
351 |
Common::copy_file_to_webdav_folder($form); |
|
352 |
} |
|
353 |
|
|
332 | 354 |
sub _print_invoice { |
333 | 355 |
my ($self, $data) = @_; |
334 | 356 |
|
... | ... | |
403 | 425 |
eval { |
404 | 426 |
$pdf_file_name = $self->create_pdf(%create_params); |
405 | 427 |
|
428 |
$self->_store_pdf_in_webdav($pdf_file_name, $data->{invoice}); |
|
429 |
|
|
406 | 430 |
for (qw(email_subject email_body)) { |
407 | 431 |
_replace_vars( |
408 | 432 |
object => $data->{config}, |
Auch abrufbar als: Unified diff
Wiederkehrende Rechnungen: ge-e-mailte Rechnungen im WebDAV speichern