From: Moritz Bunkus Date: Thu, 2 Feb 2017 09:52:58 +0000 (+0100) Subject: Artikel-Klassifizierung: System-Klassifizierungen (id < 5) nicht löschen können X-Git-Tag: release-3.5.4~1547 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3f59726e58631c7eeb2a7dce7c25827ababdc1be;p=kivitendo-erp.git Artikel-Klassifizierung: System-Klassifizierungen (id < 5) nicht löschen können --- 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;