From 3dc982c9121a949b3632d701685d1776d0c7f81b Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 24 Apr 2012 11:43:40 -0400 Subject: [PATCH] Bug 8004 - Items on Hold Lose Transfer After Being Scanned Twice When a hold is placed on an item where the pickup location is different than the holding library, Koha initiates a branch transfer for that item to fill that hold when items is run through the returns system. If the item is then run through returns a second time, the system is supposed to close that transfer as a 'wrongtransfer', and open a new transfer with the same from and to branches as the original. The problem is that the original transfer is closed, but the new transfer is not created. This is because at some point, someone replaced the template variable WrongTransfer, which had previously contained the branchcode for the library to transfer to, with the full name of the library instead ( I assume to make a look nicer ). Solved by removing the line that was changing the variable contents from the branchcode to the branch name, and adding a new TT filter, KohaBranchName that functions in the same way as KohaDates, except it takes a branchcode and returns the branch name for the given branchcode. The consequence of this, is the the name of the library is passed to updateWrongTransfer instead of the branchcode, causing the failure. --- Koha/Template/Plugin/KohaBranchName.pm | 35 ++++++++++++++++++++ circ/returns.pl | 1 - .../intranet-tmpl/prog/en/modules/circ/returns.tt | 4 ++- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 Koha/Template/Plugin/KohaBranchName.pm diff --git a/Koha/Template/Plugin/KohaBranchName.pm b/Koha/Template/Plugin/KohaBranchName.pm new file mode 100644 index 0000000..a39aba0 --- /dev/null +++ b/Koha/Template/Plugin/KohaBranchName.pm @@ -0,0 +1,35 @@ +package Koha::Template::Plugin::KohaBranchName; + +# Copyright Bywater Solutions 2012 + +# 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 strict; +use warnings; + +use Template::Plugin::Filter; +use base qw( Template::Plugin::Filter ); +use warnings; +use strict; + +use C4::Branch qw( GetBranchName );; + +sub filter { + my ($self,$branchcode) = @_; + return GetBranchName( $branchcode ); +} + +1; diff --git a/circ/returns.pl b/circ/returns.pl index bd60d42..38e9887 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -337,7 +337,6 @@ if ( $messages->{'Wrongbranch'} ){ # case of wrong transfert, if the document wasn't transfered to the right library (according to branchtransfer (tobranch) BDD) if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) { - $messages->{'WrongTransfer'} = GetBranchName( $messages->{'WrongTransfer'} ); $template->param( WrongTransfer => 1, TransferWaitingAt => $messages->{'WrongTransfer'}, 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 cebcb09..3c255fd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -1,4 +1,6 @@ [% USE KohaDates %] +[% USE KohaBranchName %] + [% INCLUDE 'doc-head-open.inc' %] Koha › Circulation › Check in [% title |html %] [% INCLUDE 'doc-head-close.inc' %] @@ -87,7 +89,7 @@ function Dopop(link) { [% END %] -[% IF ( WrongTransfer ) %]

Please return [% title |html %] to [% TransferWaitingAt %]

Print slip or Cancel transfer

+[% IF ( WrongTransfer ) %]

Please return [% title |html %] to [% TransferWaitingAt | $KohaBranchName %]

Print slip or Cancel transfer

[% IF ( wborcnum ) %]
Hold for: