Lines 26-32
use C4::Circulation;
Link Here
|
26 |
use C4::Branch; |
26 |
use C4::Branch; |
27 |
use C4::Accounts; |
27 |
use C4::Accounts; |
28 |
use C4::Biblio; |
28 |
use C4::Biblio; |
29 |
use C4::Reserves qw(AddReserve CancelReserve GetReservesFromBiblionumber GetReservesFromBorrowernumber CanBookBeReserved CanItemBeReserved); |
29 |
use C4::Reserves qw(AddReserve CancelReserve GetReservesFromBiblionumber GetReservesFromBorrowernumber CanBookBeReserved CanItemBeReserved GetReserveNextRank); |
30 |
use C4::Context; |
30 |
use C4::Context; |
31 |
use C4::AuthoritiesMarc; |
31 |
use C4::AuthoritiesMarc; |
32 |
use C4::ILSDI::Utility; |
32 |
use C4::ILSDI::Utility; |
Lines 576-593
sub RenewLoan {
Link Here
|
576 |
return $out; |
576 |
return $out; |
577 |
} |
577 |
} |
578 |
|
578 |
|
579 |
sub _get_reserve_next_rank { |
|
|
580 |
my ($biblionumber) = @_; |
581 |
|
582 |
my ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1); |
583 |
foreach my $res (@$reserves) { |
584 |
$count-- if (defined $res->{found} and $res->{found} eq 'W'); |
585 |
} |
586 |
my $rank = $count + 1; |
587 |
|
588 |
return $rank; |
589 |
} |
590 |
|
591 |
=head2 HoldTitle |
579 |
=head2 HoldTitle |
592 |
|
580 |
|
593 |
Creates, for a borrower, a biblio-level hold reserve. |
581 |
Creates, for a borrower, a biblio-level hold reserve. |
Lines 638-644
sub HoldTitle {
Link Here
|
638 |
$branch = $$borrower{branchcode}; |
626 |
$branch = $$borrower{branchcode}; |
639 |
} |
627 |
} |
640 |
|
628 |
|
641 |
my $rank = _get_reserve_next_rank($biblionumber); |
629 |
my $rank = GetReserveNextRank($biblionumber); |
642 |
|
630 |
|
643 |
# Add the reserve |
631 |
# Add the reserve |
644 |
# $branch, $borrowernumber, $biblionumber, $constraint, $bibitems, $priority, $notes, $title, $checkitem, $found |
632 |
# $branch, $borrowernumber, $biblionumber, $constraint, $bibitems, $priority, $notes, $title, $checkitem, $found |
Lines 715-727
sub HoldItem {
Link Here
|
715 |
$branch = $$borrower{branchcode}; |
703 |
$branch = $$borrower{branchcode}; |
716 |
} |
704 |
} |
717 |
|
705 |
|
718 |
my $rank = _get_reserve_next_rank($biblionumber); |
706 |
my $rank; |
719 |
my $found; |
707 |
my $found; |
720 |
|
708 |
|
721 |
# Get rank and found |
709 |
# Get rank and found |
722 |
$rank = '0' unless C4::Context->preference('ReservesNeedReturns'); |
710 |
if (C4::Context->preference('ReservesNeedReturns')) { |
723 |
if ( $item->{'holdingbranch'} eq $branch ) { |
711 |
$rank = GetReserveNextRank($biblionumber); |
724 |
$found = 'W' unless C4::Context->preference('ReservesNeedReturns'); |
712 |
} else { |
|
|
713 |
$rank = '0'; |
714 |
if ($item->{'holdingbranch'} eq $branch) { |
715 |
$found = 'W'; |
716 |
} |
725 |
} |
717 |
} |
726 |
|
718 |
|
727 |
# Add the reserve |
719 |
# Add the reserve |