Revision 2b82180a
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/DB/Manager/Vendor.pm | ||
---|---|---|
1 |
package SL::DB::Manager::Vendor; |
|
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::Filtered; |
|
9 |
use SL::DB::Helper::Sorted; |
|
10 |
|
|
11 |
sub object_class { 'SL::DB::Vendor' } |
|
12 |
|
|
13 |
__PACKAGE__->make_manager_methods; |
|
14 |
|
|
15 |
__PACKAGE__->add_filter_specs( |
|
16 |
all => sub { |
|
17 |
my ($key, $value, $prefix) = @_; |
|
18 |
return or => [ map { $prefix . $_ => $value } qw(vendornumber name) ] |
|
19 |
} |
|
20 |
); |
|
21 |
|
|
22 |
sub _sort_spec { |
|
23 |
return ( |
|
24 |
default => [ 'name', 1 ], |
|
25 |
columns => { |
|
26 |
SIMPLE => 'ALL', |
|
27 |
map { ( $_ => "lower(vendor.$_)" ) } qw(account_number bank bank_code bcc bic cc city contact country department_1 department_2 depositor email fax greeting homepage iban language |
|
28 |
name notes phone street taxnumber user_password username ustid v_customer_id vendornumber zipcode) |
|
29 |
}); |
|
30 |
} |
|
31 |
1; |
SL/DB/Vendor.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
|
5 | 5 |
use SL::DB::MetaSetup::Vendor; |
6 |
use SL::DB::Manager::Vendor; |
|
6 | 7 |
use SL::DB::Helper::TransNumberGenerator; |
7 | 8 |
use SL::DB::Helper::CustomVariables ( |
8 | 9 |
module => 'CT', |
... | ... | |
27 | 28 |
}, |
28 | 29 |
); |
29 | 30 |
|
30 |
__PACKAGE__->meta->make_manager_class; |
|
31 | 31 |
__PACKAGE__->meta->initialize; |
32 | 32 |
|
33 | 33 |
__PACKAGE__->before_save('_before_save_set_vendornumber'); |
... | ... | |
39 | 39 |
return 1; |
40 | 40 |
} |
41 | 41 |
|
42 |
sub displayable_name { |
|
43 |
my $self = shift; |
|
44 |
|
|
45 |
return join ' ', grep $_, $self->vendornumber, $self->name; |
|
46 |
} |
|
47 |
|
|
42 | 48 |
sub is_customer { 0 }; |
43 | 49 |
sub is_vendor { 1 }; |
44 | 50 |
|
Auch abrufbar als: Unified diff
RDBO: Manager-Klasse für Vendor