1 package SL::DB::Vendor;
5 use Rose::DB::Object::Helpers qw(as_tree);
7 use SL::DB::MetaSetup::Vendor;
8 use SL::DB::Manager::Vendor;
9 use SL::DB::Helper::TransNumberGenerator;
10 use SL::DB::Helper::CustomVariables (
17 __PACKAGE__->meta->add_relationship(
19 type => 'one to many',
20 class => 'SL::DB::Shipto',
21 column_map => { id => 'trans_id' },
22 manager_args => { sort_by => 'lower(shipto.shiptoname)' },
23 query_args => [ module => 'CT' ],
26 type => 'one to many',
27 class => 'SL::DB::Contact',
28 column_map => { id => 'cp_cv_id' },
29 manager_args => { sort_by => 'lower(contacts.cp_name)' },
33 __PACKAGE__->meta->initialize;
35 __PACKAGE__->before_save('_before_save_set_vendornumber');
37 sub _before_save_set_vendornumber {
40 $self->create_trans_number if !defined $self->vendornumber || $self->vendornumber eq '';
44 sub displayable_name {
47 return join ' ', grep $_, $self->vendornumber, $self->name;
50 sub is_customer { 0 };
52 sub payment_terms { goto &payment }