|
Lines 265-271
sub AddReserve {
Link Here
|
| 265 |
|
265 |
|
| 266 |
=head2 CanBookBeReserved |
266 |
=head2 CanBookBeReserved |
| 267 |
|
267 |
|
| 268 |
$canReserve = &CanBookBeReserved($borrowernumber, $biblionumber) |
268 |
$canReserve = &CanBookBeReserved($borrowernumber, $biblionumber, $branchcode) |
| 269 |
if ($canReserve eq 'OK') { #We can reserve this Item! } |
269 |
if ($canReserve eq 'OK') { #We can reserve this Item! } |
| 270 |
|
270 |
|
| 271 |
See CanItemBeReserved() for possible return values. |
271 |
See CanItemBeReserved() for possible return values. |
|
Lines 273-279
See CanItemBeReserved() for possible return values.
Link Here
|
| 273 |
=cut |
273 |
=cut |
| 274 |
|
274 |
|
| 275 |
sub CanBookBeReserved{ |
275 |
sub CanBookBeReserved{ |
| 276 |
my ($borrowernumber, $biblionumber) = @_; |
276 |
my ($borrowernumber, $biblionumber, $branchcode) = @_; |
| 277 |
|
277 |
|
| 278 |
my $items = GetItemnumbersForBiblio($biblionumber); |
278 |
my $items = GetItemnumbersForBiblio($biblionumber); |
| 279 |
#get items linked via host records |
279 |
#get items linked via host records |
|
Lines 284-290
sub CanBookBeReserved{
Link Here
|
| 284 |
|
284 |
|
| 285 |
my $canReserve; |
285 |
my $canReserve; |
| 286 |
foreach my $item (@$items) { |
286 |
foreach my $item (@$items) { |
| 287 |
$canReserve = CanItemBeReserved( $borrowernumber, $item ); |
287 |
$canReserve = CanItemBeReserved( $borrowernumber, $item, $branchcode ); |
| 288 |
return 'OK' if $canReserve eq 'OK'; |
288 |
return 'OK' if $canReserve eq 'OK'; |
| 289 |
} |
289 |
} |
| 290 |
return $canReserve; |
290 |
return $canReserve; |
|
Lines 292-298
sub CanBookBeReserved{
Link Here
|
| 292 |
|
292 |
|
| 293 |
=head2 CanItemBeReserved |
293 |
=head2 CanItemBeReserved |
| 294 |
|
294 |
|
| 295 |
$canReserve = &CanItemBeReserved($borrowernumber, $itemnumber) |
295 |
$canReserve = &CanItemBeReserved($borrowernumber, $itemnumber, $branchcode) |
| 296 |
if ($canReserve eq 'OK') { #We can reserve this Item! } |
296 |
if ($canReserve eq 'OK') { #We can reserve this Item! } |
| 297 |
|
297 |
|
| 298 |
@RETURNS OK, if the Item can be reserved. |
298 |
@RETURNS OK, if the Item can be reserved. |
|
Lines 301-311
sub CanBookBeReserved{
Link Here
|
| 301 |
cannotReserveFromOtherBranches, if syspref 'canreservefromotherbranches' is OK. |
301 |
cannotReserveFromOtherBranches, if syspref 'canreservefromotherbranches' is OK. |
| 302 |
tooManyReserves, if the borrower has exceeded his maximum reserve amount. |
302 |
tooManyReserves, if the borrower has exceeded his maximum reserve amount. |
| 303 |
notReservable, if holds on this item are not allowed |
303 |
notReservable, if holds on this item are not allowed |
|
|
304 |
libraryNotFound if given branchcode is not an existing library |
| 305 |
libraryNotPickupLocation if given branchcode is not configured to be a pickup location |
| 304 |
|
306 |
|
| 305 |
=cut |
307 |
=cut |
| 306 |
|
308 |
|
| 307 |
sub CanItemBeReserved { |
309 |
sub CanItemBeReserved { |
| 308 |
my ( $borrowernumber, $itemnumber ) = @_; |
310 |
my ( $borrowernumber, $itemnumber, $branchcode_to ) = @_; |
| 309 |
|
311 |
|
| 310 |
my $dbh = C4::Context->dbh; |
312 |
my $dbh = C4::Context->dbh; |
| 311 |
my $ruleitemtype; # itemtype of the matching issuing rule |
313 |
my $ruleitemtype; # itemtype of the matching issuing rule |
|
Lines 435-440
sub CanItemBeReserved {
Link Here
|
| 435 |
} |
437 |
} |
| 436 |
} |
438 |
} |
| 437 |
|
439 |
|
|
|
440 |
if ($branchcode_to) { |
| 441 |
my $destination = Koha::Libraries->find({ |
| 442 |
branchcode => $branchcode_to, |
| 443 |
}); |
| 444 |
unless ($destination) { |
| 445 |
return 'libraryNotFound'; |
| 446 |
} |
| 447 |
unless ($destination->pickup_location) { |
| 448 |
return 'libraryNotPickupLocation'; |
| 449 |
} |
| 450 |
} |
| 451 |
|
| 438 |
return 'OK'; |
452 |
return 'OK'; |
| 439 |
} |
453 |
} |
| 440 |
|
454 |
|