X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FPartClassification.pm;h=c02c8b36d89cd2acd81d4ff77b330a2b392bc824;hb=0fed2b9ab81651006e63659c67940874cbf199d8;hp=e7abe62c4ec5b45f67fe541faba47b720e9fb2e0;hpb=219d88ab03186a74e5dd474175e49bd74dacf15f;p=kivitendo-erp.git 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;