epic-s6ts
[kivitendo-erp.git] / SL / DB / Manager / BankAccount.pm
1 package SL::DB::Manager::BankAccount;
2
3 use strict;
4
5 use SL::DB::Helper::Manager;
6 use base qw(SL::DB::Helper::Manager);
7
8 use SL::DB::Helper::Paginated;
9 use SL::DB::Helper::Sorted;
10
11 sub object_class { 'SL::DB::BankAccount' }
12
13 __PACKAGE__->make_manager_methods;
14
15 sub _sort_spec {
16   return ( default => [ 'sortkey', 1 ],
17            columns => { SIMPLE => 'ALL' } );
18 }
19
20 sub get_default {
21     return $_[0]->get_first(where => [ obsolete => 0 ], sort_by => 'sortkey');
22 }
23
24 1;
25 __END__
26
27 =pod
28
29 =encoding utf8
30
31 =head1 NAME
32
33 SL::DB::Manager::BankAccount - RDBO manager for the C<bank_accounts> table
34
35 =head1 FUNCTIONS
36
37 =over 4
38
39 =item C<get_default>
40
41 Returns an RDBO instance corresponding to the default bank account. The default
42 bank account is defined as the bank account with the highest sort order (usually 1) that
43 is not set to obsolete.
44
45 Example:
46
47   my $default_bank_account_id = SL::DB::Manager::BankAccount->get_default->id;
48
49 =back
50
51 =cut