-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
package SL::DB::BankAccount;
use strict;
use SL::DB::MetaSetup::BankAccount;
use SL::DB::Manager::BankAccount;
use SL::DB::Helper::ActsAsList;
+use SL::DB::Helper::IBANValidation;
__PACKAGE__->meta->initialize;
# chart_id)
my $chart_id = $self->chart_id;
- my $chart = SL::DB::Chart->new( id => $chart_id );
- if ( $chart->load(speculative => 1) ) {
+ require SL::DB::Chart;
+ my $chart = SL::DB::Manager::Chart->find_by( id => $chart_id );
+ if ( $chart ) {
my $linked_bank = SL::DB::Manager::BankAccount->find_by( chart_id => $chart_id );
if ( $linked_bank ) {
if ( not $self->{id} or ( $self->{id} && $linked_bank->id != $self->{id} )) {
};
push @errors, $::locale->text('The IBAN is missing.') unless $self->{iban};
+ push @errors, $self->validate_ibans;
return @errors;
}
+sub displayable_name {
+ my ($self) = @_;
+
+ return join ' ', grep $_, $self->name, $self->bank, $self->iban;
+}
+
1;