From fc8f6521594cacf2181fbb5cd5f020bdd3363c5e Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Sun, 20 Oct 2013 18:39:15 -0400 Subject: [PATCH] Bug 10694 - Allow arbitrary backdating of returns - QA Followup --- Koha/Template/Plugin/Borrowers.pm | 40 ++++++++++++++++++++ circ/returns.pl | 3 +- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 12 ++++++ 3 files changed, 54 insertions(+), 1 deletions(-) create mode 100644 Koha/Template/Plugin/Borrowers.pm diff --git a/Koha/Template/Plugin/Borrowers.pm b/Koha/Template/Plugin/Borrowers.pm new file mode 100644 index 0000000..45c4071 --- /dev/null +++ b/Koha/Template/Plugin/Borrowers.pm @@ -0,0 +1,40 @@ +package Koha::Template::Plugin::Borrowers; + +# Copyright ByWater Solutions 2013 + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use base qw( Template::Plugin ); + +use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/; + +use C4::Koha; + +sub IsDebarred { + my ( $self, $borrower ) = @_; + + if ( $borrower->{'debarred'} && check_date( split( /-/, $borrower->{'debarred'} ) ) ) { + if ( Date_to_Days(Date::Calc::Today) < Date_to_Days( split( /-/, $borrower->{'debarred'} ) ) ) { + return 1; + } + } + + return 0; +} + +1; diff --git a/circ/returns.pl b/circ/returns.pl index f8c4608..a38455a 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -268,7 +268,8 @@ if ($barcode) { itemtype => $biblio->{'itemtype'}, ccode => $biblio->{'ccode'}, itembiblionumber => $biblio->{'biblionumber'}, - additional_materials => $biblio->{'materials'} + borrower => $borrower, + additional_materials => $biblio->{'materials'}, ); my %input = ( diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 8002b30..7306078 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -1,6 +1,7 @@ [% USE KohaDates %] [% USE Branches %] [% USE Koha %] +[% USE Borrowers %] [% INCLUDE 'doc-head-open.inc' %] Koha › Circulation › Check in [% title |html %] @@ -102,6 +103,17 @@ $(document).ready(function () { [% END %] + +[% IF return_date_override && Borrowers.IsDebarred( borrower ) %] +
+

+ + [% borrower.firstname %] [% borrower.surname %] + + is retricted. Please verify this patron should still be restricted. +

+
+[% END %] [% IF ( wrongbranch ) %]

Cannot check in

This item must be checked in at its home library. NOT CHECKED IN

-- 1.7.2.5