Bug 33940: Consider NULL as valid
[koha.git] / Koha / Exceptions / Account.pm
1 package Koha::Exceptions::Account;
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18 use Modern::Perl;
19
20 use Koha::Exception;
21
22 use Exception::Class (
23
24     'Koha::Exceptions::Account' => {
25         isa => 'Koha::Exception',
26     },
27     'Koha::Exceptions::Account::IsNotCredit' => {
28         isa         => 'Koha::Exceptions::Account',
29         description => 'Account line is not a credit'
30     },
31     'Koha::Exceptions::Account::IsNotDebit' => {
32         isa         => 'Koha::Exceptions::Account',
33         description => 'Account line is not a credit'
34     },
35     'Koha::Exceptions::Account::NoAvailableCredit' => {
36         isa         => 'Koha::Exceptions::Account',
37         description => 'No outstanding credit'
38     },
39     'Koha::Exceptions::Account::AmountNotPositive' => {
40         isa         => 'Koha::Exceptions::Account',
41         description => 'Amount should be a positive decimal'
42     },
43     'Koha::Exceptions::Account::UnrecognisedType' => {
44         isa         => 'Koha::Exceptions::Account',
45         description => 'Account type was not recognised'
46     },
47     'Koha::Exceptions::Account::RegisterRequired' => {
48         isa         => 'Koha::Exceptions::Account',
49         description => 'Account transaction requires a cash register'
50     },
51     'Koha::Exceptions::Account::PaymentTypeRequired' => {
52         isa         => 'Koha::Exceptions::Account',
53         description => 'Account transaction requires a payment type'
54     },
55     'Koha::Exceptions::Account::InvalidPaymentType' => {
56         isa         => 'Koha::Exceptions::Account',
57         description => 'Invalid payment type'
58     }
59 );
60
61 =head1 NAME
62
63 Koha::Exceptions::Account - Base class for Account exceptions
64
65 =head1 Exceptions
66
67 =head2 Koha::Exceptions::Account
68
69 Generic Account exception
70
71 =head2 Koha::Exceptions::Account::IsNotCredit
72
73 Exception to be used when an action on an account line requires it to be a
74 credit and it isn't.
75
76 =head2 Koha::Exceptions::Account::IsNotDebit
77
78 Exception to be used when an action on an account line requires it to be a
79 debit and it isn't.
80
81 =head2 Koha::Exceptions::Account::NoAvailableCredit
82
83 Exception to be used when a credit has no amount outstanding and is required
84 to be applied to outstanding debits.
85
86 =head2 Koha::Exceptions::Account::AmountNotPositive
87
88 Exception to be used when a passed credit or debit amount is not a positive
89 decimal value.
90
91 =head2 Koha::Exceptions::Account::UnrecognisedType
92
93 Exception to be used when a passed credit or debit is not of a recognised type.
94
95 =cut
96
97 =head2 Koha::Exceptions::Account::RegisterRequired
98
99 Exception to be used when UseCashRegisters is enabled and one is not passed for a transaction.
100
101 =cut
102
103 1;