Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3af87f25

Von Jan Büren vor 10 Monaten hinzugefügt

  • ID 3af87f256297235186b56f0f587dcd252b34c25f
  • Vorgänger ee75882d
  • Nachfolger aebd17e5

DATEV mit Belegdokumenten, es geht erstmal nur PDF und ein Beleglink pro Buchung

Unterschiede anzeigen:

SL/DATEV.pm
452 452
    my $filename_for_zip = (exists $self->{files}{$file_version->file_name})
453 453
                           ? $file_version->file_name . '__' . $guid
454 454
                           : $file_version->file_name;
455
    $filename_for_zip = $guid . '.pdf';
455 456
    $self->{files}{$filename_for_zip} = $file_version->get_system_location;
456 457
    # create xml metadata for files
457 458
    my $document_node = $doc->createElement('document');
......
473 474
  $zip->addString($doc->toString(), 'document.xml');
474 475
  # add real files
475 476
  foreach my $filename (keys %{ $self->{files} }) {
476
    my $enc_filename = encode('Windows-1252', $filename);
477
    $zip->addFile($self->{files}{$filename}, $enc_filename);
477
#    my $enc_filename = encode('Windows-1252', $filename);
478
    $zip->addFile($self->{files}{$filename}, $filename);
478 479
  }
479 480
  die "Cannot write Belege-XML.zip" unless ($zip->writeToFileNamed($self->export_path . 'Belege-XML.zip')
480 481
                                            == Archive::Zip::AZ_OK());
......
990 991
    if (   $self->documents && ($transaction->[$haben]->{table} eq 'gl'
991 992
        || ($datev_data{konto} !~ m/(1810|1370)/ && $datev_data{gegenkonto} !~ m/(1810|1370)/ )) ) {
992 993
      # add all document links for the latest created/uploaded document
993
      my $latest_documents = SL::DB::Manager::File->get_all(query =>
994
      my $latest_document = SL::DB::Manager::File->get_first(query =>
994 995
                                [
995 996
                                  object_id   => $transaction->[$haben]->{trans_id},
996 997
                                  file_type   => 'document',
998
                                  mime_type   => 'application/pdf',
997 999
                                  or          => [
998 1000
                                                   object_type => 'gl_transaction',
999 1001
                                                   object_type => 'purchase_invoice',
......
1002 1004
                                                 ],
1003 1005
                                ],
1004 1006
                                  sort_by   => 'itime DESC');
1005
      #if (ref $latest_document eq 'SL::DB::File') {
1006
      if (scalar @{ $latest_documents }) {
1007
      if (ref $latest_document eq 'SL::DB::File') {
1008
      #if (scalar @{ $latest_documents }) {
1007 1009
        # if we have a booking document add guid from the latest version
1008 1010
        # one record may be referenced to more transaction (credit booking with different accounts)
1009 1011
        # therefore collect guids in hash
1010
        foreach my $latest_document (@{ $latest_documents }) {
1012
        # not yet implemented -> datev steigt aus, sobald ein komma getrennter wert erscheint
1013
        #foreach my $latest_document (@{ $latest_documents }) {
1011 1014
          die "No file datatype:" . ref $latest_document unless (ref $latest_document eq 'SL::DB::File');
1012 1015
          my $latest_guid = $latest_document->file_version->[-1]->guid;
1013 1016

  
1014 1017
          $self->{guids}{$latest_guid} = 1;
1015 1018
          $datev_data{document_guid}  .= $datev_data{document_guid} ?  ',' : '';
1016 1019
          $datev_data{document_guid}  .= $latest_guid;
1017
        }
1020
        # }
1018 1021
      }
1019 1022
    }
1020 1023
    # keine kommerzbank daten exportieren

Auch abrufbar als: Unified diff