Bugzilla – Attachment 65604 Details for
Bug 19056
Move C4::Reserves::GetReserveCount to the Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19056: Replace C4::Reserves::GetReserveCount with Koha::Patron->holds->count
Bug-19056-Replace-C4ReservesGetReserveCount-with-K.patch (text/plain), 2.86 KB, created by
Jonathan Druart
on 2017-08-07 20:54:19 UTC
(
hide
)
Description:
Bug 19056: Replace C4::Reserves::GetReserveCount with Koha::Patron->holds->count
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-08-07 20:54:19 UTC
Size:
2.86 KB
patch
obsolete
>From dc03bd347e1fbf24f1cba9dd61cbbbbd7d59ad17 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 7 Aug 2017 17:29:43 -0300 >Subject: [PATCH] Bug 19056: Replace C4::Reserves::GetReserveCount with > Koha::Patron->holds->count > >This subroutine is only used once and can easily be replaced with >Koha::Patron->holds->count > >Test plan: >- Set maxreserves=5 >- Place 3 holds for a given patron >- Place again 3 holds for this patron >3+3 > 5 => The holds must not be placed >--- > C4/Reserves.pm | 25 ------------------------- > reserve/request.pl | 3 +-- > t/db_dependent/Holds.t | 5 +---- > 3 files changed, 2 insertions(+), 31 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index f07dd7f042..924ce5fde6 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -106,7 +106,6 @@ BEGIN { > > &GetReserve > &GetReservesForBranch >- &GetReserveCount > &GetReserveStatus > > &GetOtherReserves >@@ -475,30 +474,6 @@ sub CanReserveBeCanceledFromOpac { > > } > >-=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); >diff --git a/reserve/request.pl b/reserve/request.pl >index 7cda03dce2..272817086e 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -142,8 +142,7 @@ if ($borrowernumber_hold && !$action) { > # 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 ); > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 584acb281d..871d68704f 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -7,7 +7,7 @@ use t::lib::TestBuilder; > > use C4::Context; > >-use Test::More tests => 57; >+use Test::More tests => 56; > use MARC::Record; > use C4::Biblio; > use C4::Items; >@@ -127,9 +127,6 @@ $holds = $patron->holds; > 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()" ); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19056
:
65604
|
65617
|
66696