From 31aaa394cdea5d0825216a2304ada31b9ab66899 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sat, 21 Jul 2018 09:56:27 +0000 Subject: [PATCH] Bug 19532 - New RECALL_REQUESTER_DET notice and print option on confirm recall popup This patch adds a new notice RECALL_REQUESTER_DET which like HOLD_SLIP outlines borrower and item information so the item can be put aside for the requester. This patch also adds a 'Print and confirm' button to the 'Confirm recall' popup that appears when returning a recalled item. This functionality works the same as the 'Print and confirm' functionality for the Hold slip: A print modal popup will appear for the user to choose print settings, and choose to print or cancel. Test plan: 1. Ensure 'UseRecalls' sypref is enabled and you have inputted values for recalls fields in the circulation rules (Administration->Circulation and fines rules) 2. Check item out to patron 1 3. Log into the OPAC as patron 2 and place a recall on the checked out item 4. Return the item in the staff client 5. Notice there are only two buttons on the 'Confirm recall' popup which appears: 'Confirm' and 'Cancel' 6. Apply patch, run updatedatabase.pl (as there is a SQL atomicupdate file to be run), and restart memcached and plack 7. Using a new item repeat steps 2,3 8. In a new tab, in the staff client go to Circulation->Recalls queue, and notice the recall has a status of 'Requested' 8. Back in your first tab return the item and notice that a new button 'Print and confirm' is on the 'Confirm recall' popup. Select this button and notice two new popup windows appear: Browsers print window, and a window showing what the notice to be print looks like. 9. If you have a printer available print the notice. Otherwise you can look at what the notice would look like in the notice window, observing the notice outlines the following information: * Current date and time * Recall pickup branch * Borrowers first name and surname * Borrowers cardnumber, phonenumber, address, address2, city, zipcode, email * Recalled item title, author, barcode, callnumber. * Recall waiting date, and recall notes Some of these values will not be displayed on the notice if they are not set. For example the patron may not have set an address, or email. 10. After either printing the notice, or selecting 'Cancel' in the print window. Go back to your second tab and refresh the page and notice the status of the recall has changed to 'Ready for pickup' this shows the 'Print and confirm' button does actually confirm the recall. 11. Making sure the changes implemented in the previous commit (Bug 19532 - Make the Recall confirmation popup appear everytime a recalled item is put through returns) still work. Try returning the item again and notice the 'Confirm recall' popup with the 'Print and confirm' button is displayed again and you can choose to print the notice again if you want. Sponsored-By: Toi Ohomai Institute of Technology, New Zealand --- C4/Letters.pm | 1 + circ/recall-pickup-slip.pl | 88 ++++++++++++++++++++++ circ/returns.pl | 10 +++ .../bug_19532_recall_requester_details_notice.sql | 1 + .../prog/en/modules/circ/recall-pickup-slip.tt | 26 +++++++ .../intranet-tmpl/prog/en/modules/circ/returns.tt | 10 +++ 6 files changed, 136 insertions(+) create mode 100755 circ/recall-pickup-slip.pl create mode 100644 installer/data/mysql/atomicupdate/bug_19532_recall_requester_details_notice.sql create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/recall-pickup-slip.tt diff --git a/C4/Letters.pm b/C4/Letters.pm index f12a014..65915af 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -40,6 +40,7 @@ use Koha::Notice::Messages; use Koha::DateUtils qw( format_sqldatetime dt_from_string ); use Koha::Patrons; use Koha::Subscriptions; +use Data::Dumper; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); diff --git a/circ/recall-pickup-slip.pl b/circ/recall-pickup-slip.pl new file mode 100755 index 0000000..daf6c88 --- /dev/null +++ b/circ/recall-pickup-slip.pl @@ -0,0 +1,88 @@ +#!/usr/bin/perl + + +# Copyright 2018 Catalyst IT +# +# 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 C4::Context; +use C4::Output; +use CGI qw ( -utf8 ); +use C4::Auth qw/:DEFAULT get_session/; +use Koha::Recall; +use Koha::Recalls; +use C4::Letters; +use C4::Message; +use Data::Dumper; +use Koha::Patrons; +use Koha::Items; +use Koha::Biblios; +use Koha::Libraries; +use vars qw($debug); + +BEGIN { + $debug = $ENV{DEBUG} || 0; +} + +my $input = new CGI; +my $sessionID = $input->cookie("CGISESSID"); +my $session = get_session($sessionID); + +my $borrowernumber = $input->param('borrowernumber'); +my $biblionumber = $input->param('biblionumber'); +my $itemnumber = $input->param('itemnumber'); +my $recallid = $input->param('recall_id'); +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "circ/recall-pickup-slip.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => "circulate_remaining_permissions" }, + debug => $debug, + } +); + +my $recall = Koha::Recalls->find($recallid); +my $patron = Koha::Patrons->find($borrowernumber); +my $item = Koha::Items->find($recall->itemnumber); +my $biblio = Koha::Biblios->find($item->biblionumber); +my $library = Koha::Libraries->find($recall->branchcode); + +#Print slip to inform library staff of details of recall requester, so the item can be put aside for requester +my ($slip, $is_html); +my $letter = C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => 'RECALL_REQUESTER_DET', + tables => { + 'branches' => $library->branchcode, + 'borrowers' => $patron->borrowernumber, + 'biblio' => $biblio->biblionumber, + 'items' => $item->itemnumber, + 'recalls' => $recall->recall_id + } +); + +if ($letter) { + $slip = $letter->{content}; + $is_html = $letter->{is_html}; +} + +$template->param( slip => $slip ) if ($slip); +$template->param( plain => !$is_html ); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/circ/returns.pl b/circ/returns.pl index 32d3c21..cc13b9a 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -89,6 +89,16 @@ if ( $query->param('print_slip') ) { ); } +if ( $query->param('print_recall_slip') ) { + $template->param( + print_recall_slip => 1, + borrowernumber => scalar $query->param('borrowernumber'), + biblionumber => scalar $query->param('biblionumber'), + itemnumber => scalar $query->param('itemnumber'), + recall_id => scalar $query->param('recall_id') + ); +} + ##################### #Global vars my $printers = GetPrinters(); diff --git a/installer/data/mysql/atomicupdate/bug_19532_recall_requester_details_notice.sql b/installer/data/mysql/atomicupdate/bug_19532_recall_requester_details_notice.sql new file mode 100644 index 0000000..8c841d5 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_19532_recall_requester_details_notice.sql @@ -0,0 +1 @@ +insert into letter (module, code, name, is_html, title, content, message_transport_type, lang) values ('circulation', 'RECALL_REQUESTER_DET', 'Details of patron who recalled item', 0, 'Details of patorn who recalled item', '
Date: <>

Recall for pickup at <>

<>, <>


ITEM RECALLED

<>

<>

Notes:

<>

', 'email', default); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recall-pickup-slip.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recall-pickup-slip.tt new file mode 100644 index 0000000..a2ba1e7 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recall-pickup-slip.tt @@ -0,0 +1,26 @@ +[% USE Asset %] +[% USE Koha %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › Recall print receipt +[% INCLUDE 'doc-head-close.inc' %] + + +[% Asset.css("css/print.css") %] +[% IF ( Koha.Preference('SlipCSS') ) %] + +[% END %] + +[% INCLUDE 'slip-print.inc' #printThenClose %] + + +
+ +[% IF plain %] +
+[% IF ( slip ) %][% slip %][% ELSE %]No slip template found[% END %]
+
+[% ELSE %] +[% IF ( slip ) %][% slip %][% ELSE %]No slip template found[% END %] +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] 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 254b1db..ae2b303 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -559,6 +559,8 @@ + +