use List::UtilsBy qw(partition_by);
use List::MoreUtils qw(any);
-use List::MoreUtils qw(any none);
use List::Util qw(max);
use Rose::Object::MakeMethods::Generic
$open_invoice->{skonto_type} = 'without_skonto';
foreach (@{ $sepa_export_items_by_id{ $open_invoice->id } || [] }) {
my $factor = ($_->ar_id == $open_invoice->id ? 1 : -1);
- $open_invoice->{realamount} = $::form->format_sellprice($open_invoice->amount*$factor);
+ $open_invoice->{realamount} = $::form->format_amount(\%::myconfig,$open_invoice->amount*$factor,2);
+
$open_invoice->{skonto_type} = $_->payment_type;
$sepa_exports{$_->sepa_export_id} ||= { count => 0, is_ar => 0, amount => 0, proposed => 0, invoices => [], item => $_ };
$sepa_exports{$_->sepa_export_id}->{count}++;
# score is stored in $bt->{agreement}
foreach my $open_invoice (@all_open_invoices) {
- ($open_invoice->{agreement}, $open_invoice->{rule_matches}) = $bt->get_agreement_with_invoice($open_invoice);
+ ($open_invoice->{agreement}, $open_invoice->{rule_matches}) = $bt->get_agreement_with_invoice($open_invoice,
+ sepa_export_items => $all_open_sepa_export_items,
+ );
$open_invoice->{realamount} = $::form->format_amount(\%::myconfig,
$open_invoice->amount * ($open_invoice->{is_ar} ? 1 : -1), 2);
}
$self->transaction(SL::DB::Manager::BankTransaction->find_by(id => $::form->{bt_id}));
- # This was dead code: We compared vendor.account_name with bank_transaction.iban.
- # This did never match (Kontonummer != IBAN). It's kivis 09/02 (2013) day
- # If refactored/improved, also consider that vendor.iban should be normalized
- # user may like to input strings like: 'AT 3333 3333 2222 1111' -> can be checked strictly
- # at Vendor code because we need the correct data for all sepa exports.
-
my $vendor_of_transaction = SL::DB::Manager::Vendor->find_by(iban => $self->transaction->{remote_account_number});
my $use_vendor_filter = $self->transaction->{remote_account_number} && $vendor_of_transaction;
TEMPLATES_GL => $use_vendor_filter && @{ $templates_ap } ? undef : $templates_gl,
TEMPLATES_AP => $templates_ap,
vendor_name => $use_vendor_filter && @{ $templates_ap } ? $vendor_of_transaction->name : undef,
+ BT_ID => $::form->{bt_id},
);
}
# Rollback Fehler nicht weiterreichen
# die if $error;
+ # aber einen rollback von hand
+ $::lxdebug->message(LXDebug->DEBUG2(),"finish worker with ". ($error ? $error->{result} : '-'));
+ $data{bank_transaction}->db->dbh->rollback if $error && $error->{result} eq 'error';
});
return grep { $_ } ($error, @warnings);
}
sub load_gl_record_template_url {
- my ($self, $template) = @_;
+ my ($self, $template, $bt_id) = @_;
return $self->url_for(
controller => 'gl.pl',
'form_defaults.amount_1' => abs($self->transaction->amount), # always positive
'form_defaults.transdate' => $self->transaction->transdate_as_date,
'form_defaults.callback' => $self->callback,
+ 'form_defaults.bt_id' => $self->transaction->id,
);
}