Bug 14048: Add RefundLostItemFeeRule table and classes
[koha.git] / Koha / RefundLostItemFeeRule.pm
1 package Koha::RefundLostItemFeeRule;
2
3 # Copyright Theke Solutions 2016
4 #
5 # This file is part of Koha.
6 #
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.
11 #
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.
15 #
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.
19
20 use Modern::Perl;
21
22 use Koha::Database;
23 use Koha::Exceptions;
24
25 use base qw(Koha::Object);
26
27 =head1 NAME
28
29 Koha::RefundLostItemFeeRule - Koha RefundLostItemFeeRule object class
30
31 =head1 API
32
33 =head2 Class Methods
34
35 =cut
36
37 =head3 type
38
39 =cut
40
41 sub _type {
42     return 'RefundLostItemFeeRule';
43 }
44
45 =head3 delete
46
47 This is an overloaded delete method. It throws an exception if the wildcard
48 branch is passed (it can only be modified, but not deleted).
49
50 =cut
51
52 sub delete {
53     my ($self) = @_;
54
55     if ( $self->branchcode eq '*' ) {
56         Koha::Exceptions::CannotDeleteDefault->throw;
57     }
58
59     return $self->SUPER::delete($self);
60 }
61
62
63 1;