|
Lines 133-140
BEGIN {
Link Here
|
| 133 |
ToggleSuspend |
133 |
ToggleSuspend |
| 134 |
SuspendAll |
134 |
SuspendAll |
| 135 |
|
135 |
|
| 136 |
GetReservesControlBranch |
|
|
| 137 |
|
| 138 |
CalculatePriority |
136 |
CalculatePriority |
| 139 |
|
137 |
|
| 140 |
IsItemOnHoldAndFound |
138 |
IsItemOnHoldAndFound |
|
Lines 923-929
sub CheckReserves {
Link Here
|
| 923 |
next if $res->{item_group_id} && ( !$item->item_group || $item->item_group->id != $res->{item_group_id} ); |
921 |
next if $res->{item_group_id} && ( !$item->item_group || $item->item_group->id != $res->{item_group_id} ); |
| 924 |
next if $res->{itemtype} && $res->{itemtype} ne $item->effective_itemtype; |
922 |
next if $res->{itemtype} && $res->{itemtype} ne $item->effective_itemtype; |
| 925 |
$patron //= Koha::Patrons->find( $res->{borrowernumber} ); |
923 |
$patron //= Koha::Patrons->find( $res->{borrowernumber} ); |
| 926 |
my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed ); |
924 |
my $branch = $item->holds_control_library( $patron ); |
| 927 |
my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); |
925 |
my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); |
| 928 |
next if ($branchitemrule->{'holdallowed'} eq 'not_allowed'); |
926 |
next if ($branchitemrule->{'holdallowed'} eq 'not_allowed'); |
| 929 |
next if (($branchitemrule->{'holdallowed'} eq 'from_home_library') && ($item->homebranch ne $patron->branchcode)); |
927 |
next if (($branchitemrule->{'holdallowed'} eq 'from_home_library') && ($item->homebranch ne $patron->branchcode)); |
|
Lines 1346-1353
sub IsAvailableForItemLevelRequest {
Link Here
|
| 1346 |
return 0 unless $destination; |
1344 |
return 0 unless $destination; |
| 1347 |
return 0 unless $destination->pickup_location; |
1345 |
return 0 unless $destination->pickup_location; |
| 1348 |
return 0 unless $item->can_be_transferred( { to => $destination } ); |
1346 |
return 0 unless $item->can_be_transferred( { to => $destination } ); |
| 1349 |
my $reserves_control_branch = |
1347 |
my $reserves_control_branch = $item->holds_control_library( $patron ); |
| 1350 |
GetReservesControlBranch( $item->unblessed(), $patron->unblessed() ); |
|
|
| 1351 |
my $branchitemrule = |
1348 |
my $branchitemrule = |
| 1352 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); |
1349 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); |
| 1353 |
my $home_library = Koha::Libraries->find( {branchcode => $item->homebranch} ); |
1350 |
my $home_library = Koha::Libraries->find( {branchcode => $item->homebranch} ); |
|
Lines 1389-1396
sub ItemsAnyAvailableAndNotRestricted {
Link Here
|
| 1389 |
my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } )->as_list; |
1386 |
my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } )->as_list; |
| 1390 |
|
1387 |
|
| 1391 |
foreach my $i (@items) { |
1388 |
foreach my $i (@items) { |
| 1392 |
my $reserves_control_branch = |
1389 |
my $reserves_control_branch = $i->holds_control_library( $param->{patron} ); |
| 1393 |
GetReservesControlBranch( $i->unblessed(), $param->{patron}->unblessed ); |
|
|
| 1394 |
my $branchitemrule = |
1390 |
my $branchitemrule = |
| 1395 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype ); |
1391 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype ); |
| 1396 |
my $item_library = Koha::Libraries->find( { branchcode => $i->homebranch } ); |
1392 |
my $item_library = Koha::Libraries->find( { branchcode => $i->homebranch } ); |
|
Lines 2206-2237
sub ReserveSlip {
Link Here
|
| 2206 |
); |
2202 |
); |
| 2207 |
} |
2203 |
} |
| 2208 |
|
2204 |
|
| 2209 |
=head2 GetReservesControlBranch |
|
|
| 2210 |
|
| 2211 |
my $reserves_control_branch = GetReservesControlBranch($item, $borrower); |
| 2212 |
|
| 2213 |
Return the branchcode to be used to determine which reserves |
| 2214 |
policy applies to a transaction. |
| 2215 |
|
| 2216 |
C<$item> is a hashref for an item. Only 'homebranch' is used. |
| 2217 |
|
| 2218 |
C<$borrower> is a hashref to borrower. Only 'branchcode' is used. |
| 2219 |
|
| 2220 |
=cut |
| 2221 |
|
| 2222 |
sub GetReservesControlBranch { |
| 2223 |
my ( $item, $borrower ) = @_; |
| 2224 |
|
| 2225 |
my $reserves_control = C4::Context->preference('ReservesControlBranch'); |
| 2226 |
|
| 2227 |
my $branchcode = |
| 2228 |
( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'} |
| 2229 |
: ( $reserves_control eq 'PatronLibrary' ) ? $borrower->{'branchcode'} |
| 2230 |
: undef; |
| 2231 |
|
| 2232 |
return $branchcode; |
| 2233 |
} |
| 2234 |
|
| 2235 |
=head2 CalculatePriority |
2205 |
=head2 CalculatePriority |
| 2236 |
|
2206 |
|
| 2237 |
my $p = CalculatePriority($biblionumber, $resdate); |
2207 |
my $p = CalculatePriority($biblionumber, $resdate); |