- push @{ $form->{DUNNING_PDFS} }, $filename;
- push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'path' => "${spool}/$filename",
- 'name' => $attachment_filename };
-
- # save dunning fee pdf in filemanagement/webdav for each dunned invoice
- if ($::instance_conf->get_doc_storage || $::instance_conf->get_webdav_documents) {
- $query = qq|SELECT trans_id, invnumber FROM dunning LEFT JOIN ar ON (ar.id = trans_id) WHERE dunning_id = ?|;
- my $dunned_invoices = selectall_hashref_query($form, $dbh, $query, $dunning_id);
-
- foreach my $dunned_invoice (@$dunned_invoices) {
- if ($::instance_conf->get_doc_storage) {
- SL::File->save(
- object_id => $dunned_invoice->{trans_id},
- object_type => 'dunning',
- mime_type => 'application/pdf',
- source => 'created',
- file_type => 'document',
- file_name => $attachment_filename,
- file_path => "${spool}/$filename",
- );
- }
-
- if ($::instance_conf->get_webdav_documents) {
- my $webdav = SL::Webdav->new(
- type => 'invoice',
- number => $dunned_invoice->{invnumber},
- );
- my $webdav_file = SL::Webdav::File->new(
- webdav => $webdav,
- filename => $attachment_filename,
- );
- $webdav_file->store(file => "${spool}/$filename");
- }
- }
- }
+ push @{ $form->{DUNNING_PDFS} }, $filename;
+ push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'path' => "${spool}/$filename",
+ 'name' => $attachment_filename };
+ push @{ $form->{DUNNING_PDFS_STORAGE} }, { 'dunning_id' => $dunning_id,
+ 'path' => "${spool}/$filename",
+ 'name' => $attachment_filename };