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 __PACKAGE__->meta->make_manager_class;
31 __PACKAGE__->meta->initialize;
33 __PACKAGE__->before_save('_before_save_set_vendornumber');
35 sub _before_save_set_vendornumber {
38 $self->create_trans_number if $self->vendornumber eq '';