1 package SL::DB::Vendor;
5 use SL::DB::MetaSetup::Vendor;
6 use SL::DB::Helper::TransNumberGenerator;
7 use SL::DB::Helper::CustomVariables (
14 __PACKAGE__->meta->add_relationship(
16 type => 'one to many',
17 class => 'SL::DB::Shipto',
18 column_map => { id => 'trans_id' },
19 manager_args => { sort_by => 'lower(shipto.shiptoname)' },
20 query_args => [ module => 'CT' ],
23 type => 'one to many',
24 class => 'SL::DB::Contact',
25 column_map => { id => 'cp_cv_id' },
26 manager_args => { sort_by => 'lower(contacts.cp_name)' },
30 class => 'SL::DB::Business',
31 column_map => { business_id => 'id' },
35 __PACKAGE__->meta->make_manager_class;
36 __PACKAGE__->meta->initialize;
38 __PACKAGE__->before_save('_before_save_set_vendornumber');
40 sub _before_save_set_vendornumber {
43 $self->create_trans_number if $self->vendornumber eq '';