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

(-)a/C4/Reserves.pm (-42 lines)
Lines 104-110 BEGIN { Link Here
104
        &AddReserve
104
        &AddReserve
105
105
106
        &GetReserve
106
        &GetReserve
107
        &GetReservesFromItemnumber
108
        &GetReservesFromBorrowernumber
107
        &GetReservesFromBorrowernumber
109
        &GetReservesForBranch
108
        &GetReservesForBranch
110
        &GetReservesToBranch
109
        &GetReservesToBranch
Lines 275-320 sub GetReserve { Link Here
275
    return $sth->fetchrow_hashref();
274
    return $sth->fetchrow_hashref();
276
}
275
}
277
276
278
=head2 GetReservesFromItemnumber
279
280
 ( $reservedate, $borrowernumber, $branchcode, $reserve_id, $waitingdate ) = GetReservesFromItemnumber($itemnumber);
281
282
Get the first reserve for a specific item number (based on priority). Returns the abovementioned values for that reserve.
283
284
The routine does not look at future reserves (read: item level holds), but DOES include future waits (a confirmed future hold).
285
286
=cut
287
288
sub GetReservesFromItemnumber {
289
    my ($itemnumber) = @_;
290
291
    my $schema = Koha::Database->new()->schema();
292
293
    my $r = $schema->resultset('Reserve')->search(
294
        {
295
            itemnumber => $itemnumber,
296
            suspend    => 0,
297
            -or        => [
298
                reservedate => \'<= CAST( NOW() AS DATE )',
299
                waitingdate => { '!=', undef }
300
            ]
301
        },
302
        {
303
            order_by => 'priority',
304
        }
305
    )->first();
306
307
    return unless $r;
308
309
    return (
310
        $r->reservedate(),
311
        $r->get_column('borrowernumber'),
312
        $r->get_column('branchcode'),
313
        $r->reserve_id(),
314
        $r->waitingdate(),
315
    );
316
}
317
318
=head2 GetReservesFromBorrowernumber
277
=head2 GetReservesFromBorrowernumber
319
278
320
    $borrowerreserv = GetReservesFromBorrowernumber($borrowernumber,$tatus);
279
    $borrowerreserv = GetReservesFromBorrowernumber($borrowernumber,$tatus);
321
- 

Return to bug 17737