Line 0
Link Here
|
|
|
1 |
package Koha::Template::Plugin::Holds; |
2 |
|
3 |
# This file is part of Koha. |
4 |
# |
5 |
# Koha is free software; you can redistribute it and/or modify it under the |
6 |
# terms of the GNU General Public License as published by the Free Software |
7 |
# Foundation; either version 3 of the License, or (at your option) any later |
8 |
# version. |
9 |
# |
10 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
11 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
12 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
13 |
# |
14 |
# You should have received a copy of the GNU General Public License along |
15 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
16 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
17 |
|
18 |
use Modern::Perl; |
19 |
|
20 |
use base qw( Template::Plugin ); |
21 |
|
22 |
use Koha::Holds qw(); |
23 |
|
24 |
=pod |
25 |
|
26 |
This plugin is a home for various patron related Template Toolkit functions |
27 |
to help streamline Koha and to move logic from the Perl code into the |
28 |
Templates when it makes sense to do so. |
29 |
|
30 |
To use, first, include the line '[% USE Borrowers %]' at the top |
31 |
of the template to enable the plugin. |
32 |
|
33 |
For example: [% IF Borrowers.IsDebarred( borrower ) %] |
34 |
removes the necessity of setting a template variable in Perl code to |
35 |
find out if a patron is restricted even if that variable is not evaluated |
36 |
in any way in the script. |
37 |
|
38 |
=cut |
39 |
|
40 |
sub count { |
41 |
my ( $self, $biblionumber ) = @_; |
42 |
|
43 |
return unless $biblionumber; |
44 |
|
45 |
return Koha::Holds->count( { biblionumber => $biblionumber } ); |
46 |
} |
47 |
|
48 |
1; |