Lines 525-542
sub CanItemBeReserved {
Link Here
|
525 |
my $branchitemrule = |
525 |
my $branchitemrule = |
526 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); # FIXME Should not be item->effective_itemtype? |
526 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); # FIXME Should not be item->effective_itemtype? |
527 |
|
527 |
|
528 |
if ( $branchitemrule->{holdallowed} == 0 ) { |
528 |
if ( $branchitemrule->{holdallowed} eq 'not_allowed' ) { |
529 |
return { status => 'notReservable' }; |
529 |
return { status => 'notReservable' }; |
530 |
} |
530 |
} |
531 |
|
531 |
|
532 |
if ( $branchitemrule->{holdallowed} == 1 |
532 |
if ( $branchitemrule->{holdallowed} eq 'from_home_library' |
533 |
&& $borrower->{branchcode} ne $item->homebranch ) |
533 |
&& $borrower->{branchcode} ne $item->homebranch ) |
534 |
{ |
534 |
{ |
535 |
return { status => 'cannotReserveFromOtherBranches' }; |
535 |
return { status => 'cannotReserveFromOtherBranches' }; |
536 |
} |
536 |
} |
537 |
|
537 |
|
538 |
my $item_library = Koha::Libraries->find( {branchcode => $item->homebranch} ); |
538 |
my $item_library = Koha::Libraries->find( {branchcode => $item->homebranch} ); |
539 |
if ( $branchitemrule->{holdallowed} == 3) { |
539 |
if ( $branchitemrule->{holdallowed} eq 'from_local_hold_group') { |
540 |
if($borrower->{branchcode} ne $item->homebranch && !$item_library->validate_hold_sibling( {branchcode => $borrower->{branchcode}} )) { |
540 |
if($borrower->{branchcode} ne $item->homebranch && !$item_library->validate_hold_sibling( {branchcode => $borrower->{branchcode}} )) { |
541 |
return { status => 'branchNotInHoldGroup' }; |
541 |
return { status => 'branchNotInHoldGroup' }; |
542 |
} |
542 |
} |
Lines 890-899
sub CheckReserves {
Link Here
|
890 |
$patron ||= Koha::Patrons->find( $res->{borrowernumber} ); |
890 |
$patron ||= Koha::Patrons->find( $res->{borrowernumber} ); |
891 |
my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed ); |
891 |
my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed ); |
892 |
my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); |
892 |
my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); |
893 |
next if ($branchitemrule->{'holdallowed'} == 0); |
893 |
next if ($branchitemrule->{'holdallowed'} eq 'not_allowed'); |
894 |
next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode)); |
894 |
next if (($branchitemrule->{'holdallowed'} eq 'from_home_library') && ($branch ne $patron->branchcode)); |
895 |
my $library = Koha::Libraries->find({branchcode=>$item->homebranch}); |
895 |
my $library = Koha::Libraries->find({branchcode=>$item->homebranch}); |
896 |
next if (($branchitemrule->{'holdallowed'} == 3) && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) )); |
896 |
next if (($branchitemrule->{'holdallowed'} eq 'from_local_hold_group') && (!$library->validate_hold_sibling({branchcode => $patron->branchcode}) )); |
897 |
my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy}; |
897 |
my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy}; |
898 |
next if ( ($hold_fulfillment_policy eq 'holdgroup') && (!$library->validate_hold_sibling({branchcode => $res->{branchcode}})) ); |
898 |
next if ( ($hold_fulfillment_policy eq 'holdgroup') && (!$library->validate_hold_sibling({branchcode => $res->{branchcode}})) ); |
899 |
next if ( ($hold_fulfillment_policy eq 'homebranch') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) ); |
899 |
next if ( ($hold_fulfillment_policy eq 'homebranch') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) ); |
Lines 1395-1402
sub ItemsAnyAvailableAndNotRestricted {
Link Here
|
1395 |
|| ( $i->damaged |
1395 |
|| ( $i->damaged |
1396 |
&& ! C4::Context->preference('AllowHoldsOnDamagedItems') ) |
1396 |
&& ! C4::Context->preference('AllowHoldsOnDamagedItems') ) |
1397 |
|| Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan |
1397 |
|| Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan |
1398 |
|| $branchitemrule->{holdallowed} == 1 && $param->{patron}->branchcode ne $i->homebranch |
1398 |
|| $branchitemrule->{holdallowed} eq 'from_home_library' && $param->{patron}->branchcode ne $i->homebranch |
1399 |
|| $branchitemrule->{holdallowed} == 3 && ! $item_library->validate_hold_sibling( { branchcode => $param->{patron}->branchcode } ) |
1399 |
|| $branchitemrule->{holdallowed} eq 'from_local_hold_group' && ! $item_library->validate_hold_sibling( { branchcode => $param->{patron}->branchcode } ) |
1400 |
|| CanItemBeReserved( $param->{patron}->borrowernumber, $i->id )->{status} ne 'OK'; |
1400 |
|| CanItemBeReserved( $param->{patron}->borrowernumber, $i->id )->{status} ne 'OK'; |
1401 |
} |
1401 |
} |
1402 |
|
1402 |
|