epic-ts
[kivitendo-erp.git] / SL / DB / Business.pm
1 package SL::DB::Business;
2
3 use strict;
4
5 use SL::DB::MetaSetup::Business;
6 use SL::DB::Manager::Business;
7
8 __PACKAGE__->meta->initialize;
9
10 sub validate {
11   my ($self) = @_;
12
13   my @errors;
14   push @errors, $::locale->text('The description is missing.')          if !$self->description;
15   push @errors, $::locale->text('The discount must not be negative.')   if $self->discount <  0;
16   push @errors, $::locale->text('The discount must be less than 100%.') if $self->discount >= 1;
17
18   return @errors;
19 }
20
21 sub displayable_name {
22   my $self = shift;
23
24   return join ' ', grep $_, $self->id, $self->description;
25 }
26
27 1;