&GetReserve
&GetReservesForBranch
- &GetReserveCount
&GetReserveStatus
&GetOtherReserves
}
-=head2 GetReserveCount
-
- $number = &GetReserveCount($borrowernumber);
-
-this function returns the number of reservation for a borrower given on input arg.
-
-=cut
-
-sub GetReserveCount {
- my ($borrowernumber) = @_;
-
- my $dbh = C4::Context->dbh;
-
- my $query = "
- SELECT COUNT(*) AS counter
- FROM reserves
- WHERE borrowernumber = ?
- ";
- my $sth = $dbh->prepare($query);
- $sth->execute($borrowernumber);
- my $row = $sth->fetchrow_hashref;
- return $row->{counter};
-}
-
=head2 GetOtherReserves
($messages,$nextreservinfo)=$GetOtherReserves(itemnumber);
# we check the reserves of the user, and if they can reserve a document
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
- my $reserves_count =
- GetReserveCount( $patron->borrowernumber );
+ my $reserves_count = $patron->holds->count;
my $new_reserves_count = scalar( @biblionumbers );
use C4::Context;
-use Test::More tests => 57;
+use Test::More tests => 56;
use MARC::Record;
use C4::Biblio;
use C4::Items;
is( $holds->next->borrowernumber, $borrowernumbers[0], "Test Koha::Patron->holds");
-ok( GetReserveCount( $borrowernumbers[0] ), "Test GetReserveCount()" );
-
-
CancelReserve({ 'reserve_id' => $reserve_id });
$holds = $biblio->holds;
is( $holds->count, $borrowers_count - 1, "Test CancelReserve()" );