Skip to content

Commit

Permalink
PT 7449415 issuing rule logic tweak
Browse files Browse the repository at this point in the history
no hold per issuing rule
  • Loading branch information
hgq authored and pjones9 committed Dec 28, 2010
1 parent 13d2e7f commit 964597d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
21 changes: 13 additions & 8 deletions C4/Reserves.pm
Expand Up @@ -1016,7 +1016,6 @@ sub CheckReserves {

# Find this item in the reserves
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber );
my $count = scalar @reserves;

# $priority and $highest are used to find the most important item
# in the list returned by &_Findgroupreserve. (The lower $priority,
Expand All @@ -1026,14 +1025,19 @@ sub CheckReserves {
my $exact;
my $local;
my $oldest;

if ($count) {

my $count = @reserves;
my $nohold = 0;
if (@reserves) {
my $priority = 10000000;
foreach my $res (@reserves) {
my $issuingrule = C4::Circulation::GetIssuingRule ($res->{'borrowercategory'},$itemtype,$itembranch);
next unless $issuingrule;
if ($issuingrule -> {'holdallowed'} == 0 ||
($issuingrule->{'holdallowed'} == 1 && $itembranch ne $res->{'borrowerbranch'})){
my $issuingrule = C4::Circulation::GetIssuingRule ($$res{borrowercategory},$itemtype,$itembranch);
unless ($issuingrule) {
next;
}
if (!$issuingrule ->{'holdallowed'} ||
($issuingrule->{'holdallowed'} && ($itembranch ne $res->{'borrowerbranch'})) ){
$nohold++;
next;
}
# FIXME - $item might be undefined or empty: the caller
Expand Down Expand Up @@ -1071,7 +1075,8 @@ sub CheckReserves {
)
);
}


if ($nohold==$count) { return (0,0,0) }
if ( $oldest ) {
return( 'Reserved', $oldest, $count );
} elsif ( $local ) {
Expand Down
13 changes: 8 additions & 5 deletions reserve/request.pl
Expand Up @@ -477,17 +477,20 @@ =head1 request.pl

my $issuingrule = GetIssuingRule( $borrowerinfo->{'categorycode'}, $item->{'itype'}, $item->{'homebranch'} );
my $policy_holdallowed = 1;

$item->{'holdallowed'} = $issuingrule->{'holdallowed'};

if ( ! exists $issuingrule->{'holdallowed'} ||
$issuingrule->{'holdallowed'} == 0 ||
( $issuingrule->{'holdallowed'} == 1 && defined($borrowerinfo) && $borrowerinfo->{'branchcode'} ne $item->{'homebranch'} ) ) {
if (!$issuingrule->{'holdallowed'} ||
(
($borrowerinfo->{'branchcode'} ne $item->{'homebranch'} )
&& ($issuingrule->{'branchcode'} eq '*')
&& $issuingrule->{holdallowed}
)
) {
$policy_holdallowed = 0;
}

if (IsAvailableForItemLevelRequest($itemnumber) and not $item->{cantreserve}) {
if ( not $policy_holdallowed ) {
if (!$policy_holdallowed ) {
if ( C4::Context->preference( 'AllowHoldPolicyOverride' ) ) {
$item->{override} = 1;
$num_override++;
Expand Down

0 comments on commit 964597d

Please sign in to comment.