my $borrowernumber = $query->param("bn-$counter");
$counter++;
- # decode barcode
+ # decode barcode ## Didn't we already decode them before passing them back last time??
$barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter'));
######################
my $returned = 0;
my $messages;
my $issueinformation;
+my $itemnumber;
my $barcode = $query->param('barcode');
my $exemptfine = $query->param('exemptfine');
my $dropboxmode = $query->param('dropboxmode');
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 choosen to initiate a transfer
+ # 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);
# actually return book and prepare item table.....
if ($barcode) {
$barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
-#
-# save the return
-#
+ $itemnumber = GetItemnumberFromBarcode($barcode);
+
( $returned, $messages, $issueinformation, $borrower ) =
- AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode);
+ AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode); # do the return
+
# get biblio description
- my $biblio = GetBiblioFromItemNumber($issueinformation->{'itemnumber'});
+ my $biblio = GetBiblioFromItemNumber($itemnumber);
# fix up item type for display
$biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'};
);
if ($returned) {
- $returneditems{0} = $barcode;
- $riborrowernumber{0} = $borrower->{'borrowernumber'};
- $riduedate{0} = $issueinformation->{'date_due'};
+ my $duedate = $issueinformation->{'date_due'};
+ $returneditems{0} = $barcode;
+ $riborrowernumber{0} = $borrower->{'borrowernumber'};
+ $riduedate{0} = $duedate;
$input{borrowernumber} = $borrower->{'borrowernumber'};
- $input{duedate} = $issueinformation->{'date_due'};
- $input{return_overdue} = 1 if ($issueinformation->{'date_due'} lt $today->output('iso'));
+ $input{duedate} = $duedate;
+ $input{return_overdue} = 1 if ($duedate and $duedate lt $today->output('iso'));
push( @inputloop, \%input );
-
- # check if the branch is the same as homebranch
- # if not, we want to put a message
- if ( $biblio->{'homebranch'} ne $userenv_branch ) {
- $template->param( homebranch => $biblio->{'homebranch'} );
- }
}
elsif ( !$messages->{'BadBarcode'} ) {
$input{duedate} = 0;
$riborrowernumber{0} = 'Item Cancelled';
}
else {
- $input{borrowernumber} = ' ';
+ $input{borrowernumber} = ' '; # This seems clearly bogus.
$riborrowernumber{0} = ' ';
}
push( @inputloop, \%input );
$template->param(
found => 1,
needstransfer => 1,
- itemnumber => $issueinformation->{'itemnumber'}
+ itemnumber => $itemnumber,
);
}
);
}
-# adding a case of wrong transfert, if the document wasn't transfered in the good library (according to branchtransfer (tobranch) BDD)
+# 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'}) {
$template->param(
);
}
-
#
# reserve found and item arrived at the expected branch
#
# Error Messages
my @errmsgloop;
foreach my $code ( keys %$messages ) {
-
- # warn $code;
my %err;
my $exit_required_p = 0;
if ( $code eq 'BadBarcode' ) {
}
else {
- die "Unknown error code $code"; # XXX
+ die "Unknown error code $code"; # note we need all the (empty) elsif's above, or we die.
+ # This forces the issue of staying in sync w/ Circulation.pm
}
if (%err) {
push( @errmsgloop, \%err );