|
Lines 134-141
BEGIN {
Link Here
|
| 134 |
ToggleSuspend |
134 |
ToggleSuspend |
| 135 |
SuspendAll |
135 |
SuspendAll |
| 136 |
|
136 |
|
| 137 |
GetReservesControlBranch |
|
|
| 138 |
|
| 139 |
CalculatePriority |
137 |
CalculatePriority |
| 140 |
|
138 |
|
| 141 |
IsItemOnHoldAndFound |
139 |
IsItemOnHoldAndFound |
|
Lines 939-945
sub CheckReserves {
Link Here
|
| 939 |
next if $res->{item_group_id} && ( !$item->item_group || $item->item_group->id != $res->{item_group_id} ); |
937 |
next if $res->{item_group_id} && ( !$item->item_group || $item->item_group->id != $res->{item_group_id} ); |
| 940 |
next if $res->{itemtype} && $res->{itemtype} ne $item->effective_itemtype; |
938 |
next if $res->{itemtype} && $res->{itemtype} ne $item->effective_itemtype; |
| 941 |
$patron //= Koha::Patrons->find( $res->{borrowernumber} ); |
939 |
$patron //= Koha::Patrons->find( $res->{borrowernumber} ); |
| 942 |
my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed ); |
940 |
my $branch = $item->holds_control_library( $patron ); |
| 943 |
my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); |
941 |
my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); |
| 944 |
next if ($branchitemrule->{'holdallowed'} eq 'not_allowed'); |
942 |
next if ($branchitemrule->{'holdallowed'} eq 'not_allowed'); |
| 945 |
next if (($branchitemrule->{'holdallowed'} eq 'from_home_library') && ($item->homebranch ne $patron->branchcode)); |
943 |
next if (($branchitemrule->{'holdallowed'} eq 'from_home_library') && ($item->homebranch ne $patron->branchcode)); |
|
Lines 1359-1366
sub IsAvailableForItemLevelRequest {
Link Here
|
| 1359 |
return 0 unless $destination; |
1357 |
return 0 unless $destination; |
| 1360 |
return 0 unless $destination->pickup_location; |
1358 |
return 0 unless $destination->pickup_location; |
| 1361 |
return 0 unless $item->can_be_transferred( { to => $destination } ); |
1359 |
return 0 unless $item->can_be_transferred( { to => $destination } ); |
| 1362 |
my $reserves_control_branch = |
1360 |
my $reserves_control_branch = $item->holds_control_library( $patron ); |
| 1363 |
GetReservesControlBranch( $item->unblessed(), $patron->unblessed() ); |
|
|
| 1364 |
my $branchitemrule = |
1361 |
my $branchitemrule = |
| 1365 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); |
1362 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); |
| 1366 |
my $home_library = Koha::Libraries->find( {branchcode => $item->homebranch} ); |
1363 |
my $home_library = Koha::Libraries->find( {branchcode => $item->homebranch} ); |
|
Lines 1409-1416
sub ItemsAnyAvailableAndNotRestricted {
Link Here
|
| 1409 |
my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } )->as_list; |
1406 |
my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } )->as_list; |
| 1410 |
|
1407 |
|
| 1411 |
foreach my $i (@items) { |
1408 |
foreach my $i (@items) { |
| 1412 |
my $reserves_control_branch = |
1409 |
my $reserves_control_branch = $i->holds_control_library( $param->{patron} ); |
| 1413 |
GetReservesControlBranch( $i->unblessed(), $param->{patron}->unblessed ); |
|
|
| 1414 |
my $branchitemrule = |
1410 |
my $branchitemrule = |
| 1415 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype ); |
1411 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype ); |
| 1416 |
my $item_library = Koha::Libraries->find( { branchcode => $i->homebranch } ); |
1412 |
my $item_library = Koha::Libraries->find( { branchcode => $i->homebranch } ); |
|
Lines 2185-2216
sub ReserveSlip {
Link Here
|
| 2185 |
); |
2181 |
); |
| 2186 |
} |
2182 |
} |
| 2187 |
|
2183 |
|
| 2188 |
=head2 GetReservesControlBranch |
|
|
| 2189 |
|
| 2190 |
my $reserves_control_branch = GetReservesControlBranch($item, $borrower); |
| 2191 |
|
| 2192 |
Return the branchcode to be used to determine which reserves |
| 2193 |
policy applies to a transaction. |
| 2194 |
|
| 2195 |
C<$item> is a hashref for an item. Only 'homebranch' is used. |
| 2196 |
|
| 2197 |
C<$borrower> is a hashref to borrower. Only 'branchcode' is used. |
| 2198 |
|
| 2199 |
=cut |
| 2200 |
|
| 2201 |
sub GetReservesControlBranch { |
| 2202 |
my ( $item, $borrower ) = @_; |
| 2203 |
|
| 2204 |
my $reserves_control = C4::Context->preference('ReservesControlBranch'); |
| 2205 |
|
| 2206 |
my $branchcode = |
| 2207 |
( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'} |
| 2208 |
: ( $reserves_control eq 'PatronLibrary' ) ? $borrower->{'branchcode'} |
| 2209 |
: undef; |
| 2210 |
|
| 2211 |
return $branchcode; |
| 2212 |
} |
| 2213 |
|
| 2214 |
=head2 CalculatePriority |
2184 |
=head2 CalculatePriority |
| 2215 |
|
2185 |
|
| 2216 |
my $p = CalculatePriority($biblionumber, $resdate); |
2186 |
my $p = CalculatePriority($biblionumber, $resdate); |