+my $issueinformation;
+my $itemnumber;
+my $barcode = $query->param('barcode');
+my $exemptfine = $query->param('exemptfine');
+my $dropboxmode = $query->param('dropboxmode');
+my $dotransfer = $query->param('dotransfer');
+my $canceltransfer = $query->param('canceltransfer');
+my $dest = $query->param('dest');
+my $calendar = C4::Calendar->new( branchcode => $userenv_branch );
+#dropbox: get last open day (today - 1)
+my $today = C4::Dates->new();
+my $today_iso = $today->output('iso');
+my $dropboxdate = $calendar->addDate($today, -1);
+if ($dotransfer){
+# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
+ my $transferitem = $query->param('transferitem');
+ my $tobranch = $query->param('tobranch');
+ ModItemTransfer($transferitem, $userenv_branch, $tobranch);
+}
+
+if ($canceltransfer){
+ $itemnumber=$query->param('itemnumber');
+ DeleteTransfer($itemnumber);
+ if($dest eq "ttr"){
+ print $query->redirect("/cgi-bin/koha/circ/transferstoreceive.pl");
+ exit;
+ } else {
+ $template->param( transfercancelled => 1);
+ }
+}
+
+# actually return book and prepare item table.....
+if ($barcode) {
+ $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
+ $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
+ $itemnumber = GetItemnumberFromBarcode($barcode);
+
+ if ( C4::Context->preference("InProcessingToShelvingCart") ) {
+ my $item = GetItem( $itemnumber );
+ if ( $item->{'location'} eq 'PROC' ) {
+ $item->{'location'} = 'CART';
+ ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
+ }
+ }
+
+ if ( C4::Context->preference("ReturnToShelvingCart") ) {
+ my $item = GetItem( $itemnumber );
+ $item->{'location'} = 'CART';
+ ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
+ }
+
+#
+# save the return
+#
+ ( $returned, $messages, $issueinformation, $borrower ) =
+ AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode); # do the return
+ my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn') or 'homebranch';
+
+ # get biblio description
+ my $biblio = GetBiblioFromItemNumber($itemnumber);
+ # fix up item type for display
+ $biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'};
+
+ $template->param(
+ title => $biblio->{'title'},
+ homebranch => $biblio->{'homebranch'},
+ homebranchname => GetBranchName( $biblio->{$homeorholdingbranchreturn} ),
+ author => $biblio->{'author'},
+ itembarcode => $biblio->{'barcode'},
+ itemtype => $biblio->{'itemtype'},
+ ccode => $biblio->{'ccode'},
+ itembiblionumber => $biblio->{'biblionumber'},
+ additional_materials => $biblio->{'materials'}
+ );
+
+ my %input = (
+ counter => 0,
+ first => 1,
+ barcode => $barcode,
+ );
+