X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/219d88ab03186a74e5dd474175e49bd74dacf15f..0fdf58910b8cd0b54e3d2213a27dab2ffe149bfe:/SL/DB/PartClassification.pm diff --git a/SL/DB/PartClassification.pm b/SL/DB/PartClassification.pm index e7abe62c4..c02c8b36d 100644 --- a/SL/DB/PartClassification.pm +++ b/SL/DB/PartClassification.pm @@ -7,6 +7,7 @@ use SL::DB::MetaSetup::PartClassification; use SL::DB::Manager::PartClassification; __PACKAGE__->meta->initialize; +__PACKAGE__->before_delete('can_be_deleted'); # check if the description and abbreviation is present # @@ -20,7 +21,12 @@ sub validate { return @errors; } +sub can_be_deleted { + my ($self) = @_; + # The first five part classifications must not be deleted. + return defined($self->id) && ($self->id >= 5); +} 1;