Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 301fdeba

Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt

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

SEPA-Überweisungen sperren könnnen (Einkauf)

Unterschiede anzeigen:

SL/SEPA.pm
my $mandate = $params{vc} eq 'customer' ? " AND COALESCE(vc.mandator_id, '') <> '' AND vc.mandate_date_of_signature IS NOT NULL " : '';
my $is_sepa_blocked = $params{vc} eq 'customer' ? 'FALSE' : "${arap}.is_sepa_blocked";
# open_amount is not the current open amount according to bookkeeping, but
# the open amount minus the SEPA transfer amounts that haven't been closed yet
my $query =
......
(${arap}.amount - (${arap}.amount * pt.percent_skonto)) as amount_less_skonto,
(${arap}.amount * pt.percent_skonto) as skonto_amount,
vc.name AS vcname, vc.language_id, ${arap}.duedate as duedate, ${arap}.direct_debit,
${is_sepa_blocked} AS is_sepa_blocked,
vc.${vc_vc_id} as vc_vc_id,
COALESCE(vc.iban, '') <> '' AND COALESCE(vc.bic, '') <> '' ${mandate} AS vc_bank_info_ok,
bin/mozilla/ap.pl
$::form->redirect($::locale->text("Marked as paid"));
}
sub block_or_unblock_sepa_transfer {
$::auth->assert('ap_transactions');
my $invoice = SL::DB::PurchaseInvoice->new(id => $::form->{id})->load;
$invoice->update_attributes(is_sepa_blocked => 0) if $::form->{unblock_sepa} && $invoice->is_sepa_blocked;
$invoice->update_attributes(is_sepa_blocked => 1) if !$::form->{unblock_sepa} && !$invoice->is_sepa_blocked;
$::form->redirect($::form->{unblock_sepa} ? t8('Bank transfer via SEPA is unblocked') : t8('Bank transfer via SEPA is blocked'));
}
sub show_draft {
$::form->{transdate} = DateTime->today_local->to_kivitendo if !$::form->{transdate};
$::form->{gldate} = $::form->{transdate} if !$::form->{gldate};
......
my $may_edit_create = $::auth->assert('ap_transactions', 1);
my $has_sepa_exports;
my $is_sepa_blocked;
if ($::form->{id}) {
my $invoice = SL::DB::Manager::PurchaseInvoice->find_by(id => $::form->{id});
$has_sepa_exports = 1 if ($invoice->find_sepa_export_items()->[0]);
$is_sepa_blocked = !!$invoice->is_sepa_blocked;
}
my $is_linked_bank_transaction;
......
: $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.')
: undef,
],
action => [ $is_sepa_blocked ? t8('Unblock Bank transfer via SEPA') : t8('Block Bank transfer via SEPA'),
submit => [ '#form', { action => "block_or_unblock_sepa_transfer", unblock_sepa => !!$is_sepa_blocked } ],
disabled => !$may_edit_create ? t8('You must not change this AP transaction.')
: !$::form->{id} ? t8('This invoice has not been posted yet.')
: undef,
],
action => [ t8('Mark as paid'),
submit => [ '#form', { action => "mark_as_paid" } ],
confirm => t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?'),
bin/mozilla/ir.pl
my $may_edit_create = $::auth->assert('vendor_invoice_edit', 1);
my $has_sepa_exports;
my $is_sepa_blocked;
if ($form->{id}) {
my $invoice = SL::DB::Manager::PurchaseInvoice->find_by(id => $form->{id});
$has_sepa_exports = 1 if ($invoice->find_sepa_export_items()->[0]);
$is_sepa_blocked = !!$invoice->is_sepa_blocked;
}
my $is_linked_bank_transaction;
......
: $is_linked_bank_transaction ? t8('This transaction is linked with a bank transaction. Please undo and redo the bank transaction booking if needed.')
: undef,
],
action => [ $is_sepa_blocked ? t8('Unblock Bank transfer via SEPA') : t8('Block Bank transfer via SEPA'),
submit => [ '#form', { action => "block_or_unblock_sepa_transfer", unblock_sepa => !!$is_sepa_blocked } ],
disabled => !$may_edit_create ? t8('You must not change this AP transaction.')
: !$::form->{id} ? t8('This invoice has not been posted yet.')
: undef,
],
action => [
t8('Mark as paid'),
submit => [ '#form', { action => "mark_as_paid" } ],
......
$::form->redirect($::locale->text("Marked as paid"));
}
sub block_or_unblock_sepa_transfer {
$::auth->assert('ap_transactions');
my $invoice = SL::DB::PurchaseInvoice->new(id => $::form->{id})->load;
$invoice->update_attributes(is_sepa_blocked => 0) if $::form->{unblock_sepa} && $invoice->is_sepa_blocked;
$invoice->update_attributes(is_sepa_blocked => 1) if !$::form->{unblock_sepa} && !$invoice->is_sepa_blocked;
$::form->redirect($::form->{unblock_sepa} ? t8('Bank transfer via SEPA is unblocked') : t8('Bank transfer via SEPA is blocked'));
}
sub show_draft {
update();
}
bin/mozilla/sepa.pl
my %invoices_map = map { $_->{id} => $_ } @{ $invoices };
my @bank_transfers =
map +{ %{ $invoices_map{ $_->{$arap_id} } }, %{ $_ } },
grep { ($_->{selected} || $selected_ids{$_->{$arap_id}}) && (0 < $_->{amount}) && $invoices_map{ $_->{$arap_id} } }
grep { ($_->{selected} || $selected_ids{$_->{$arap_id}}) && (0 < $_->{amount}) && $invoices_map{ $_->{$arap_id} } && !($invoices_map{ $_->{$arap_id} }->{is_sepa_blocked}) }
map { $_->{amount} = $form->parse_amount($myconfig, $_->{amount}); $_ }
@{ $form->{bank_transfers} || [] };
templates/webpages/sepa/bank_transfer_add.html
<tr class="listrow[% IF !invoice.vc_bank_info_ok && invoice.checked %]_error[% END %]">
<td align="center">
[%- IF invoice.vc_bank_info_ok %]
[%- IF invoice.vc_bank_info_ok && !invoice.is_sepa_blocked %]
[% L.checkbox_tag("ids[]", value=invoice.id, checked=invoice.checked) %]
[%- END %]
</td>
......
<td>
<a href="[% IF invoice.invoice %][% iris %][% ELSE %][% arap %][% END %].pl?action=edit&id=[% HTML.escape(invoice.id) %]">
[% HTML.escape(invoice.invnumber) %]
[%- GET HTML.escape(invoice.invnumber);
IF invoice.is_sepa_blocked;
GET ' <sup>(*)</sup>';
SET show_is_sepa_blocked_footnote = '1';
END;
-%]
</a>
</td>
......
</p>
[%- END %]
<input type="hidden" name="vc" value="[%- HTML.escape(vc) %]">
[%- IF show_is_sepa_blocked_footnote %]
<p>
<sup>(*)</sup>
[%- 'For this invoice the bank tranfer via SEPA was blocked manually.' | $T8 %]
</p>
[%- END %]
<input type="hidden" name="vc" value="[%- HTML.escape(vc) %]">
</form>
<script type="text/javascript">

Auch abrufbar als: Unified diff