Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7fa2595e

Von Jan Büren vor 7 Monaten hinzugefügt

  • ID 7fa2595e8cbbb4d3ac3309aad47c897c44682c49
  • Vorgänger 203f9e93
  • Nachfolger 43e54a65

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
1314 1314
  'Do you want to overwrite your current title?' => 'Möchten Sie den aktuellen Titel überschreiben?',
1315 1315
  '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?',
1316 1316
  'Do you want to store the existing onhand values into a new warehouse?' => 'Möchten Sie die vorhandenen Mengendaten in ein Lager übertragen?',
1317
  'Doc Storage is not enabled'  => 'DMS Funktion ist nicht aktiviert',
1317 1318
  'Document'                    => 'Dokument',
1318 1319
  'Document Count'              => 'Anz. PDF Belege',
1319 1320
  'Document Project (database ID)' => 'Projektnummer des Belegs (Datenbank-ID)',
......
1334 1335
  'Done.'                       => 'Fertig.',
1335 1336
  'Double partnumbers'          => 'Doppelte Artikelnummern',
1336 1337
  'Download'                    => 'Download',
1338
  'Download Documents for exported bookings' => 'Download hinterlegte PDFs zum aktuellen SEPA-Lauf',
1337 1339
  'Download PDF'                => 'PDF herunterladen',
1338 1340
  'Download PDF, do not print'  => 'Nicht drucken, sondern PDF herunterladen',
1339 1341
  'Download SEPA XML export file' => 'SEPA-XML-Exportdatei herunterladen',
......
3357 3359
  'SCREENED'                    => 'Angezeigt',
3358 3360
  'SEPA'                        => 'SEPA',
3359 3361
  'SEPA Transfer Amount'        => 'Betrag in offenen SEPA Exporten',
3362
  'SEPA XML Docs for Exports '  => 'SEPA-XML-Dokumente Export-Nummer',
3360 3363
  'SEPA XML download'           => 'SEPA-XML-Download',
3361 3364
  'SEPA creditor ID'            => 'SEPA-Kreditoren-Identifikation',
3362 3365
  'SEPA exports'                => 'SEPA-Exporte',
locale/en/all
1313 1313
  'Do you want to overwrite your current title?' => '',
1314 1314
  'Do you want to set the account number "#1" to "#2" and the name "#3" to "#4"?' => '',
1315 1315
  'Do you want to store the existing onhand values into a new warehouse?' => '',
1316
  'Doc Storage is not enabled'  => '',
1316 1317
  'Document'                    => '',
1317 1318
  'Document Count'              => '',
1318 1319
  'Document Project (database ID)' => '',
......
1333 1334
  'Done.'                       => '',
1334 1335
  'Double partnumbers'          => '',
1335 1336
  'Download'                    => '',
1337
  'Download Documents for exported bookings' => '',
1336 1338
  'Download PDF'                => '',
1337 1339
  'Download PDF, do not print'  => '',
1338 1340
  'Download SEPA XML export file' => '',
......
3355 3357
  'SCREENED'                    => '',
3356 3358
  'SEPA'                        => '',
3357 3359
  'SEPA Transfer Amount'        => '',
3360
  'SEPA XML Docs for Exports '  => '',
3358 3361
  'SEPA XML download'           => '',
3359 3362
  'SEPA creditor ID'            => '',
3360 3363
  '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