Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 34101eee

Von Tamino Steinert vor 26 Tagen hinzugefügt

  • ID 34101eee892bca40a6d7bb55a94cba277d502e25
  • Vorgänger 9cfa51dc
  • Nachfolger da42fc52

S:D:EmailJournal: entferne toten Code

ZUGFeRD-Automatik wurde in SL::Helper::EmailProcessing verschoben

Unterschiede anzeigen:

SL/DB/EmailJournal.pm
57 57
  return !!scalar @{$self->linked_records};
58 58
}
59 59

  
60
sub process_attachments_as_purchase_invoices {
61
  my ($self) = @_;
62

  
63
  my $attachments = $self->attachments_sorted;
64
  foreach my $attachment (@$attachments) {
65
    my $ap_invoice = $attachment->create_ap_invoice();
66
    next unless $ap_invoice;
67

  
68
    # link to email journal
69
    $self->link_to_record($ap_invoice);
70

  
71
    # copy file to webdav folder
72
    if ($::instance_conf->get_webdav_documents) {
73
      my $webdav = SL::Webdav->new(
74
        type     => 'accounts_payable',
75
        number   => $ap_invoice->invnumber,
76
      );
77
      my $webdav_file = SL::Webdav::File->new(
78
        webdav => $webdav,
79
        filename => $attachment->name,
80
      );
81
      eval {
82
        $webdav_file->store(data => \$attachment->content);
83
        1;
84
      } or do {
85
        die 'Storing the ZUGFeRD file to the WebDAV folder failed: ' . $@;
86
      };
87
    }
88
    # copy file to doc storage
89
    if ($::instance_conf->get_doc_storage) {
90
      eval {
91
        SL::File->save(
92
          object_id     => $ap_invoice->id,
93
          object_type   => 'purchase_invoice',
94
          mime_type     => 'application/pdf',
95
          source        => 'uploaded',
96
          file_type     => 'document',
97
          file_name     => $attachment->name,
98
          file_contents => $attachment->content,
99
        );
100
        1;
101
      } or do {
102
        die 'Storing the ZUGFeRD file in the storage backend failed: ' . $@;
103
      };
104
    }
105
  }
106

  
107
  my $new_ext_status = join('_', $self->extended_status, 'processed');
108
  $self->update({ extended_status => $new_ext_status});
109
}
110

  
111 60
1;
112 61

  
113 62
__END__

Auch abrufbar als: Unified diff