From 66ed2fc9c32b2ad67b4a84a4bb73f7608e1ec620 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 30 Sep 2019 10:37:03 +0000 Subject: [PATCH] Bug 23695: Alter transferbook to take a hash of params and specify from_branch To test: 1 - Go to Circulation->Transfer 2 - Find an item from your branch and create a transfer to branch B 3 - Note you can specify the origin and default is 'Item's holding library' 4 - Confirm the item is marked as held at your current branch and is being transferred to B 5 - Find an item from a third branch, branch C 6 - Transfer that item to branch B from branch D 7 - Confirm the item is held at branch D and is being transferred to B 8 - prove -v t/db_dependent/Circulation.t 9 - prove -v t/db_dependent/Koha/Items.t 10 - prove -v t/db_dependent/RotatingCollections.t --- circ/branchtransfers.pl | 10 ++++---- .../prog/en/modules/circ/branchtransfers.tt | 11 +++++++++ t/db_dependent/Circulation.t | 28 +++++++++++++++++++++- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index a8446ae11c..7524bb7a2a 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -80,6 +80,7 @@ my $setwaiting; my $request = $query->param('request') || ''; my $borrowernumber = $query->param('borrowernumber') || 0; +my $frombranchcd = $query->param('frombranchcd') || C4::Context->userenv->{'branch'}; my $tobranchcd = $query->param('tobranchcd') || ''; my $ignoreRs = 0; @@ -126,19 +127,19 @@ defined $barcode and $barcode =~ s/^\s*|\s*$//g; # FIXME: barcodeInputFilter # warn "barcode : $barcode"; if ($barcode) { + my $item = Koha::Items->find({ barcode => $barcode }); + $frombranchcd = $item->holdingbranch if $frombranchcd eq "current_holding"; ( $transferred, $messages ) = transferbook({ - from_branch => C4::Context->userenv->{'branch'}, + from_branch => $frombranchcd, to_branch => $tobranchcd, barcode => $barcode, ignore_reserves => $ignoreRs }); - my $item = Koha::Items->find({ barcode => $barcode }); $found = $messages->{'ResFound'}; if ($transferred) { my %item; my $biblio = $item->biblio; - my $frbranchcd = C4::Context->userenv->{'branch'}; $item{'biblionumber'} = $item->biblionumber; $item{'itemnumber'} = $item->itemnumber; $item{'title'} = $biblio->title; @@ -150,7 +151,7 @@ if ($barcode) { $item{'location'} = $av->count ? $av->next->lib : ''; $item{counter} = 0; $item{barcode} = $barcode; - $item{frombrcd} = $frbranchcd; + $item{frombrcd} = $frombranchcd; $item{tobrcd} = $tobranchcd; push( @trsfitemloop, \%item ); } @@ -240,6 +241,7 @@ $template->param( itemnumber => $itemnumber, barcode => $barcode, biblionumber => $biblionumber, + frombranchcd => $frombranchcd, tobranchcd => $tobranchcd, reqmessage => $reqmessage, cancelled => $cancelled, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt index 4859333a3b..d270733310 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt @@ -71,6 +71,7 @@ + @@ -127,6 +128,7 @@ [% ELSE %]
  • Collection code: [% AuthorisedValues.GetByCode( 'CCODE', errmsgloo.code ) | html %]
  • [% END %] +
  • Originating library: [% Branches.GetName( errmsgloo.fbr ) | html %]
  • Destination library: [% Branches.GetName( errmsgloo.tbr ) | html %]
  • @@ -150,6 +152,13 @@ Transfer
    1. + + +
    2. +