projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
464bf57
)
Artikel-Klassifizierung: System-Klassifizierungen (id < 5) nicht löschen können
author
Moritz Bunkus
<m.bunkus@linet-services.de>
Thu, 2 Feb 2017 09:52:58 +0000
(10:52 +0100)
committer
Moritz Bunkus
<m.bunkus@linet-services.de>
Thu, 2 Feb 2017 09:52:58 +0000
(10:52 +0100)
SL/DB/PartClassification.pm
patch
|
blob
|
history
diff --git
a/SL/DB/PartClassification.pm
b/SL/DB/PartClassification.pm
index
e7abe62
..
c02c8b3
100644
(file)
--- 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;