View | Details | Raw Unified | Return to bug 24718
Collapse All | Expand All

(-)a/C4/HoldsQueue.pm (-2 / +2 lines)
Lines 239-245 sub GetBibsWithPendingHoldRequests { Link Here
239
                     FROM reserves
239
                     FROM reserves
240
                     WHERE found IS NULL
240
                     WHERE found IS NULL
241
                     AND priority > 0
241
                     AND priority > 0
242
                     AND reservedate <= CURRENT_DATE()
242
                     AND reservedate <= CURRENT_TIMESTAMP()
243
                     AND suspend = 0
243
                     AND suspend = 0
244
                     ";
244
                     ";
245
    my $sth = $dbh->prepare($bib_query);
245
    my $sth = $dbh->prepare($bib_query);
Lines 283-289 sub GetPendingHoldRequestsForBib { Link Here
283
                         WHERE biblionumber = ?
283
                         WHERE biblionumber = ?
284
                         AND found IS NULL
284
                         AND found IS NULL
285
                         AND priority > 0
285
                         AND priority > 0
286
                         AND reservedate <= CURRENT_DATE()
286
                         AND reservedate <= CURRENT_TIMESTAMP()
287
                         AND suspend = 0
287
                         AND suspend = 0
288
                         ORDER BY priority";
288
                         ORDER BY priority";
289
    my $sth = $dbh->prepare($request_query);
289
    my $sth = $dbh->prepare($request_query);
(-)a/C4/Reserves.pm (-2 / +6 lines)
Lines 435-443 sub CanItemBeReserved { Link Here
435
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
435
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
436
    }
436
    }
437
437
438
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
439
    my $fromdate = dt_from_string->set({ hour => 00, minute => 00, second => 00 });
440
    my $todate = dt_from_string->set({ hour => 23, minute => 59, second => 59 });
441
438
    my $today_holds = Koha::Holds->search({
442
    my $today_holds = Koha::Holds->search({
439
        borrowernumber => $borrowernumber,
443
        borrowernumber => $borrowernumber,
440
        reservedate    => dt_from_string->date
444
        reservedate    => [ -and => { '>=' => $dtf->format_datetime($fromdate) }, { '<=' => $dtf->format_datetime($todate) } ]
441
    });
445
    });
442
446
443
    if (   defined $holds_per_day && $holds_per_day ne ''
447
    if (   defined $holds_per_day && $holds_per_day ne ''
Lines 900-906 sub CancelExpiredReserves { Link Here
900
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
904
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
901
905
902
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
906
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
903
    my $params = { expirationdate => { '<', $today } };
907
    my $params = { expirationdate => { '<', $dtf->format_datetime($today) } };
904
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
908
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
905
909
906
    # FIXME To move to Koha::Holds->search_expired (?)
910
    # FIXME To move to Koha::Holds->search_expired (?)
(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 394-400 sub current_holds { Link Here
394
        itemnumber => $self->itemnumber,
394
        itemnumber => $self->itemnumber,
395
        suspend => 0,
395
        suspend => 0,
396
        -or => [
396
        -or => [
397
            reservedate => { '<=' => $dtf->format_date(dt_from_string) },
397
            reservedate => { '<=' => $dtf->format_datetime(dt_from_string) },
398
            waitingdate => { '!=' => undef },
398
            waitingdate => { '!=' => undef },
399
        ],
399
        ],
400
    };
400
    };
(-)a/t/db_dependent/Holds.t (-3 / +2 lines)
Lines 101-107 my $reservedate = $first_hold->reservedate; Link Here
101
my $borrowernumber = $first_hold->borrowernumber;
101
my $borrowernumber = $first_hold->borrowernumber;
102
my $branch_1code = $first_hold->branchcode;
102
my $branch_1code = $first_hold->branchcode;
103
my $reserve_id = $first_hold->reserve_id;
103
my $reserve_id = $first_hold->reserve_id;
104
is( $reservedate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), "holds_placed_today should return a valid reserve date");
104
is( dt_from_string( $reservedate ), dt_from_string, "holds_placed_today should return a valid reserve date");
105
is( $borrowernumber, $borrowernumbers[0], "holds_placed_today should return a valid borrowernumber");
105
is( $borrowernumber, $borrowernumbers[0], "holds_placed_today should return a valid borrowernumber");
106
is( $branch_1code, $branch_1, "holds_placed_today should return a valid branchcode");
106
is( $branch_1code, $branch_1, "holds_placed_today should return a valid branchcode");
107
ok($reserve_id, "Test holds_placed_today()");
107
ok($reserve_id, "Test holds_placed_today()");
Lines 711-717 subtest 'CanItemBeReserved / holds_per_day tests' => sub { Link Here
711
    is_deeply(
711
    is_deeply(
712
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
712
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
713
        { status => 'tooManyReservesToday', limit => 2 },
713
        { status => 'tooManyReservesToday', limit => 2 },
714
        'Patron cannot a third item with 2 reserves daily cap'
714
        'Patron cannot reserve a third item with 2 reserves daily cap'
715
    );
715
    );
716
716
717
    # Update last hold so reservedate is in the past, so 2 holds, but different day
717
    # Update last hold so reservedate is in the past, so 2 holds, but different day
718
- 

Return to bug 24718