Revision 4650c028
Von Jan Büren vor etwa 6 Jahren hinzugefügt
SL/DB/Helper/Payment.pm | ||
---|---|---|
629 | 629 |
sub get_payment_select_options_for_bank_transaction { |
630 | 630 |
my ($self, $bt_id, %params) = @_; |
631 | 631 |
|
632 |
my $bt = SL::DB::Manager::BankTransaction->find_by( id => $bt_id ); |
|
633 |
croak ("Need bt_id to get a valid bank transaction") unless $bt; |
|
634 |
|
|
635 |
# user may overpay invoices and if not, this case should better be handled elsewhere |
|
636 |
#my $open_amount = $self->open_amount; |
|
637 |
#croak ("Need an open invoice") unless $open_amount; |
|
632 |
my $bt = SL::DB::BankTransaction->new(id => $bt_id)->load; |
|
638 | 633 |
|
639 | 634 |
my @options; |
640 | 635 |
|
641 |
if ($self->skonto_date && $self->within_skonto_period($bt->transdate)) { |
|
642 |
push(@options, { payment_type => 'without_skonto', display => t8('without skonto') }); |
|
643 |
push(@options, { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt'), selected => 1 }); |
|
644 |
} else { |
|
645 |
push(@options, { payment_type => 'without_skonto', display => t8('without skonto') , selected => 1 }); |
|
646 |
push(@options, { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt')}); |
|
647 |
} |
|
636 |
if ($self->skonto_date && $self->within_skonto_period($bt->transdate)) { |
|
637 |
push(@options, { payment_type => 'without_skonto', display => t8('without skonto') }); |
|
638 |
push(@options, { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt'), selected => 1 }); |
|
639 |
} else { |
|
640 |
push(@options, { payment_type => 'without_skonto', display => t8('without skonto') , selected => 1 }); |
|
641 |
push(@options, { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt')}); |
|
648 | 642 |
} |
649 |
|
|
650 | 643 |
return @options; |
651 | 644 |
} |
652 | 645 |
|
Auch abrufbar als: Unified diff
Ergänzend zu #359 DB->load anstatt croak
croak|die liefert keine Meldung an den ajax-Aufrufer zurück.
SL::DB::..->load hingegen schon. Entsprechend geändert.