1 package SL::DB::Business;
 
   5 use SL::DB::MetaSetup::Business;
 
   6 use SL::DB::Manager::Business;
 
   8 __PACKAGE__->meta->add_relationship(
 
  10     type         => 'one to many',
 
  11     class        => 'SL::DB::Customer',
 
  12     column_map   => { id => 'business_id' },
 
  13     query_args   => [ \' id IN ( SELECT id FROM customer ) ' ],
 
  16     type         => 'one to many',
 
  17     class        => 'SL::DB::Vendor',
 
  18     column_map   => { id => 'business_id' },
 
  19     query_args   => [ \' id IN ( SELECT id FROM vendor ) ' ],
 
  23 __PACKAGE__->meta->initialize;
 
  29   push @errors, $::locale->text('The description is missing.')          if !$self->description;
 
  30   push @errors, $::locale->text('The discount must not be negative.')   if $self->discount <  0;
 
  31   push @errors, $::locale->text('The discount must be less than 100%.') if $self->discount >= 1;
 
  36 sub displayable_name {
 
  39   return join ' ', grep $_, $self->id, $self->description;