kivitendo/SL/DB/VariantProperty.pm @ f43dbabd
cf42c1c6 | Tamino Steinert | # This file has been auto-generated only because it didn't exist.
|
||
# Feel free to modify it at will; it will not be overwritten automatically.
|
||||
package SL::DB::VariantProperty;
|
||||
use strict;
|
||||
use SL::DB::MetaSetup::VariantProperty;
|
||||
use SL::DB::Manager::VariantProperty;
|
||||
95332f36 | Werner Hahn | use SL::DB::Helper::ActsAsList;
|
||
use SL::DB::Helper::TranslatedAttributes;
|
||||
cf42c1c6 | Tamino Steinert | |||
__PACKAGE__->meta->add_relationships(
|
||||
parent_variants => {
|
||||
map_class => 'SL::DB::VariantPropertyPart',
|
||||
map_from => 'variant_property',
|
||||
map_to => 'part',
|
||||
type => 'many to many',
|
||||
},
|
||||
66c06a13 | Tamino Steinert | property_values => {
|
||
class => 'SL::DB::VariantPropertyValue',
|
||||
column_map => { id => 'variant_property_id' },
|
||||
type => 'one to many',
|
||||
}
|
||||
cf42c1c6 | Tamino Steinert | );
|
||
__PACKAGE__->meta->initialize;
|
||||
9f6a981f | Werner Hahn | sub validate {
|
||
my ($self) = @_;
|
||||
my @errors;
|
||||
# critical checks
|
||||
push @errors, $::locale->text('The name is missing.') unless $self->{name};
|
||||
push @errors, $::locale->text('The unique name is missing.') unless $self->{unique_name};
|
||||
push @errors, $::locale->text('The abbreviation is missing') unless $self->{abbreviation};
|
||||
return @errors;
|
||||
}
|
||||
66c06a13 | Tamino Steinert | sub name_translated {goto &name} # TODO
|
||
93b347a8 | Tamino Steinert | sub displayable_name {
|
||
my ($self) = @_;
|
||||
return $self->name . "(" . $self->abbreviation . ")";
|
||||
}
|
||||
cf42c1c6 | Tamino Steinert | 1;
|