Revision 301fdeba
Von Bernd Bleßmann vor fast 2 Jahren hinzugefügt
bin/mozilla/ir.pl | ||
---|---|---|
250 | 250 |
my $may_edit_create = $::auth->assert('vendor_invoice_edit', 1); |
251 | 251 |
|
252 | 252 |
my $has_sepa_exports; |
253 |
my $is_sepa_blocked; |
|
253 | 254 |
if ($form->{id}) { |
254 | 255 |
my $invoice = SL::DB::Manager::PurchaseInvoice->find_by(id => $form->{id}); |
255 | 256 |
$has_sepa_exports = 1 if ($invoice->find_sepa_export_items()->[0]); |
257 |
$is_sepa_blocked = !!$invoice->is_sepa_blocked; |
|
256 | 258 |
} |
257 | 259 |
|
258 | 260 |
my $is_linked_bank_transaction; |
... | ... | |
311 | 313 |
: $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.') |
312 | 314 |
: undef, |
313 | 315 |
], |
316 |
action => [ $is_sepa_blocked ? t8('Unblock Bank transfer via SEPA') : t8('Block Bank transfer via SEPA'), |
|
317 |
submit => [ '#form', { action => "block_or_unblock_sepa_transfer", unblock_sepa => !!$is_sepa_blocked } ], |
|
318 |
disabled => !$may_edit_create ? t8('You must not change this AP transaction.') |
|
319 |
: !$::form->{id} ? t8('This invoice has not been posted yet.') |
|
320 |
: undef, |
|
321 |
], |
|
314 | 322 |
action => [ |
315 | 323 |
t8('Mark as paid'), |
316 | 324 |
submit => [ '#form', { action => "mark_as_paid" } ], |
... | ... | |
607 | 615 |
$::form->redirect($::locale->text("Marked as paid")); |
608 | 616 |
} |
609 | 617 |
|
618 |
sub block_or_unblock_sepa_transfer { |
|
619 |
$::auth->assert('ap_transactions'); |
|
620 |
|
|
621 |
my $invoice = SL::DB::PurchaseInvoice->new(id => $::form->{id})->load; |
|
622 |
$invoice->update_attributes(is_sepa_blocked => 0) if $::form->{unblock_sepa} && $invoice->is_sepa_blocked; |
|
623 |
$invoice->update_attributes(is_sepa_blocked => 1) if !$::form->{unblock_sepa} && !$invoice->is_sepa_blocked; |
|
624 |
|
|
625 |
$::form->redirect($::form->{unblock_sepa} ? t8('Bank transfer via SEPA is unblocked') : t8('Bank transfer via SEPA is blocked')); |
|
626 |
} |
|
627 |
|
|
610 | 628 |
sub show_draft { |
611 | 629 |
update(); |
612 | 630 |
} |
Auch abrufbar als: Unified diff
SEPA-Überweisungen sperren könnnen (Einkauf)