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 436-444 sub CanItemBeReserved { Link Here
436
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
436
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
437
    }
437
    }
438
438
439
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
440
    my $fromdate = dt_from_string->set({ hour => 00, minute => 00, second => 00 });
441
    my $todate = dt_from_string->set({ hour => 23, minute => 59, second => 59 });
442
439
    my $today_holds = Koha::Holds->search({
443
    my $today_holds = Koha::Holds->search({
440
        borrowernumber => $borrowernumber,
444
        borrowernumber => $borrowernumber,
441
        reservedate    => dt_from_string->date
445
        reservedate    => [ -and => { '>=' => $dtf->format_datetime($fromdate) }, { '<=' => $dtf->format_datetime($todate) } ]
442
    });
446
    });
443
447
444
    if (   defined $holds_per_day && $holds_per_day ne ''
448
    if (   defined $holds_per_day && $holds_per_day ne ''
Lines 905-911 sub CancelExpiredReserves { Link Here
905
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
909
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
906
910
907
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
911
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
908
    my $params = { expirationdate => { '<', $today } };
912
    my $params = { expirationdate => { '<', $dtf->format_datetime($today) } };
909
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
913
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
910
914
911
    # FIXME To move to Koha::Holds->search_expired (?)
915
    # FIXME To move to Koha::Holds->search_expired (?)
(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 629-635 sub current_holds { Link Here
629
        itemnumber => $self->itemnumber,
629
        itemnumber => $self->itemnumber,
630
        suspend => 0,
630
        suspend => 0,
631
        -or => [
631
        -or => [
632
            reservedate => { '<=' => $dtf->format_date(dt_from_string) },
632
            reservedate => { '<=' => $dtf->format_datetime(dt_from_string) },
633
            waitingdate => { '!=' => undef },
633
            waitingdate => { '!=' => undef },
634
        ],
634
        ],
635
    };
635
    };
(-)a/t/db_dependent/Holds.t (-3 / +2 lines)
Lines 100-106 my $reservedate = $first_hold->reservedate; Link Here
100
my $borrowernumber = $first_hold->borrowernumber;
100
my $borrowernumber = $first_hold->borrowernumber;
101
my $branch_1code = $first_hold->branchcode;
101
my $branch_1code = $first_hold->branchcode;
102
my $reserve_id = $first_hold->reserve_id;
102
my $reserve_id = $first_hold->reserve_id;
103
is( $reservedate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), "holds_placed_today should return a valid reserve date");
103
is( dt_from_string( $reservedate ), dt_from_string, "holds_placed_today should return a valid reserve date");
104
is( $borrowernumber, $borrowernumbers[0], "holds_placed_today should return a valid borrowernumber");
104
is( $borrowernumber, $borrowernumbers[0], "holds_placed_today should return a valid borrowernumber");
105
is( $branch_1code, $branch_1, "holds_placed_today should return a valid branchcode");
105
is( $branch_1code, $branch_1, "holds_placed_today should return a valid branchcode");
106
ok($reserve_id, "Test holds_placed_today()");
106
ok($reserve_id, "Test holds_placed_today()");
Lines 709-715 subtest 'CanItemBeReserved / holds_per_day tests' => sub { Link Here
709
    is_deeply(
709
    is_deeply(
710
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
710
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
711
        { status => 'tooManyReservesToday', limit => 2 },
711
        { status => 'tooManyReservesToday', limit => 2 },
712
        'Patron cannot a third item with 2 reserves daily cap'
712
        'Patron cannot reserve a third item with 2 reserves daily cap'
713
    );
713
    );
714
714
715
    # Update last hold so reservedate is in the past, so 2 holds, but different day
715
    # Update last hold so reservedate is in the past, so 2 holds, but different day
716
- 

Return to bug 24718