Bug 23805: DBRev 19.06.00.044
[koha.git] / Koha / Account / DebitTypes.pm
blobf19bce03827a4b7bbb093c2f1bba860255c867b4
1 package Koha::Account::DebitTypes;
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 under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 use Modern::Perl;
21 use List::Util qw/any/;
23 use Koha::Database;
24 use Koha::Account::DebitType;
26 use base qw(Koha::Objects Koha::Objects::Limit::Library);
28 =head1 NAME
30 Koha::Account::DebitTypes - Koha Account debit 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 'AccountDebitType';
63 =head3 object_class
65 =cut
67 sub object_class {
68 return 'Koha::Account::DebitType';