[Koha-bugs] [Bug 18958] If patron has multiple record level holds on one record transferring first hold causes next hold to become item level

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Aug 14 10:57:29 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18958

--- Comment #46 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
This is so horrible. Just checking occurrences of CheckReserves calls. Here we
are in Circulation::CanBookBeRenewed.
First we call CheckReserves, but then note the $itemholds=search call and
repeated calls to CheckReserves in the while(1)..

    my ( $resfound, $resrec, undef ) =
C4::Reserves::CheckReserves($itemnumber);

    # This item can fill one or more unfilled reserve, can those unfilled
reserves
    # all be filled by other available items?
    if ( $resfound
        && C4::Context->preference('AllowRenewalIfOtherItemsAvailable') )
    {
        my $schema = Koha::Database->new()->schema();

        my $item_holds = $schema->resultset('Reserve')->search( { itemnumber =>
$itemnumber, found => undef } )->count();
        if ($item_holds) {
            # There is an item level hold on this item, no other item can fill
the hold
            $resfound = 1;
        }
        else {

            # Get all other items that could possibly fill reserves
            my @itemnumbers = $schema->resultset('Item')->search(
                {
                    biblionumber => $resrec->{biblionumber},
                    onloan       => undef,
                    notforloan   => 0,
                    -not         => { itemnumber => $itemnumber }
                },
                { columns => 'itemnumber' }
            )->get_column('itemnumber')->all();

            # Get all other reserves that could have been filled by this item
            my @borrowernumbers;
            while (1) {
                my ( $reserve_found, $reserve, undef ) =
                  C4::Reserves::CheckReserves( $itemnumber, undef, undef,
\@borrowernumbers );

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list