From 3f59726e58631c7eeb2a7dce7c25827ababdc1be Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 2 Feb 2017 10:52:58 +0100 Subject: [PATCH] =?utf8?q?Artikel-Klassifizierung:=20System-Klassifizierun?= =?utf8?q?gen=20(id=20<=205)=20nicht=20l=C3=B6schen=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/PartClassification.pm | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.20.1