Skip to content

Commit

Permalink
[addresses #15528107 and #15895609] more holds and tranfer fixes
Browse files Browse the repository at this point in the history
- handle case: item already waiting at pickup branch, checkin at pickup
  branch; relax previous assumption that item is permanent collection (not always true)
- allow ignore hold upon checkin at pickup library and not yet waiting
  (don't automatically set hold to waiting in AddReturn())
  • Loading branch information
hgq committed Jul 22, 2011
1 parent 2da07ea commit 7b5e3cd
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 19 deletions.
6 changes: 4 additions & 2 deletions C4/Circulation.pm
Expand Up @@ -1659,8 +1659,10 @@ sub AddReturn {
);
$sth->execute( $item->{'itemnumber'} );
# if we have a reservation with valid transfer, we can set it's status to 'W'
my ($resfound,$resrec) = C4::Reserves::CheckReserves($item->{'itemnumber'});
C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W', $resrec) if ($resfound);
## UPDATE: hold is trapped outside of and after AddReturn()...
## transfer does not have to for hold but for other reasons -hQ
#my ($resfound,$resrec) = C4::Reserves::CheckReserves($item->{'itemnumber'});
#C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W', $resrec) if ($resfound);
} else {
$messages->{'WrongTransfer'} = $tobranch;
$messages->{'WrongTransferItem'} = $item->{'itemnumber'};
Expand Down
13 changes: 8 additions & 5 deletions catalogue/detail.pl
Expand Up @@ -79,12 +79,15 @@
exit;
}

my $biblionumber = $query->param('biblionumber');
my $fw = GetFrameworkCode($biblionumber);

## get notes and subjects from MARC record
my $marcflavour = C4::Context->preference("marcflavour");
my $biblionumber = $query->param('biblionumber');
my $record = GetMarcBiblio($biblionumber);
unless ($record) {
print "Content-type: text/plain\n\n";
print "Cannot find biblionumber=$biblionumber";
exit;
}
my $fw = GetFrameworkCode($biblionumber);
my $marcflavour = C4::Context->preference("marcflavour");

if (C4::Context->preference("XSLTDetailsDisplay") ) {
$template->param(
Expand Down
19 changes: 10 additions & 9 deletions circ/returns.pl
Expand Up @@ -235,7 +235,7 @@ =head1 returns.pl
# 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');
C4::Items::ModItemTransfer($transferitem, $userenv_branch, $tobranch);
C4::Items::ModItemTransfer($transferitem, $userenv_branch, $tobranch);
}
elsif ($query->param('cancelTransfer')) {
C4::Items::ModItemTransfer($query->param('itemnumber'));
Expand All @@ -254,31 +254,30 @@ =head1 returns.pl
$barcode = C4::Circulation::barcodedecode(barcode=>$barcode)
if(C4::Context->preference('itemBarcodeInputFilter')
|| C4::Context->preference('itembarcodelength'));
$itemnumber = GetItemnumberFromBarcode($barcode);

$itemnumber = C4::Items::GetItemnumberFromBarcode($barcode);
if ( C4::Context->preference("InProcessingToShelvingCart") ) {
my $item = GetItem( $itemnumber );
my $item = C4::Items::GetItem( $itemnumber );
if ( $item->{'location'} eq 'PROC' ) {
$item->{'location'} = 'CART';
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
C4::Items::ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
}
}

if ( C4::Context->preference("ReturnToShelvingCart") ) {
my $item = GetItem( $itemnumber );
$item->{'location'} = 'CART';
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
C4::Items::ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
}

#
# save the return
#
if ($checkin_override_date ) {
( $returned, $messages, $issueinformation, $borrower ) =
AddReturn( $barcode, C4::Context->userenv->{'branch'}, $exemptfine, $dropboxmode, $checkin_override_date->output('iso'));
C4::Circulation::AddReturn( $barcode, C4::Context->userenv->{'branch'}, $exemptfine, $dropboxmode, $checkin_override_date->output('iso'));
} else {
( $returned, $messages, $issueinformation, $borrower ) =
AddReturn( $barcode, C4::Context->userenv->{'branch'}, $exemptfine, $dropboxmode);
C4::Circulation::AddReturn( $barcode, C4::Context->userenv->{'branch'}, $exemptfine, $dropboxmode);
}
# get biblio description
my $biblio = GetBiblioFromItemNumber($itemnumber);
Expand Down Expand Up @@ -493,7 +492,9 @@ =head1 returns.pl
}
elsif ( $code eq 'NotIssued' ) {
$err{notissued} = 1;
$err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
if ($branches->{$messages->{IsPermanent}}) {
$err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
}
}
elsif ( $code eq 'WasLost' ) {
$err{waslost} = 1;
Expand Down
15 changes: 12 additions & 3 deletions koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl
Expand Up @@ -230,6 +230,7 @@ function ContinueReturns() {
<!-- TMPL_IF NAME="wboremail" --><li><a id="boremail" href="mailto:<!-- TMPL_VAR NAME="wboremail" -->"><!-- TMPL_VAR NAME="wboremail" --></a></li><!-- /TMPL_IF -->
</ul>
<form method="post" action="returns.pl" class="confirm">
<input type=hidden name="resbarcode" value="<TMPL_VAR NAME="barcode">">
<input type=hidden name="dotransfer" value="1">
<input type=hidden name="transferitem" value="<TMPL_VAR NAME="WrongTransferItem">">
<input type=hidden name="tobranch" value="<TMPL_VAR NAME="wpickbranch">">
Expand Down Expand Up @@ -293,7 +294,11 @@ function ContinueReturns() {
<input type=hidden name="lostbarcode" value="">
<input type=hidden name="lostborrowernumber" value="">
<input type=hidden name="unlinkFromAccount" value="0">
<h3>Hold Found<TMPL_IF NAME="pull"> (please pull)<TMPL_ELSE> (item is already waiting)</TMPL_IF>:<br><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="itembiblionumber" -->"><!-- TMPL_VAR Name="title" escape="html" --></a></h3>
<h3>Hold Found
<TMPL_IF NAME="pull">(please pull)
<TMPL_ELSIF EXPR="waiting">(item is already waiting)
<TMPL_ELSE>ERROR: uncaught exception
</TMPL_IF>:<br><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="itembiblionumber" -->"><!-- TMPL_VAR Name="title" escape="html" --></a></h3>
<!-- TMPL_IF NAME="reservenotes" --><h4>Notes: <!-- TMPL_VAR Name="reservenotes" --></h4><!-- /TMPL_IF -->
<br><h4>Hold for:</h4>
<ul>
Expand Down Expand Up @@ -343,10 +348,14 @@ function ContinueReturns() {
</form>
</div>
<TMPL_ELSE>
<TMPL_IF EXPR="currentbranch ne destbranchname and foundwait">
<TMPL_IF EXPR="currentbranch ne destbranchname and (foundwait or pull) and not WrongTransfer">
<div class="dialog message">
<span class="error">Unexpected check in.</span>
<h3>Hold found marked as <span class=error>Waiting</span>:</h3>
<h3>Hold found marked as <span class=error>
<TMPL_IF EXPR="res_found eq 'W'">Waiting
<TMPL_ELSIF EXPR="res_found eq 'T'">In Transit
<TMPL_ELSE>ERROR
</TMPL_IF></span>:</h3>
<h4><a href="/cgi-bin/koha/detail.pl?biblionumber=<TMPL_VAR NAME="biblionumber">"><TMPL_VAR NAME="title"></a><br>
at <TMPL_VAR NAME="pickbranchname"> for</h4>
<ul>
Expand Down

0 comments on commit 7b5e3cd

Please sign in to comment.