From 997026ba100f5e4def141dcd145e2101f9f995e0 Mon Sep 17 00:00:00 2001 From: Mason James Date: Thu, 29 Dec 2016 14:59:32 +1300 Subject: [PATCH] Revert "Bug 14598: Make C4::Circulation::AddReturn store the right itemtype" This reverts commit f8e2e2f1e25a9838300a160a094f4c0b3dcfa710. --- C4/Circulation.pm | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 36abfa20da..c1c8a881aa 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1808,19 +1808,13 @@ sub AddReturn { $branch = C4::Context->userenv->{'branch'} unless $branch; # we trust userenv to be a safe fallback/default my $messages; my $borrower; + my $biblio; my $doreturn = 1; my $validTransfert = 0; my $stat_type = 'return'; # get information on item - my $item = GetItem( undef, $barcode ) - or die "GetItem( undef, $barcode ) failed"; - my $itemnumber = $item->{ itemnumber }; - my $biblio = GetBiblioData( $item->{ biblionumber } ); - my $itemtype = ( C4::Context->preference("item-level_itypes") ) - ? $item->{ itype } - : $biblio->{ itemtype }; - + my $itemnumber = GetItemnumberFromBarcode( $barcode ); unless ($itemnumber) { return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. } @@ -1841,6 +1835,8 @@ sub AddReturn { } } + my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; + if ( $item->{'location'} eq 'PROC' ) { if ( C4::Context->preference("InProcessingToShelvingCart") ) { $item->{'location'} = 'CART'; @@ -2027,14 +2023,15 @@ sub AddReturn { } # Record the fact that this book was returned. + # FIXME itemtype should record item level type, not bibliolevel type UpdateStats({ - branch => $branch, - type => $stat_type, - itemnumber => $itemnumber, - itemtype => $itemtype, - borrowernumber => $borrowernumber, - ccode => $item->{ ccode } - }); + branch => $branch, + type => $stat_type, + itemnumber => $item->{'itemnumber'}, + itemtype => $biblio->{'itemtype'}, + borrowernumber => $borrowernumber, + ccode => $item->{'ccode'}} + ); # Send a check-in slip. # NOTE: borrower may be undef. probably shouldn't try to send messages then. my $circulation_alert = 'C4::ItemCirculationAlertPreference'; -- 2.39.5