Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 301fdeba

Von Bernd Bleßmann vor fast 2 Jahren hinzugefügt

  • ID 301fdebada6c024be99e200a593212c8c5ecbaf7
  • Vorgänger df3f88c5
  • Nachfolger 250a15ae

SEPA-Überweisungen sperren könnnen (Einkauf)

Unterschiede anzeigen:

bin/mozilla/ap.pl
626 626
  $::form->redirect($::locale->text("Marked as paid"));
627 627
}
628 628

  
629
sub block_or_unblock_sepa_transfer {
630
  $::auth->assert('ap_transactions');
631

  
632
  my $invoice = SL::DB::PurchaseInvoice->new(id => $::form->{id})->load;
633
  $invoice->update_attributes(is_sepa_blocked => 0) if  $::form->{unblock_sepa} &&  $invoice->is_sepa_blocked;
634
  $invoice->update_attributes(is_sepa_blocked => 1) if !$::form->{unblock_sepa} && !$invoice->is_sepa_blocked;
635

  
636
  $::form->redirect($::form->{unblock_sepa} ? t8('Bank transfer via SEPA is unblocked') : t8('Bank transfer via SEPA is blocked'));
637
}
638

  
629 639
sub show_draft {
630 640
  $::form->{transdate} = DateTime->today_local->to_kivitendo if !$::form->{transdate};
631 641
  $::form->{gldate}    = $::form->{transdate} if !$::form->{gldate};
......
1374 1384
  my $may_edit_create         = $::auth->assert('ap_transactions', 1);
1375 1385

  
1376 1386
  my $has_sepa_exports;
1387
  my $is_sepa_blocked;
1377 1388
  if ($::form->{id}) {
1378 1389
    my $invoice = SL::DB::Manager::PurchaseInvoice->find_by(id => $::form->{id});
1379 1390
    $has_sepa_exports = 1 if ($invoice->find_sepa_export_items()->[0]);
1391
    $is_sepa_blocked  = !!$invoice->is_sepa_blocked;
1380 1392
  }
1381 1393

  
1382 1394
  my $is_linked_bank_transaction;
......
1440 1452
                    : $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.')
1441 1453
                    :                               undef,
1442 1454
        ],
1455
        action => [ $is_sepa_blocked ? t8('Unblock Bank transfer via SEPA') : t8('Block Bank transfer via SEPA'),
1456
          submit   => [ '#form', { action => "block_or_unblock_sepa_transfer", unblock_sepa => !!$is_sepa_blocked } ],
1457
          disabled => !$may_edit_create ? t8('You must not change this AP transaction.')
1458
                    : !$::form->{id}    ? t8('This invoice has not been posted yet.')
1459
                    :                     undef,
1460
        ],
1443 1461
        action => [ t8('Mark as paid'),
1444 1462
          submit   => [ '#form', { action => "mark_as_paid" } ],
1445 1463
          confirm  => t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?'),

Auch abrufbar als: Unified diff