Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7ad2ba0b

Von Jan Büren vor 10 Monaten hinzugefügt

  • ID 7ad2ba0b1c49816fba657156e9cde75289f1fcf1
  • Vorgänger f337e7b6
  • Nachfolger 4c53999f

Beim SEPA-Lauf für Überweisungen auch eine Liste der hinterlegten PDFs anbieten

Unterschiede anzeigen:

bin/mozilla/sepa.pl
606 606

  
607 607
  $main::lxdebug->leave_sub();
608 608
}
609
sub bank_transfer_download_sepa_docs {
610
  $main::lxdebug->enter_sub();
611

  
612
  my $form     =  $main::form;
613
  my $defaults = SL::DB::Default->get;
614
  my $locale   =  $main::locale;
615
  my $vc       = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
616

  
617
  if (!$defaults->doc_storage) {
618
    $form->show_generic_error($locale->text('Doc Storage is not enabled'));
619
  }
620

  
621
  my @ids;
622
  if ($form->{mode} && ($form->{mode} eq 'multi')) {
623
     @ids = @{ $form->{ids} || [] };
624
  } else {
625
    @ids = ($form->{id});
626
  }
627

  
628
  if (!@ids) {
629
    $form->show_generic_error($locale->text('You have not selected any export.'));
630
  }
631

  
632
  my @items = ();
633

  
634
  foreach my $id (@ids) {
635
    my $export = SL::SEPA->retrieve_export('id' => $id, 'details' => 1, vc => $vc);
636
    push @items, @{ $export->{items} } if ($export);
637
  }
638
  my @files;
639
  foreach my $item (@items) {
640

  
641
    # check if there is already a file for the invoice
642
    # File::get_all and converting to scalar is a tiny bit stupid, see Form.pm,
643
    # but there is no get_latest_version (but sorts objects by itime!)
644
    # check if already resynced
645
    my ( $file_object ) = SL::File->get_all(object_id   => $item->{ap_id} ? $item->{ap_id} : $item->{ar_id},
646
                                            object_type => $item->{ap_id} ? 'purchase_invoice' : 'invoice',
647
                                            file_type   => 'document',
648
                                           );
649
    next if     (ref $file_object ne 'SL::File::Object');
650
    next unless $file_object->mime_type eq 'application/pdf';
651

  
652
    my $file = $file_object->get_file;
653
    die "No file" unless -e $file;
654
    push @files, $file;
655
  }
656
  my $inputfiles  = join " ", @files;
657
  my $downloadname = $locale->text('SEPA XML Docs for Exports ') . (join " ", @ids) . ".pdf";
658
  my $in = IO::File->new($::lx_office_conf{applications}->{ghostscript} . " -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=- $inputfiles |");
659

  
660
  $form->error($main::locale->text('Could not spawn ghostscript.')) unless $in;
661

  
662
  print $::form->create_http_response(content_type        => 'Application/PDF',
663
                                      content_disposition => 'attachment; filename="'. $downloadname . '"');
664

  
665
  $::locale->with_raw_io(\*STDOUT, sub { print while <$in> });
666
  $in->close;
667

  
668
  $main::lxdebug->leave_sub();
669
}
670

  
609 671

  
610 672
sub bank_transfer_mark_as_closed {
611 673
  $main::lxdebug->enter_sub();
......
643 705
  foreach my $action (qw(bank_transfer_create bank_transfer_edit bank_transfer_list
644 706
                         bank_transfer_post_payments bank_transfer_download_sepa_xml
645 707
                         bank_transfer_mark_as_closed_step1 bank_transfer_mark_as_closed_step2
646
                         bank_transfer_payment_list_as_pdf bank_transfer_undo_sepa_xml)) {
708
                         bank_transfer_payment_list_as_pdf bank_transfer_undo_sepa_xml
709
                         bank_transfer_download_sepa_docs)) {
647 710
    if ($form->{"action_${action}"}) {
648 711
      call_sub($action);
649 712
      return;
locale/de/all
1309 1309
  'Do you want to overwrite your current title?' => 'Möchten Sie den aktuellen Titel überschreiben?',
1310 1310
  'Do you want to set the account number "#1" to "#2" and the name "#3" to "#4"?' => 'Soll die Kontonummer "#1" zu "#2" und den Name "#3" zu "#4" geändert werden?',
1311 1311
  'Do you want to store the existing onhand values into a new warehouse?' => 'Möchten Sie die vorhandenen Mengendaten in ein Lager übertragen?',
1312
  'Doc Storage is not enabled'  => 'DMS Funktion ist nicht aktiviert',
1312 1313
  'Document'                    => 'Dokument',
1313 1314
  'Document Count'              => 'Anz. PDF Belege',
1314 1315
  'Document Project (database ID)' => 'Projektnummer des Belegs (Datenbank-ID)',
......
1329 1330
  'Done.'                       => 'Fertig.',
1330 1331
  'Double partnumbers'          => 'Doppelte Artikelnummern',
1331 1332
  'Download'                    => 'Download',
1333
  'Download Documents for exported bookings' => 'Download hinterlegte PDFs zum aktuellen SEPA-Lauf',
1332 1334
  'Download PDF'                => 'PDF herunterladen',
1333 1335
  'Download PDF, do not print'  => 'Nicht drucken, sondern PDF herunterladen',
1334 1336
  'Download SEPA XML export file' => 'SEPA-XML-Exportdatei herunterladen',
......
3341 3343
  'SCREENED'                    => 'Angezeigt',
3342 3344
  'SEPA'                        => 'SEPA',
3343 3345
  'SEPA Transfer Amount'        => 'Betrag in offenen SEPA Exporten',
3346
  'SEPA XML Docs for Exports '  => 'SEPA-XML-Dokumente Export-Nummer',
3344 3347
  'SEPA XML download'           => 'SEPA-XML-Download',
3345 3348
  'SEPA creditor ID'            => 'SEPA-Kreditoren-Identifikation',
3346 3349
  'SEPA exports'                => 'SEPA-Exporte',
locale/en/all
1308 1308
  'Do you want to overwrite your current title?' => '',
1309 1309
  'Do you want to set the account number "#1" to "#2" and the name "#3" to "#4"?' => '',
1310 1310
  'Do you want to store the existing onhand values into a new warehouse?' => '',
1311
  'Doc Storage is not enabled'  => '',
1311 1312
  'Document'                    => '',
1312 1313
  'Document Count'              => '',
1313 1314
  'Document Project (database ID)' => '',
......
1328 1329
  'Done.'                       => '',
1329 1330
  'Double partnumbers'          => '',
1330 1331
  'Download'                    => '',
1332
  'Download Documents for exported bookings' => '',
1331 1333
  'Download PDF'                => '',
1332 1334
  'Download PDF, do not print'  => '',
1333 1335
  'Download SEPA XML export file' => '',
......
3339 3341
  'SCREENED'                    => '',
3340 3342
  'SEPA'                        => '',
3341 3343
  'SEPA Transfer Amount'        => '',
3344
  'SEPA XML Docs for Exports '  => '',
3342 3345
  'SEPA XML download'           => '',
3343 3346
  'SEPA creditor ID'            => '',
3344 3347
  'SEPA exports'                => '',
templates/design40_webpages/sepa/bank_transfer_created.html
6 6
<p>[% 'The SEPA export has been created.' | $T8 %]</p>
7 7
<ul>
8 8
  <li><a href="sepa.pl?action=bank_transfer_download_sepa_xml&id=[% HTML.url(id) %]&vc=[% HTML.url(vc) %]"> [% 'Download SEPA XML export file' | $T8 %] </a></li>
9
  [%- IF INSTANCE_CONF.get_doc_storage %]
10
    <li><a href="sepa.pl?action=bank_transfer_download_sepa_docs&id=[% HTML.url(id) %]&vc=[% HTML.url(vc) %]"> [% 'Download Documents for exported bookings' | $T8 %] </a></li>
11
  [% END %]
9 12
  <li><a href="sepa.pl?action=bank_transfer_list&l_open=1&l_not_executed=1&vc=[% HTML.url(vc) %]"> [% 'List open SEPA exports' | $T8 %] </a></li>
10 13
</ul>
templates/webpages/sepa/bank_transfer_created.html
13 13
     [% 'Download SEPA XML export file' | $T8 %]
14 14
    </a>
15 15
   </li>
16

  
16
  [%- IF INSTANCE_CONF.get_doc_storage %]
17
    <li><a href="sepa.pl?action=bank_transfer_download_sepa_docs&id=[% HTML.url(id) %]&vc=[% HTML.url(vc) %]"> [% 'Download Documents for exported bookings' | $T8 %] </a></li>
18
  [% END %]
17 19
   <li>
18 20
    <a href="sepa.pl?action=bank_transfer_list&l_open=1&l_not_executed=1&vc=[% HTML.url(vc) %]">
19 21
     [% 'List open SEPA exports' | $T8 %]

Auch abrufbar als: Unified diff