Bug 19889: (follow-up) Fix few minor things
[koha.git] / Koha / Account / CreditTypes.pm
blob2b058ded3734fe73971450e8a6118ab39beb07d0
1 package Koha::Account::CreditTypes;
3 # Copyright PTFS Europe 2019
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Modern::Perl;
21 use List::Util qw/any/;
23 use Koha::Database;
24 use Koha::Account::CreditType;
26 use base qw(Koha::Objects Koha::Objects::Limit::Library);
28 =head1 NAME
30 Koha::Account::CreditTypes - Koha Account credit types Object set class
32 =head1 API
34 =head2 Class Methods
36 =head3 delete
38 Overridden delete method to prevent system default deletions
40 =cut
42 sub delete {
43 my ($self) = @_;
45 my @set = $self->as_list;
46 for my $type (@set) {
47 if ( $type->is_system ) {
48 Koha::Exceptions::CannotDeleteDefault->throw;
52 return $self->SUPER::delete;
55 =head3 type
57 =cut
59 sub _type {
60 return 'AccountCreditType';
63 =head3 object_class
65 =cut
67 sub object_class {
68 return 'Koha::Account::CreditType';