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 922-928
sub CheckReserves {
Link Here
|
922 |
$item ||= Koha::Items->find($itemnumber); |
920 |
$item ||= Koha::Items->find($itemnumber); |
923 |
next if $res->{itemtype} && $res->{itemtype} ne $item->effective_itemtype; |
921 |
next if $res->{itemtype} && $res->{itemtype} ne $item->effective_itemtype; |
924 |
$patron ||= Koha::Patrons->find( $res->{borrowernumber} ); |
922 |
$patron ||= Koha::Patrons->find( $res->{borrowernumber} ); |
925 |
my $branch = GetReservesControlBranch( $item->unblessed, $patron->unblessed ); |
923 |
my $branch = $item->holds_control_library( $patron ); |
926 |
my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); |
924 |
my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); |
927 |
next if ($branchitemrule->{'holdallowed'} eq 'not_allowed'); |
925 |
next if ($branchitemrule->{'holdallowed'} eq 'not_allowed'); |
928 |
next if (($branchitemrule->{'holdallowed'} eq 'from_home_library') && ($item->homebranch ne $patron->branchcode)); |
926 |
next if (($branchitemrule->{'holdallowed'} eq 'from_home_library') && ($item->homebranch ne $patron->branchcode)); |
Lines 1343-1350
sub IsAvailableForItemLevelRequest {
Link Here
|
1343 |
return 0 unless $destination; |
1341 |
return 0 unless $destination; |
1344 |
return 0 unless $destination->pickup_location; |
1342 |
return 0 unless $destination->pickup_location; |
1345 |
return 0 unless $item->can_be_transferred( { to => $destination } ); |
1343 |
return 0 unless $item->can_be_transferred( { to => $destination } ); |
1346 |
my $reserves_control_branch = |
1344 |
my $reserves_control_branch = $item->holds_control_library( $patron ); |
1347 |
GetReservesControlBranch( $item->unblessed(), $patron->unblessed() ); |
|
|
1348 |
my $branchitemrule = |
1345 |
my $branchitemrule = |
1349 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); |
1346 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->itype ); |
1350 |
my $home_library = Koha::Libraries->find( {branchcode => $item->homebranch} ); |
1347 |
my $home_library = Koha::Libraries->find( {branchcode => $item->homebranch} ); |
Lines 1386-1393
sub ItemsAnyAvailableAndNotRestricted {
Link Here
|
1386 |
my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } )->as_list; |
1383 |
my @items = Koha::Items->search( { biblionumber => $param->{biblionumber} } )->as_list; |
1387 |
|
1384 |
|
1388 |
foreach my $i (@items) { |
1385 |
foreach my $i (@items) { |
1389 |
my $reserves_control_branch = |
1386 |
my $reserves_control_branch = $i->holds_control_library( $param->{patron} ); |
1390 |
GetReservesControlBranch( $i->unblessed(), $param->{patron}->unblessed ); |
|
|
1391 |
my $branchitemrule = |
1387 |
my $branchitemrule = |
1392 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype ); |
1388 |
C4::Circulation::GetBranchItemRule( $reserves_control_branch, $i->itype ); |
1393 |
my $item_library = Koha::Libraries->find( { branchcode => $i->homebranch } ); |
1389 |
my $item_library = Koha::Libraries->find( { branchcode => $i->homebranch } ); |
Lines 2158-2189
sub ReserveSlip {
Link Here
|
2158 |
); |
2154 |
); |
2159 |
} |
2155 |
} |
2160 |
|
2156 |
|
2161 |
=head2 GetReservesControlBranch |
|
|
2162 |
|
2163 |
my $reserves_control_branch = GetReservesControlBranch($item, $borrower); |
2164 |
|
2165 |
Return the branchcode to be used to determine which reserves |
2166 |
policy applies to a transaction. |
2167 |
|
2168 |
C<$item> is a hashref for an item. Only 'homebranch' is used. |
2169 |
|
2170 |
C<$borrower> is a hashref to borrower. Only 'branchcode' is used. |
2171 |
|
2172 |
=cut |
2173 |
|
2174 |
sub GetReservesControlBranch { |
2175 |
my ( $item, $borrower ) = @_; |
2176 |
|
2177 |
my $reserves_control = C4::Context->preference('ReservesControlBranch'); |
2178 |
|
2179 |
my $branchcode = |
2180 |
( $reserves_control eq 'ItemHomeLibrary' ) ? $item->{'homebranch'} |
2181 |
: ( $reserves_control eq 'PatronLibrary' ) ? $borrower->{'branchcode'} |
2182 |
: undef; |
2183 |
|
2184 |
return $branchcode; |
2185 |
} |
2186 |
|
2187 |
=head2 CalculatePriority |
2157 |
=head2 CalculatePriority |
2188 |
|
2158 |
|
2189 |
my $p = CalculatePriority($biblionumber, $resdate); |
2159 |
my $p = CalculatePriority($biblionumber, $resdate); |