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

(-)a/Koha/Accounts.pm (+535 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
29
use Koha::Accounts::CreditTypes;
30
use Koha::Accounts::DebitTypes;
31
32
use vars qw($VERSION @ISA @EXPORT);
33
34
BEGIN {
35
    require Exporter;
36
    @ISA    = qw(Exporter);
37
    @EXPORT = qw(
38
      AddDebit
39
      AddCredit
40
41
      NormalizeBalances
42
43
      RecalculateAccountBalance
44
45
      DebitLostItem
46
      CreditLostItem
47
    );
48
}
49
50
=head1 NAME
51
52
Koha::Accounts - Functions for dealing with Koha accounts
53
54
=head1 SYNOPSIS
55
56
use Koha::Accounts;
57
58
=head1 DESCRIPTION
59
60
The functions in this module deal with the monetary aspect of Koha,
61
including looking up and modifying the amount of money owed by a
62
patron.
63
64
=head1 FUNCTIONS
65
66
=head2 AddDebit
67
68
my $debit = AddDebit({
69
    borrower       => $borrower,
70
    amount         => $amount,
71
    [ type         => $type,        ]
72
    [ itemnumber   => $itemnumber,  ]
73
    [ issue_id     => $issue_id,    ]
74
    [ description  => $description, ]
75
    [ notes        => $notes,       ]
76
    [ branchcode   => $branchcode,  ]
77
    [ manager_id   => $manager_id,  ]
78
    [ accruing     => $accruing,    ] # Default 0 if not accruing, 1 if accruing
79
});
80
81
Create a new debit for a given borrower. To standardize nomenclature, any charge
82
against a borrower ( e.g. a fine, a new card charge, the cost of losing an item )
83
will be referred to as a 'debit'.
84
85
=cut
86
87
sub AddDebit {
88
    my ($params) = @_;
89
90
    my $borrower = $params->{borrower};
91
    my $amount   = $params->{amount};
92
93
    my $type        = $params->{type};
94
    my $itemnumber  = $params->{itemnumber};
95
    my $issue_id    = $params->{issue_id};
96
    my $description = $params->{description};
97
    my $notes       = $params->{notes};
98
99
    my $branchcode = $params->{branchcode};
100
    $branchcode ||=
101
      defined( C4::Context->userenv )
102
      ? C4::Context->userenv->{branch}
103
      : undef;
104
105
    my $manager_id = $params->{manager_id};
106
    $manager_id ||=
107
      defined( C4::Context->userenv )
108
      ? C4::Context->userenv->{manager_id}
109
      : undef;
110
111
    my $accruing = $params->{accruing} || 0;
112
113
    croak("Required parameter 'borrower' not passed in.")
114
      unless ($borrower);
115
    croak("Required parameter 'amount' not passed in.")
116
      unless ($amount);
117
    croak("Invalid debit type: '$type'!")
118
      unless ( Koha::Accounts::DebitTypes::IsValid($type) );
119
    croak("No issue id passed in for accruing debit!")
120
      if ( $accruing && !$issue_id );
121
122
    my $debit =
123
      Koha::Database->new()->schema->resultset('AccountDebit')->create(
124
        {
125
            borrowernumber        => $borrower->borrowernumber(),
126
            itemnumber            => $itemnumber,
127
            issue_id              => $issue_id,
128
            type                  => $type,
129
            accruing              => $accruing,
130
            amount_original       => $amount,
131
            amount_outstanding    => $amount,
132
            amount_last_increment => $amount,
133
            description           => $description,
134
            notes                 => $notes,
135
            manager_id            => $manager_id,
136
            created_on            => get_timestamp(),
137
        }
138
      );
139
140
    if ($debit) {
141
        $borrower->account_balance( $borrower->account_balance() + $amount );
142
        $borrower->update();
143
144
        NormalizeBalances( { borrower => $borrower } );
145
146
        if ( C4::Context->preference("FinesLog") ) {
147
            logaction( "FINES", "CREATE_FEE", $debit->id,
148
                Dumper( $debit->get_columns() ) );
149
        }
150
    }
151
    else {
152
        carp("Something went wrong! Debit not created!");
153
    }
154
155
    return $debit;
156
}
157
158
=head2 DebitLostItem
159
160
my $debit = DebitLostItem({
161
    borrower       => $borrower,
162
    issue          => $issue,
163
});
164
165
DebitLostItem adds a replacement fee charge for the item
166
of the given issue.
167
168
=cut
169
170
sub DebitLostItem {
171
    my ($params) = @_;
172
173
    my $borrower = $params->{borrower};
174
    my $issue    = $params->{issue};
175
176
    croak("Required param 'borrower' not passed in!") unless ($borrower);
177
    croak("Required param 'issue' not passed in!")    unless ($issue);
178
179
# Don't add lost debit if borrower has already been charged for this lost item before,
180
# for this issue. It seems reasonable that a borrower could lose an item, find and return it,
181
# check it out again, and lose it again, so we should do this based on issue_id, not itemnumber.
182
    unless (
183
        Koha::Database->new()->schema->resultset('AccountDebit')->search(
184
            {
185
                borrowernumber => $borrower->borrowernumber(),
186
                issue_id       => $issue->issue_id(),
187
                type           => Koha::Accounts::DebitTypes::Lost
188
            }
189
        )->count()
190
      )
191
    {
192
        my $item = $issue->item();
193
194
        $params->{accruing}   = 0;
195
        $params->{type}       = Koha::Accounts::DebitTypes::Lost;
196
        $params->{amount}     = $item->replacementprice();
197
        $params->{itemnumber} = $item->itemnumber();
198
        $params->{issue_id}   = $issue->issue_id();
199
200
        #TODO: Shouldn't we have a default replacement price as a syspref?
201
        if ( $params->{amount} ) {
202
            return AddDebit($params);
203
        }
204
        else {
205
            carp("Cannot add lost debit! Item has no replacement price!");
206
        }
207
    }
208
}
209
210
=head2 CreditLostItem
211
212
my $debit = CreditLostItem(
213
    {
214
        borrower => $borrower,
215
        debit    => $debit,
216
    }
217
);
218
219
CreditLostItem creates a payment in the amount equal
220
to the replacement price charge created by DebitLostItem.
221
222
=cut
223
224
sub CreditLostItem {
225
    my ($params) = @_;
226
227
    my $borrower = $params->{borrower};
228
    my $debit    = $params->{debit};
229
230
    croak("Required param 'borrower' not passed in!") unless ($borrower);
231
    croak("Required param 'debit' not passed in!")
232
      unless ($debit);
233
234
    my $item =
235
      Koha::Database->new()->schema->resultset('Item')
236
      ->find( $debit->itemnumber() );
237
    carp("No item found!") unless $item;
238
239
    $params->{type}     = Koha::Accounts::CreditTypes::Found;
240
    $params->{amount}   = $debit->amount_original();
241
    $params->{debit_id} = $debit->debit_id();
242
    $params->{notes}    = "Lost item found: " . $item->barcode();
243
244
    return AddCredit($params);
245
}
246
247
=head2 AddCredit
248
249
AddCredit({
250
    borrower       => $borrower,
251
    amount         => $amount,
252
    [ branchcode   => $branchcode, ]
253
    [ manager_id   => $manager_id, ]
254
    [ debit_id     => $debit_id, ] # The primary debit to be paid
255
    [ notes        => $notes, ]
256
});
257
258
Record credit by a patron. C<$borrowernumber> is the patron's
259
borrower number. C<$credit> is a floating-point number, giving the
260
amount that was paid.
261
262
Amounts owed are paid off oldest first. That is, if the patron has a
263
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a credit
264
of $1.50, then the oldest fine will be paid off in full, and $0.50
265
will be credited to the next one.
266
267
debit_id can be passed as a scalar or an array ref to make the passed
268
in debit or debits the first to be credited.
269
270
=cut
271
272
sub AddCredit {
273
    my ($params) = @_;
274
275
    my $type            = $params->{type};
276
    my $borrower        = $params->{borrower};
277
    my $amount          = $params->{amount};
278
    my $amount_received = $params->{amount_received};
279
    my $debit_id        = $params->{debit_id};
280
    my $notes           = $params->{notes};
281
    my $branchcode      = $params->{branchcode};
282
    my $manager_id      = $params->{manager_id};
283
284
    my $userenv = C4::Context->userenv;
285
286
    unless ( $manager_id || $userenv ) {
287
        $manager_id = $userenv->{number};
288
    }
289
290
    unless ( $branchcode || $userenv ) {
291
        $branchcode = $userenv->{branch};
292
    }
293
294
    unless ($borrower) {
295
        croak("Required parameter 'borrower' not passed in");
296
    }
297
    unless ($amount) {
298
        croak("Required parameter amount not passed in");
299
    }
300
301
    unless ( Koha::Accounts::CreditTypes::IsValid($type) ) {
302
        carp("Invalid credit type! Returning without creating credit.");
303
        return;
304
    }
305
306
    unless ($type) {
307
        carp("No type passed in, assuming Payment");
308
        $type = Koha::Accounts::CreditTypes::Payment;
309
    }
310
311
    my $debit =
312
      Koha::Database->new()->schema->resultset('AccountDebit')->find($debit_id);
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
            manager_id       => $manager_id,
325
            created_on       => get_timestamp(),
326
        }
327
      );
328
329
    if ( C4::Context->preference("FinesLog") ) {
330
        logaction( "FINES", "CREATE_PAYMENT", $credit->id,
331
            Dumper( $credit->get_columns() ) );
332
    }
333
334
    $borrower->account_balance( $borrower->account_balance() - $amount );
335
    $borrower->update();
336
337
    # If we are given specific debits, pay those ones first.
338
    if ($debit_id) {
339
        my @debit_ids = ref($debit_id) eq "ARRAY" ? @$debit_id : $debit_id;
340
        foreach my $debit_id (@debit_ids) {
341
            my $debit =
342
              Koha::Database->new()->schema->resultset('AccountDebit')
343
              ->find($debit_id);
344
345
            if ($debit) {
346
                CreditDebit( { credit => $credit, debit => $debit } );
347
            }
348
            else {
349
                carp("Invalid debit_id passed in!");
350
            }
351
        }
352
    }
353
354
    # We still have leftover money, or we weren't given a specific debit to pay
355
    if ( $credit->amount_remaining() > 0 ) {
356
        my @debits =
357
          Koha::Database->new()->schema->resultset('AccountDebit')->search(
358
            {
359
                borrowernumber     => $borrower->borrowernumber(),
360
                amount_outstanding => { '>' => '0' }
361
            }
362
          );
363
364
        foreach my $debit (@debits) {
365
            if ( $credit->amount_remaining() > 0 ) {
366
                CreditDebit(
367
                    {
368
                        credit   => $credit,
369
                        debit    => $debit,
370
                        borrower => $borrower,
371
                        type     => $type,
372
                    }
373
                );
374
            }
375
        }
376
    }
377
378
    return $credit;
379
}
380
381
=head2 CreditDebit
382
383
$account_offset = CreditDebit({
384
    credit => $credit,
385
    debit => $debit,
386
});
387
388
Given a credit and a debit, this subroutine
389
will pay the appropriate amount of the debit,
390
update the debit's amount outstanding, the credit's
391
amout remaining, and create the appropriate account
392
offset.
393
394
=cut
395
396
sub CreditDebit {
397
    my ($params) = @_;
398
399
    my $credit = $params->{credit};
400
    my $debit  = $params->{debit};
401
402
    croak("Required parameter 'credit' not passed in!")
403
      unless $credit;
404
    croak("Required parameter 'debit' not passed in!") unless $debit;
405
406
    my $amount_to_pay =
407
      ( $debit->amount_outstanding() > $credit->amount_remaining() )
408
      ? $credit->amount_remaining()
409
      : $debit->amount_outstanding();
410
411
    if ( $amount_to_pay > 0 ) {
412
        $debit->amount_outstanding(
413
            $debit->amount_outstanding() - $amount_to_pay );
414
        $debit->update();
415
416
        $credit->amount_remaining(
417
            $credit->amount_remaining() - $amount_to_pay );
418
        $credit->update();
419
420
        my $offset =
421
          Koha::Database->new()->schema->resultset('AccountOffset')->create(
422
            {
423
                amount     => $amount_to_pay * -1,
424
                debit_id   => $debit->id(),
425
                credit_id  => $credit->id(),
426
                created_on => get_timestamp(),
427
            }
428
          );
429
430
        if ( C4::Context->preference("FinesLog") ) {
431
            logaction( "FINES", "MODIFY", $offset->id,
432
                Dumper( $offset->get_columns() ) );
433
        }
434
435
        return $offset;
436
    }
437
}
438
439
=head2 RecalculateAccountBalance
440
441
$account_balance = RecalculateAccountBalance({
442
    borrower => $borrower
443
});
444
445
Recalculates a borrower's balance based on the
446
sum of the amount outstanding for the borrower's
447
debits minus the sum of the amount remaining for
448
the borrowers credits.
449
450
TODO: Would it be better to use af.amount_original - ap.amount_paid for any reason?
451
      Or, perhaps calculate both and compare the two, for error checking purposes.
452
=cut
453
454
sub RecalculateAccountBalance {
455
    my ($params) = @_;
456
457
    my $borrower = $params->{borrower};
458
    croak("Requred paramter 'borrower' not passed in!")
459
      unless ($borrower);
460
461
    my $debits =
462
      Koha::Database->new()->schema->resultset('AccountDebit')
463
      ->search( { borrowernumber => $borrower->borrowernumber() } );
464
    my $amount_outstanding = $debits->get_column('amount_outstanding')->sum();
465
466
    my $credits =
467
      Koha::Database->new()->schema->resultset('AccountCredit')
468
      ->search( { borrowernumber => $borrower->borrowernumber() } );
469
    my $amount_remaining = $credits->get_column('amount_remaining')->sum();
470
471
    my $account_balance = $amount_outstanding - $amount_remaining;
472
    $borrower->account_balance($account_balance);
473
    $borrower->update();
474
475
    return $account_balance;
476
}
477
478
=head2 NormalizeBalances
479
480
    $account_balance = NormalizeBalances({ borrower => $borrower });
481
482
    For a given borrower, this subroutine will find all debits
483
    with an outstanding balance and all credits with an unused
484
    amount remaining and will pay those debits with those credits.
485
486
=cut
487
488
sub NormalizeBalances {
489
    my ($params) = @_;
490
491
    my $borrower = $params->{borrower};
492
493
    croak("Required param 'borrower' not passed in!") unless $borrower;
494
495
    my @credits =
496
      Koha::Database->new()->schema->resultset('AccountCredit')->search(
497
        {
498
            borrowernumber   => $borrower->borrowernumber(),
499
            amount_remaining => { '>' => '0' }
500
        }
501
      );
502
503
    return unless @credits;
504
505
    my @debits =
506
      Koha::Database->new()->schema->resultset('AccountDebit')->search(
507
        {
508
            borrowernumber     => $borrower->borrowernumber(),
509
            amount_outstanding => { '>' => '0' }
510
        }
511
      );
512
513
    return unless @debits;
514
515
    foreach my $credit (@credits) {
516
        foreach my $debit (@debits) {
517
            if (   $credit->amount_remaining()
518
                && $debit->amount_outstanding() )
519
            {
520
                CreditDebit( { credit => $credit, debit => $debit } );
521
            }
522
        }
523
    }
524
525
    return RecalculateAccountBalance( { borrower => $borrower } );
526
}
527
528
1;
529
__END__
530
531
=head1 AUTHOR
532
533
Kyle M Hall <kyle@bywatersolutions.com>
534
535
=cut
(-)a/Koha/Accounts/CreditTypes.pm (+117 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 => 'ACCOUNT_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
1;
112
113
=head1 AUTHOR
114
115
Kyle M Hall <kyle@bywatersolutions.com>
116
117
=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 / +72 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
1;
67
68
=head1 AUTHOR
69
70
Kyle M Hall <kyle@bywatersolutions.com>
71
72
=cut

Return to bug 6427