@@ -, +, @@ --- circ/recalls_waiting.pl | 71 +++++++++ ...g_19532_-_add_RecallsMaxPickUpDelay_syspref.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../en/modules/admin/preferences/circulation.pref | 5 + .../prog/en/modules/circ/recalls_waiting.tt | 163 +++++++++++++++++++++ 5 files changed, 241 insertions(+) create mode 100755 circ/recalls_waiting.pl create mode 100644 installer/data/mysql/atomicupdate/bug_19532_-_add_RecallsMaxPickUpDelay_syspref.sql create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_waiting.tt --- a/circ/recalls_waiting.pl +++ a/circ/recalls_waiting.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +# Copyright 2017 Aleisha Amohia +# +# 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 3 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, see . + +use Modern::Perl; +use CGI qw ( -utf8 ); +use C4::Auth; +use C4::Output; +use Koha::Recalls; +use Koha::BiblioFrameworks; +use Koha::DateUtils; +use Koha::Patrons; + +my $query = new CGI; +my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( + { + template_name => "circ/recalls_waiting.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => "circulate_remaining_permissions" }, + debug => 1, + } +); + +my $op = $query->param('op') || 'list'; + +if ($op eq 'expire_recall') { + my $recall_id = $query->param('recall_id'); + Koha::Recalls->find($recall_id)->update({ expirationdate => dt_from_string(), status => 'E' }); + $op = 'list'; +} + +if ($op eq 'list') { + my @recalls = Koha::Recalls->search({ status => 'W' }); + my $borrower = Koha::Patrons->find($loggedinuser); + my @over; + my $maxdelay = C4::Context->preference('RecallsMaxPickUpDelay') || 7; + my $today = dt_from_string(); + foreach my $r (@recalls){ + my $lastwaitingday = dt_from_string($r->waitingdate)->add( days => $maxdelay ); + if ( $today > $lastwaitingday ){ + push @over, $r; + } + } + $template->param( + recalls => \@recalls, + over => \@over, + ); +} + +# Checking if there is a Fast Cataloging Framework +$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ); + +# writing the template +output_html_with_http_headers $query, $cookie, $template->output; --- a/installer/data/mysql/atomicupdate/bug_19532_-_add_RecallsMaxPickUpDelay_syspref.sql +++ a/installer/data/mysql/atomicupdate/bug_19532_-_add_RecallsMaxPickUpDelay_syspref.sql @@ -0,0 +1, @@ +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('RecallsMaxPickUpDelay','7','','Define the maximum time a recall can be waiting for pickup','Integer'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -444,6 +444,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('QueryWeightFields','1',NULL,'If ON, enables field weighting','YesNo'), ('QuoteOfTheDay','0',NULL,'Enable or disable display of Quote of the Day on the OPAC home page','YesNo'), ('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'), +('RecallsMaxPickUpDelay','7','','Define the maximum time a recall can be waiting for pickup','Integer'), ('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'), ('RefundLostOnReturnControl','CheckinLibrary','CheckinLibrary|ItemHomeBranch|ItemHoldingBranch','If a lost item is returned, choose which branch to pick rules for refunding.','Choice'), ('RenewalLog','0','','If ON, log information about renewals','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -153,6 +153,11 @@ Circulation: Checkout Policy: - + - Mark a recall as problematic if it has been waiting to be picked up for + - pref: RecallsMaxPickUpDelay + - class: integer + - days. + - - pref: AllowTooManyOverride choices: yes: Allow --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_waiting.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_waiting.tt @@ -0,0 +1,163 @@ +[% USE Koha %] +[% USE KohaDates %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › Recalls awaiting pickup +[% INCLUDE 'doc-head-close.inc' %] + + + +[% INCLUDE 'datatables.inc' %] + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +[% IF Koha.Preference('CircSidebar') %]
[% ELSE %]
[% END %] + +
+
+ [% IF Koha.Preference('CircSidebar') %]
[% END %] +
+ +

Recalls awaiting pickup

+ + [% IF recalls.size > 0 %] + +
+ + + +
+ [% IF ( recalls.size > 0 ) %] + + + + + + + + + + [% FOREACH recall IN recalls %] + + + + + + [% END %] + +
Available sinceTitleRequested byPickup locationExpire
[% recall.waitingdate | $KohaDates %] + + [% recall.biblio.title %] + [% FOREACH s IN recall.biblio.subtitles %] + [% s %] + [% END %] + [% recall.item.enumchron %] + + [% recall.biblio.author %] +
Barcode: [% recall.item.barcode %] +
+ [% recall.borrower.firstname %] [% recall.borrower.surname %] + [% IF ( recall.borrower.phone ) %]
[% recall.borrower.phone %][% END %] + [% IF ( recall.borrower.email ) %]
[% recall.borrower.email %][% END %] +
[% recall.branch.branchname %] +
+ + +
+ +
+
+
+ [% ELSE %] +
No recalls waiting.
+ [% END %] +
+ +
+ [% IF ( over.size > 0 ) %] + [% IF ( Koha.Preference('RecallsMaxPickUpDelay') ) %]

Recalls listed here have been awaiting pickup for more than [% Koha.Preference('RecallsMaxPickUpDelay') %] days.

[% END %] + + + + + + + + + + [% FOREACH recall IN over %] + + + + + + [% END %] + +
Available sinceTitleRequested byPickup locationExpire
[% recall.waitingdate | $KohaDates %] + + [% recall.biblio.title %] + [% FOREACH s IN recall.biblio.subtitles %] + [% s %] + [% END %] + [% recall.item.enumchron %] + + [% recall.biblio.author %] +
Barcode: [% recall.item.barcode %] +
+ [% recall.borrower.firstname %] [% recall.borrower.surname %] + [% IF ( recall.borrower.phone ) %]
[% recall.borrower.phone %][% END %] + [% IF ( recall.borrower.email ) %]
[% recall.borrower.email %][% END %] +
[% recall.branch.branchname %] +
+ + +
+ +
+
+
+ [% ELSE %] +
No recalls waiting.
+ [% END %] +
+ +
+ + [% END %] + +
+
+ +
+ + [% IF Koha.Preference('CircSidebar') %] +
+ [% INCLUDE 'circ-nav.inc' %] +
+ [% END %] +
+ +[% INCLUDE 'intranet-bottom.inc' %] --