From 4650c028ef460043fdecf9f137d864403a3e0edf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 7 Sep 2018 10:30:21 +0200 Subject: [PATCH] =?utf8?q?Erg=C3=A4nzend=20zu=20#359=20DB->load=20anstatt?= =?utf8?q?=20croak?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit croak|die liefert keine Meldung an den ajax-Aufrufer zurück. SL::DB::..->load hingegen schon. Entsprechend geändert. --- SL/DB/Helper/Payment.pm | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/SL/DB/Helper/Payment.pm b/SL/DB/Helper/Payment.pm index 17b24f8f6..1b559fef0 100644 --- a/SL/DB/Helper/Payment.pm +++ b/SL/DB/Helper/Payment.pm @@ -629,24 +629,17 @@ sub valid_skonto_amount { sub get_payment_select_options_for_bank_transaction { my ($self, $bt_id, %params) = @_; - my $bt = SL::DB::Manager::BankTransaction->find_by( id => $bt_id ); - croak ("Need bt_id to get a valid bank transaction") unless $bt; - - # user may overpay invoices and if not, this case should better be handled elsewhere - #my $open_amount = $self->open_amount; - #croak ("Need an open invoice") unless $open_amount; + my $bt = SL::DB::BankTransaction->new(id => $bt_id)->load; my @options; - if ($self->skonto_date && $self->within_skonto_period($bt->transdate)) { - push(@options, { payment_type => 'without_skonto', display => t8('without skonto') }); - push(@options, { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt'), selected => 1 }); - } else { - push(@options, { payment_type => 'without_skonto', display => t8('without skonto') , selected => 1 }); - push(@options, { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt')}); - } + if ($self->skonto_date && $self->within_skonto_period($bt->transdate)) { + push(@options, { payment_type => 'without_skonto', display => t8('without skonto') }); + push(@options, { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt'), selected => 1 }); + } else { + push(@options, { payment_type => 'without_skonto', display => t8('without skonto') , selected => 1 }); + push(@options, { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt')}); } - return @options; } -- 2.20.1