View | Details | Raw Unified | Return to bug 6427
Collapse All | Expand All

(-)a/Koha/Accounts.pm (+557 lines)
Line 0 Link Here
1
package Koha::Accounts;
2
3
# Copyright 2013 ByWater Solutions
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 Carp;
23
use Data::Dumper qw(Dumper);
24
25
use C4::Context;
26
use C4::Log qw(logaction);
27
use Koha::DateUtils qw(get_timestamp);
28
use Koha::Accounts::CreditTypes;
29
use Koha::Accounts::DebitTypes;
30
use Koha::Accounts::OffsetTypes;
31
use Koha::Database;
32
33
use vars qw($VERSION @ISA @EXPORT);
34
35
BEGIN {
36
    require Exporter;
37
    @ISA    = qw(Exporter);
38
    @EXPORT = qw(
39
      AddDebit
40
      AddCredit
41
42
      VoidCredit
43
44
      NormalizeBalances
45
46
      RecalculateAccountBalance
47
48
      DebitLostItem
49
      CreditLostItem
50
    );
51
}
52
53
=head1 NAME
54
55
Koha::Accounts - Functions for dealing with Koha accounts
56
57
=head1 SYNOPSIS
58
59
use Koha::Accounts;
60
61
=head1 DESCRIPTION
62
63
The functions in this module deal with the monetary aspect of Koha,
64
including looking up and modifying the amount of money owed by a
65
patron.
66
67
=head1 FUNCTIONS
68
69
=head2 AddDebit
70
71
my $debit = AddDebit({
72
    borrower       => $borrower,
73
    amount         => $amount,
74
    [ type         => $type,        ]
75
    [ itemnumber   => $itemnumber,  ]
76
    [ issue_id     => $issue_id,    ]
77
    [ description  => $description, ]
78
    [ notes        => $notes,       ]
79
    [ branchcode   => $branchcode,  ]
80
    [ manager_id   => $manager_id,  ]
81
    [ accruing     => $accruing,    ] # Default 0 if not accruing, 1 if accruing
82
});
83
84
Create a new debit for a given borrower. To standardize nomenclature, any charge
85
against a borrower ( e.g. a fine, a new card charge, the cost of losing an item )
86
will be referred to as a 'debit'.
87
88
=cut
89
90
sub AddDebit {
91
    my ($params) = @_;
92
93
    my $borrower    = $params->{borrower};
94
    my $amount      = $params->{amount};
95
    my $type        = $params->{type};
96
    my $itemnumber  = $params->{itemnumber};
97
    my $issue_id    = $params->{issue_id};
98
    my $description = $params->{description};
99
    my $notes       = $params->{notes};
100
    my $branchcode  = $params->{branchcode};
101
    my $manager_id  = $params->{manager_id};
102
103
    my $userenv = C4::Context->userenv;
104
105
    $branchcode ||=
106
        $userenv
107
      ? $userenv->{branch}
108
      : undef;
109
110
    $manager_id ||=
111
        $userenv
112
      ? $userenv->{number}
113
      : undef;
114
115
    my $accruing = $params->{accruing} || 0;
116
117
    croak("Required parameter 'borrower' not passed in.")
118
      unless ($borrower);
119
    croak("Required parameter 'amount' not passed in.")
120
      unless ($amount);
121
    croak("Invalid debit type: '$type'!")
122
      unless ( Koha::Accounts::DebitTypes::IsValid($type) );
123
    croak("No issue id passed in for accruing debit!")
124
      if ( $accruing && !$issue_id );
125
126
    my $debit =
127
      Koha::Database->new()->schema->resultset('AccountDebit')->create(
128
        {
129
            borrowernumber        => $borrower->borrowernumber(),
130
            itemnumber            => $itemnumber,
131
            issue_id              => $issue_id,
132
            type                  => $type,
133
            accruing              => $accruing,
134
            amount_original       => $amount,
135
            amount_outstanding    => $amount,
136
            amount_last_increment => $amount,
137
            description           => $description,
138
            notes                 => $notes,
139
            branchcode            => $branchcode,
140
            manager_id            => $manager_id,
141
            created_on            => get_timestamp(),
142
        }
143
      );
144
145
    if ($debit) {
146
        NormalizeBalances( { borrower => $borrower } );
147
148
        if ( C4::Context->preference("FinesLog") ) {
149
            logaction( "FINES", "CREATE_FEE", $debit->id,
150
                Dumper( $debit->get_columns() ) );
151
        }
152
    }
153
    else {
154
        carp("Something went wrong! Debit not created!");
155
    }
156
157
    return $debit;
158
}
159
160
=head2 DebitLostItem
161
162
my $debit = DebitLostItem({
163
    borrower       => $borrower,
164
    issue          => $issue,
165
});
166
167
DebitLostItem adds a replacement fee charge for the item
168
of the given issue.
169
170
=cut
171
172
sub DebitLostItem {
173
    my ($params) = @_;
174
175
    my $borrower = $params->{borrower};
176
    my $issue    = $params->{issue};
177
178
    croak("Required param 'borrower' not passed in!") unless ($borrower);
179
    croak("Required param 'issue' not passed in!")    unless ($issue);
180
181
# Don't add lost debit if borrower has already been charged for this lost item before,
182
# for this issue. It seems reasonable that a borrower could lose an item, find and return it,
183
# check it out again, and lose it again, so we should do this based on issue_id, not itemnumber.
184
    unless (
185
        Koha::Database->new()->schema->resultset('AccountDebit')->search(
186
            {
187
                borrowernumber => $borrower->borrowernumber(),
188
                issue_id       => $issue->issue_id(),
189
                type           => Koha::Accounts::DebitTypes::Lost
190
            }
191
        )->count()
192
      )
193
    {
194
        my $item = $issue->item();
195
196
        $params->{accruing}   = 0;
197
        $params->{type}       = Koha::Accounts::DebitTypes::Lost;
198
        $params->{amount}     = $item->replacementprice();
199
        $params->{itemnumber} = $item->itemnumber();
200
        $params->{issue_id}   = $issue->issue_id();
201
        $params->{description} =
202
            "Lost Item "
203
          . $issue->item()->biblio()->title() . " "
204
          . $issue->item()->barcode();
205
206
        #TODO: Shouldn't we have a default replacement price as a syspref?
207
        if ( $params->{amount} ) {
208
            return AddDebit($params);
209
        }
210
        else {
211
            carp("Cannot add lost debit! Item has no replacement price!");
212
        }
213
    }
214
}
215
216
=head2 CreditLostItem
217
218
my $debit = CreditLostItem(
219
    {
220
        borrower => $borrower,
221
        debit    => $debit,
222
    }
223
);
224
225
CreditLostItem creates a payment in the amount equal
226
to the replacement price charge created by DebitLostItem.
227
228
=cut
229
230
sub CreditLostItem {
231
    my ($params) = @_;
232
233
    my $borrower = $params->{borrower};
234
    my $debit    = $params->{debit};
235
236
    croak("Required param 'borrower' not passed in!") unless ($borrower);
237
    croak("Required param 'debit' not passed in!")
238
      unless ($debit);
239
240
    my $item =
241
      Koha::Database->new()->schema->resultset('Item')
242
      ->find( $debit->itemnumber() );
243
    carp("No item found!") unless $item;
244
245
    $params->{type}     = Koha::Accounts::CreditTypes::Found;
246
    $params->{amount}   = $debit->amount_original();
247
    $params->{debit_id} = $debit->debit_id();
248
    $params->{notes}    = "Lost item found: " . $item->barcode();
249
250
    return AddCredit($params);
251
}
252
253
=head2 AddCredit
254
255
AddCredit({
256
    borrower       => $borrower,
257
    amount         => $amount,
258
    [ branchcode   => $branchcode, ]
259
    [ manager_id   => $manager_id, ]
260
    [ debit_id     => $debit_id, ] # The primary debit to be paid
261
    [ notes        => $notes, ]
262
});
263
264
Record credit by a patron. C<$borrowernumber> is the patron's
265
borrower number. C<$credit> is a floating-point number, giving the
266
amount that was paid.
267
268
Amounts owed are paid off oldest first. That is, if the patron has a
269
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a credit
270
of $1.50, then the oldest fine will be paid off in full, and $0.50
271
will be credited to the next one.
272
273
debit_id can be passed as a scalar or an array ref to make the passed
274
in debit or debits the first to be credited.
275
276
=cut
277
278
sub AddCredit {
279
    my ($params) = @_;
280
281
    my $type            = $params->{type};
282
    my $borrower        = $params->{borrower};
283
    my $amount          = $params->{amount};
284
    my $amount_received = $params->{amount_received};
285
    my $debit_id        = $params->{debit_id};
286
    my $notes           = $params->{notes};
287
    my $branchcode      = $params->{branchcode};
288
    my $manager_id      = $params->{manager_id};
289
290
    my $userenv = C4::Context->userenv;
291
292
    $branchcode ||=
293
        $userenv
294
      ? $userenv->{branch}
295
      : undef;
296
297
    $manager_id ||=
298
        $userenv
299
      ? $userenv->{number}
300
      : undef;
301
302
    unless ($borrower) {
303
        croak("Required parameter 'borrower' not passed in");
304
    }
305
    unless ($amount) {
306
        croak("Required parameter amount not passed in");
307
    }
308
309
    unless ($type && Koha::Accounts::CreditTypes::IsValid($type) ) {
310
        carp("Invalid type $type passed in, assuming Payment");
311
        $type = Koha::Accounts::CreditTypes::Payment;
312
    }
313
314
    # First, we make the credit. We'll worry about what we paid later on
315
    my $credit =
316
      Koha::Database->new()->schema->resultset('AccountCredit')->create(
317
        {
318
            borrowernumber   => $borrower->borrowernumber(),
319
            type             => $type,
320
            amount_received  => $amount_received,
321
            amount_paid      => $amount,
322
            amount_remaining => $amount,
323
            notes            => $notes,
324
            branchcode       => $branchcode,
325
            manager_id       => $manager_id,
326
            created_on       => get_timestamp(),
327
        }
328
      );
329
330
    if ( C4::Context->preference("FinesLog") ) {
331
        logaction( "FINES", "CREATE_PAYMENT", $credit->id,
332
            Dumper( $credit->get_columns() ) );
333
    }
334
335
    # If we are given specific debits, pay those ones first.
336
    if ($debit_id) {
337
        my @debit_ids = ref($debit_id) eq "ARRAY" ? @$debit_id : $debit_id;
338
        foreach my $debit_id (@debit_ids) {
339
            my $debit =
340
              Koha::Database->new()->schema->resultset('AccountDebit')
341
              ->find($debit_id);
342
343
            if ($debit) {
344
                CreditDebit( { credit => $credit, debit => $debit } );
345
            }
346
            else {
347
                carp("Invalid debit_id passed in!");
348
            }
349
        }
350
    }
351
352
    NormalizeBalances( { borrower => $borrower } );
353
354
    return $credit;
355
}
356
357
=head2 CreditDebit
358
359
$account_offset = CreditDebit({
360
    credit => $credit,
361
    debit => $debit,
362
});
363
364
Given a credit and a debit, this subroutine
365
will pay the appropriate amount of the debit,
366
update the debit's amount outstanding, the credit's
367
amout remaining, and create the appropriate account
368
offset.
369
370
=cut
371
372
sub CreditDebit {
373
    my ($params) = @_;
374
375
    my $credit = $params->{credit};
376
    my $debit  = $params->{debit};
377
378
    croak("Required parameter 'credit' not passed in!")
379
      unless $credit;
380
    croak("Required parameter 'debit' not passed in!")
381
      unless $debit;
382
383
    my $amount_to_pay =
384
      ( $debit->amount_outstanding() > $credit->amount_remaining() )
385
      ? $credit->amount_remaining()
386
      : $debit->amount_outstanding();
387
388
    if ( $amount_to_pay > 0 ) {
389
        $debit->amount_outstanding(
390
            $debit->amount_outstanding() - $amount_to_pay );
391
        $debit->updated_on( get_timestamp() );
392
        $debit->update();
393
394
        $credit->amount_remaining(
395
            $credit->amount_remaining() - $amount_to_pay );
396
        $credit->updated_on( get_timestamp() );
397
        $credit->update();
398
399
        my $offset =
400
          Koha::Database->new()->schema->resultset('AccountOffset')->create(
401
            {
402
                amount     => $amount_to_pay * -1,
403
                debit_id   => $debit->id(),
404
                credit_id  => $credit->id(),
405
                created_on => get_timestamp(),
406
            }
407
          );
408
409
        if ( C4::Context->preference("FinesLog") ) {
410
            logaction( "FINES", "MODIFY", $offset->id,
411
                Dumper( $offset->get_columns() ) );
412
        }
413
414
        return $offset;
415
    }
416
}
417
418
=head2 RecalculateAccountBalance
419
420
$account_balance = RecalculateAccountBalance({
421
    borrower => $borrower
422
});
423
424
Recalculates a borrower's balance based on the
425
sum of the amount outstanding for the borrower's
426
debits minus the sum of the amount remaining for
427
the borrowers credits.
428
429
TODO: Would it be better to use af.amount_original - ap.amount_paid for any reason?
430
      Or, perhaps calculate both and compare the two, for error checking purposes.
431
=cut
432
433
sub RecalculateAccountBalance {
434
    my ($params) = @_;
435
436
    my $borrower = $params->{borrower};
437
    croak("Requred parameter 'borrower' not passed in!")
438
      unless ($borrower);
439
440
    my $debits =
441
      Koha::Database->new()->schema->resultset('AccountDebit')
442
      ->search( { borrowernumber => $borrower->borrowernumber() } );
443
    my $amount_outstanding = $debits->get_column('amount_outstanding')->sum()
444
      || 0;
445
446
    my $credits =
447
      Koha::Database->new()->schema->resultset('AccountCredit')
448
      ->search( { borrowernumber => $borrower->borrowernumber() } );
449
    my $amount_remaining = $credits->get_column('amount_remaining')->sum() || 0;
450
451
    my $account_balance = $amount_outstanding - $amount_remaining;
452
    $borrower->account_balance($account_balance);
453
    $borrower->update();
454
455
    return $account_balance;
456
}
457
458
=head2 VoidCredit
459
    $account_balance = VoidCredit({ id => $credit_id });
460
461
    Reverts a payment. All debits paid by this payment will be
462
    updated such that the amount offset is reinstated for the debit.
463
=cut
464
465
sub VoidCredit {
466
    my ($params) = @_;
467
468
    my $id = $params->{id};
469
470
    croak("No id passed in!") unless $id;
471
472
    my $schema = Koha::Database->new()->schema();
473
474
    my $credit = $schema->resultset('AccountCredit')->find($id);
475
476
    foreach my $offset ( $credit->account_offsets() ) {
477
        my $debit = $offset->debit();
478
479
        $debit->amount_outstanding(
480
            $debit->amount_outstanding() - $offset->amount() );
481
        $debit->updated_on( get_timestamp() );
482
        $debit->update();
483
484
        Koha::Database->new()->schema->resultset('AccountOffset')->create(
485
            {
486
                amount     => $offset->amount() * -1,
487
                debit_id   => $debit->id(),
488
                credit_id  => $credit->id(),
489
                created_on => get_timestamp(),
490
                type       => Koha::Accounts::OffsetTypes::Void(),
491
            }
492
        );
493
    }
494
495
    $credit->amount_voided( $credit->amount_paid );
496
    $credit->amount_paid(0);
497
    $credit->amount_remaining(0);
498
    $credit->updated_on( get_timestamp() );
499
    $credit->update();
500
501
    return RecalculateAccountBalance( { borrower => $credit->borrower() } );
502
}
503
504
=head2 NormalizeBalances
505
506
    $account_balance = NormalizeBalances({ borrower => $borrower });
507
508
    For a given borrower, this subroutine will find all debits
509
    with an outstanding balance and all credits with an unused
510
    amount remaining and will pay those debits with those credits.
511
512
=cut
513
514
sub NormalizeBalances {
515
    my ($params) = @_;
516
517
    my $borrower = $params->{borrower};
518
519
    croak("Required param 'borrower' not passed in!") unless $borrower;
520
521
    my $schema = Koha::Database->new()->schema();
522
523
    my @credits = $schema->resultset('AccountCredit')->search(
524
        {
525
            borrowernumber   => $borrower->borrowernumber(),
526
            amount_remaining => { '>' => '0' }
527
        }
528
    );
529
530
    my @debits = $schema->resultset('AccountDebit')->search(
531
        {
532
            borrowernumber     => $borrower->borrowernumber(),
533
            amount_outstanding => { '>' => '0' }
534
        }
535
    );
536
537
    foreach my $credit (@credits) {
538
        foreach my $debit (@debits) {
539
            if (   $credit->amount_remaining()
540
                && $debit->amount_outstanding() )
541
            {
542
                CreditDebit( { credit => $credit, debit => $debit } );
543
            }
544
        }
545
    }
546
547
    return RecalculateAccountBalance( { borrower => $borrower } );
548
}
549
550
1;
551
__END__
552
553
=head1 AUTHOR
554
555
Kyle M Hall <kyle@bywatersolutions.com>
556
557
=cut
(-)a/Koha/Accounts/CreditTypes.pm (+125 lines)
Line 0 Link Here
1
package Koha::Accounts::CreditTypes;
2
3
# Copyright 2013 ByWater Solutions
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
=head1 NAME
23
24
Koha::AccountsCreditTypes - Module representing the enumerated data types for account fees
25
26
=head1 SYNOPSIS
27
28
use Koha::Accounts::CreditTypes;
29
30
my $type = Koha::Accounts::CreditTypes::Payment;
31
32
=head1 DESCRIPTION
33
34
The subroutines in this modules act as enumerated data types for the
35
different credit types in Koha ( i.e. payments, writeoffs, etc. )
36
37
=head1 FUNCTIONS
38
39
=head2 IsValid
40
41
This subroutine takes a given string and returns 1 if
42
the string matches one of the data types, and 0 if not.
43
44
FIXME: Perhaps we should use Class::Inspector instead of hard
45
coding the subs? It seems like it would be a major trade off
46
of speed just so we don't update something in two separate places
47
in the same file.
48
49
=cut
50
51
sub IsValid {
52
    my ($string) = @_;
53
54
    my $is_valid =
55
      (      $string eq Koha::Accounts::CreditTypes::Payment()
56
          || $string eq Koha::Accounts::CreditTypes::WriteOff()
57
          || $string eq Koha::Accounts::CreditTypes::Found()
58
          || $string eq Koha::Accounts::CreditTypes::Credit()
59
          || $string eq Koha::Accounts::CreditTypes::Forgiven() );
60
61
    unless ($is_valid) {
62
        $is_valid =
63
          Koha::Database->new()->schema->resultset('AuthorisedValue')
64
          ->count(
65
            { category => 'MANUAL_CREDIT', authorised_value => $string } );
66
    }
67
68
    return $is_valid;
69
}
70
71
=head2 Credit
72
73
=cut
74
75
sub Credit {
76
    return 'CREDIT';
77
}
78
79
=head2 Payment
80
81
=cut
82
83
sub Payment {
84
    return 'PAYMENT';
85
}
86
87
=head2 Writeoff
88
89
=cut
90
91
sub WriteOff {
92
    return 'WRITEOFF';
93
}
94
95
=head2 Writeoff
96
97
=cut
98
99
sub Found {
100
    return 'FOUND';
101
}
102
103
=head2 Forgiven
104
105
=cut
106
107
sub Forgiven {
108
    return 'FORGIVEN';
109
}
110
111
=head2 Fine reduction
112
113
=cut
114
115
sub FineReduction {
116
    return 'FINE_REDUCTION';
117
}
118
119
1;
120
121
=head1 AUTHOR
122
123
Kyle M Hall <kyle@bywatersolutions.com>
124
125
=cut
(-)a/Koha/Accounts/DebitTypes.pm (+160 lines)
Line 0 Link Here
1
package Koha::Accounts::DebitTypes;
2
3
# Copyright 2013 ByWater Solutions
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
=head1 NAME
23
24
Koha::Accounts::DebitTypes - Module representing an enumerated data type for account fees
25
26
=head1 SYNOPSIS
27
28
use Koha::Accounts::DebitTypes;
29
30
my $type = Koha::Accounts::DebitTypes::Fine;
31
32
=head1 DESCRIPTION
33
34
The subroutines in this modules act as an enumerated data type
35
for debit types ( stored in account_debits.type ) in Koha.
36
37
=head1 FUNCTIONS
38
39
=head2 IsValid
40
41
This subroutine takes a given string and returns 1 if
42
the string matches one of the data types, and 0 if not.
43
44
=cut
45
46
sub IsValid {
47
    my ($string) = @_;
48
49
    my $is_valid =
50
      (      $string eq Koha::Accounts::DebitTypes::Fine()
51
          || $string eq Koha::Accounts::DebitTypes::AccountManagementFee()
52
          || $string eq Koha::Accounts::DebitTypes::Sundry()
53
          || $string eq Koha::Accounts::DebitTypes::Lost()
54
          || $string eq Koha::Accounts::DebitTypes::Hold()
55
          || $string eq Koha::Accounts::DebitTypes::Rental()
56
          || $string eq Koha::Accounts::DebitTypes::NewCard() );
57
58
    unless ($is_valid) {
59
        $is_valid =
60
          Koha::Database->new()->schema->resultset('AuthorisedValue')
61
          ->count( { category => 'MANUAL_INV', authorised_value => $string } );
62
    }
63
64
    return $is_valid;
65
}
66
67
=head2 Fine
68
69
This data type represents a standard fine within Koha.
70
71
A fine still accruing no longer needs to be differiated by type
72
from a fine done accuring. Instead, that differentication is made
73
by which table the fine exists in, account_fees_accruing vs account_fees_accrued.
74
75
In addition, fines can be checked for correctness based on the issue_id
76
they have. A fine in account_fees_accruing should always have a matching
77
issue_id in the issues table. A fine done accruing will almost always have
78
a matching issue_id in the old_issues table. However, in the case of an overdue
79
item with fines that has been renewed, and becomes overdue again, you may have
80
a case where a given issue may have a matching fine in account_fees_accruing and
81
one or more matching fines in account_fees_accrued ( one for each for the first
82
checkout and one each for any subsequent renewals )
83
84
=cut
85
86
sub Fine {
87
    return 'FINE';
88
}
89
90
=head2 AccountManagementFee
91
92
This fee type is usually reserved for payments for library cards,
93
in cases where a library must charge a patron for the ability to
94
check out items.
95
96
=cut
97
98
sub AccountManagementFee {
99
    return 'ACCOUNT_MANAGEMENT_FEE';
100
}
101
102
=head2 Sundry
103
104
This fee type is basically a 'misc' type, and should be used
105
when no other fee type is more appropriate.
106
107
=cut
108
109
sub Sundry {
110
    return 'SUNDRY';
111
}
112
113
=head2 Lost
114
115
This fee type is used when a library charges for lost items.
116
117
=cut
118
119
sub Lost {
120
    return 'LOST';
121
}
122
123
=head2 Hold
124
125
This fee type is used when a library charges for holds.
126
127
=cut
128
129
sub Hold {
130
    return 'HOLD';
131
}
132
133
=head2 Rental
134
135
This fee type is used when a library charges a rental fee for the item type.
136
137
=cut
138
139
sub Rental {
140
    return 'RENTAL';
141
}
142
143
=head2 NewCard
144
145
This fee type is used when a library charges for replacement
146
library cards.
147
148
=cut
149
150
sub NewCard {
151
    return 'NEW_CARD';
152
}
153
154
1;
155
156
=head1 AUTHOR
157
158
Kyle M Hall <kyle@bywatersolutions.com>
159
160
=cut
(-)a/Koha/Accounts/OffsetTypes.pm (-1 / +83 lines)
Line 0 Link Here
0
- 
1
package Koha::Accounts::OffsetTypes;
2
3
# Copyright 2013 ByWater Solutions
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
=head1 NAME
23
24
Koha::AccountsOffsetTypes - Module representing the enumerated data types for account fees
25
26
=head1 SYNOPSIS
27
28
use Koha::Accounts::OffsetTypes;
29
30
my $type = Koha::Accounts::OffsetTypes::Dropbox;
31
32
=head1 DESCRIPTION
33
34
The subroutines in this modules act as enumerated data types for the
35
different automatic offset types in Koha ( i.e. forgiveness, dropbox mode, etc )
36
37
These types are used for account offsets that have no corrosponding account credit,
38
e.g. automatic fine increments, dropbox mode, etc.
39
40
=head1 FUNCTIONS
41
42
=cut
43
44
=head2 Dropbox
45
46
Offset type for automatic fine reductions
47
via dropbox mode.
48
49
=cut
50
51
sub Dropbox {
52
    return 'DROPBOX';
53
}
54
55
=head2 Fine
56
57
Indicates this offset was an automatically
58
generated fine increment/decrement.
59
60
=cut
61
62
sub Fine {
63
    return 'FINE';
64
}
65
66
=head2 VOID
67
68
Indicates this offset was an automatically
69
generated in response to a voided credit
70
71
=cut
72
73
sub Void {
74
    return 'VOID';
75
}
76
77
1;
78
79
=head1 AUTHOR
80
81
Kyle M Hall <kyle@bywatersolutions.com>
82
83
=cut

Return to bug 6427