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 448-456 sub CanItemBeReserved { Link Here
448
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
448
        return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
449
    }
449
    }
450
450
451
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
452
    my $fromdate = dt_from_string->set({ hour => 00, minute => 00, second => 00 });
453
    my $todate = dt_from_string->set({ hour => 23, minute => 59, second => 59 });
454
451
    my $today_holds = Koha::Holds->search({
455
    my $today_holds = Koha::Holds->search({
452
        borrowernumber => $borrowernumber,
456
        borrowernumber => $borrowernumber,
453
        reservedate    => dt_from_string->date
457
        reservedate    => [ -and => { '>=' => $dtf->format_datetime($fromdate) }, { '<=' => $dtf->format_datetime($todate) } ]
454
    });
458
    });
455
459
456
    if (   defined $holds_per_day && $holds_per_day ne ''
460
    if (   defined $holds_per_day && $holds_per_day ne ''
Lines 922-928 sub CancelExpiredReserves { Link Here
922
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
926
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');
923
927
924
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
928
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
925
    my $params = { expirationdate => { '<', $today } };
929
    my $params = { expirationdate => { '<', $dtf->format_datetime($today) } };
926
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
930
    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;
927
931
928
    # FIXME To move to Koha::Holds->search_expired (?)
932
    # FIXME To move to Koha::Holds->search_expired (?)
(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 648-654 sub current_holds { Link Here
648
        itemnumber => $self->itemnumber,
648
        itemnumber => $self->itemnumber,
649
        suspend => 0,
649
        suspend => 0,
650
        -or => [
650
        -or => [
651
            reservedate => { '<=' => $dtf->format_date(dt_from_string) },
651
            reservedate => { '<=' => $dtf->format_datetime(dt_from_string) },
652
            waitingdate => { '!=' => undef },
652
            waitingdate => { '!=' => undef },
653
        ],
653
        ],
654
    };
654
    };
(-)a/t/db_dependent/Holds.t (-3 / +2 lines)
Lines 102-108 my $reservedate = $first_hold->reservedate; Link Here
102
my $borrowernumber = $first_hold->borrowernumber;
102
my $borrowernumber = $first_hold->borrowernumber;
103
my $branch_1code = $first_hold->branchcode;
103
my $branch_1code = $first_hold->branchcode;
104
my $reserve_id = $first_hold->reserve_id;
104
my $reserve_id = $first_hold->reserve_id;
105
is( $reservedate, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), "holds_placed_today should return a valid reserve date");
105
is( dt_from_string( $reservedate ), dt_from_string, "holds_placed_today should return a valid reserve date");
106
is( $borrowernumber, $borrowernumbers[0], "holds_placed_today should return a valid borrowernumber");
106
is( $borrowernumber, $borrowernumbers[0], "holds_placed_today should return a valid borrowernumber");
107
is( $branch_1code, $branch_1, "holds_placed_today should return a valid branchcode");
107
is( $branch_1code, $branch_1, "holds_placed_today should return a valid branchcode");
108
ok($reserve_id, "Test holds_placed_today()");
108
ok($reserve_id, "Test holds_placed_today()");
Lines 715-721 subtest 'CanItemBeReserved / holds_per_day tests' => sub { Link Here
715
    is_deeply(
715
    is_deeply(
716
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
716
        CanItemBeReserved( $patron->borrowernumber, $itemnumber_2 ),
717
        { status => 'tooManyReservesToday', limit => 2 },
717
        { status => 'tooManyReservesToday', limit => 2 },
718
        'Patron cannot a third item with 2 reserves daily cap'
718
        'Patron cannot reserve a third item with 2 reserves daily cap'
719
    );
719
    );
720
720
721
    # Update last hold so reservedate is in the past, so 2 holds, but different day
721
    # Update last hold so reservedate is in the past, so 2 holds, but different day
722
- 

Return to bug 24718