Bugzilla – Attachment 58675 Details for
Bug 17737
Move GetReservesFromItemnumber to Koha::Item->holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17737: Rename holds_placed_before_today with current_holds
Bug-17737-Rename-holdsplacedbeforetoday-with-curre.patch (text/plain), 7.01 KB, created by
Jonathan Druart
on 2017-01-09 08:13:41 UTC
(
hide
)
Description:
Bug 17737: Rename holds_placed_before_today with current_holds
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-09 08:13:41 UTC
Size:
7.01 KB
patch
obsolete
>From 3644fe0f327cfae7ce346523622412f249e85887 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 9 Jan 2017 09:13:11 +0100 >Subject: [PATCH] Bug 17737: Rename holds_placed_before_today with > current_holds > >--- > Koha/Item.pm | 4 ++-- > catalogue/detail.pl | 2 +- > circ/transferstoreceive.pl | 2 +- > opac/opac-reserve.pl | 2 +- > reserve/request.pl | 2 +- > t/db_dependent/Holds.t | 4 ++-- > t/db_dependent/Reserves.t | 16 ++++++++-------- > 7 files changed, 16 insertions(+), 16 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 0bb8757..9978517 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -171,11 +171,11 @@ sub article_request_type { > return $issuing_rule->article_requests || q{} > } > >-=head3 holds_placed_before_today >+=head3 current_holds > > =cut > >-sub holds_placed_before_today { >+sub current_holds { > my ( $self ) = @_; > my $attributes = { order_by => 'priority' }; > my $dtf = Koha::Database->new->schema->storage->datetime_parser; >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 25a28c5..63ba1ad 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -259,7 +259,7 @@ foreach my $item (@items) { > > # checking for holds > my $item_object = Koha::Items->find( $item->{itemnumber} ); >- my $holds = $item_object->holds_placed_before_today; >+ my $holds = $item_object->current_holds; > if ( my $first_hold = $holds->next ) { > my $ItemBorrowerReserveInfo = C4::Members::GetMember( borrowernumber => $first_hold->borrowernumber); # FIXME could be improved > $item->{backgroundcolor} = 'reserved'; >diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl >index 8be5efc..375f8a8 100755 >--- a/circ/transferstoreceive.pl >+++ b/circ/transferstoreceive.pl >@@ -101,7 +101,7 @@ while ( my $library = $libraries->next ) { > > # we check if we have a reserv for this transfer > my $item = Koha::Items->find( $num->{itemnumber} ); >- my $holds = $item->holds_placed_before_today; >+ my $holds = $item->current_holds; > if ( my $first_hold = $holds->next ) { > my $getborrower = C4::Members::GetMember( borrowernumber => $first_hold->borrowernumber ); > $getransf{'borrowernum'} = $getborrower->{'borrowernumber'}; >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 1b0d2a8..3881b3d 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -450,7 +450,7 @@ foreach my $biblioNum (@biblionumbers) { > > # checking reserve > my $item = Koha::Items->find( $itemNum ); >- my $holds = $item->holds_placed_before_today; >+ my $holds = $item->current_holds; > > # the item could be reserved for this borrower vi a host record, flag this > my $reservedfor = q||; >diff --git a/reserve/request.pl b/reserve/request.pl >index c155e50..8d1ddfb 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -387,7 +387,7 @@ foreach my $biblionumber (@biblionumbers) { > } > > # checking reserve >- my $holds = Koha::Items->find( $itemnumber )->holds_placed_before_today; >+ my $holds = Koha::Items->find( $itemnumber )->current_holds; > if ( my $first_hold = $holds->next ) { > my $ItemBorrowerReserveInfo = GetMember( borrowernumber => $first_hold->borrowernumber ); > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index d49deea..1b4f1df 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -95,7 +95,7 @@ is( $holds->next->priority, 4, "Reserve 4 has a priority of 4" ); > is( $holds->next->priority, 5, "Reserve 5 has a priority of 5" ); > > my $item = Koha::Items->find( $itemnumber ); >-$holds = $item->holds_placed_before_today; >+$holds = $item->current_holds; > my $first_hold = $holds->next; > my $reservedate = $first_hold->reservedate; > my $borrowernumber = $first_hold->borrowernumber; >@@ -132,7 +132,7 @@ CancelReserve({ 'reserve_id' => $reserve_id }); > $holds = $biblio->holds; > is( $holds->count, $borrowers_count - 1, "Test CancelReserve()" ); > >-$holds = $item->holds_placed_before_today; >+$holds = $item->current_holds; > $first_hold = $holds->next; > $borrowernumber = $first_hold->borrowernumber; > $branch_1code = $first_hold->branchcode; >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 430c26d..8cf890e 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -396,8 +396,8 @@ is( > my $letter = ReserveSlip($branch_1, $requesters{$branch_1}, $bibnum); > ok(defined($letter), 'can successfully generate hold slip (bug 10949)'); > >-# Tests for bug 9788: Does Koha::Item->holds_placed_before_today return a future wait? >-# 9788a: holds_placed_before_today does not return future next available hold >+# Tests for bug 9788: Does Koha::Item->current_holds return a future wait? >+# 9788a: current_holds does not return future next available hold > $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); > t::lib::Mocks::mock_preference('ConfirmFutureHolds', 2); > t::lib::Mocks::mock_preference('AllowHoldDateInFuture', 1); >@@ -408,21 +408,21 @@ AddReserve($branch_1, $requesters{$branch_1}, $bibnum, > $bibitems, 1, $resdate, $expdate, $notes, > $title, $checkitem, $found); > my $item = Koha::Items->find( $itemnumber ); >-$holds = $item->holds_placed_before_today; >+$holds = $item->current_holds; > my $dtf = Koha::Database->new->schema->storage->datetime_parser; > my $future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); >-is( $future_holds->count, 0, 'holds_placed_before_today does not return a future next available hold'); >-# 9788b: holds_placed_before_today does not return future item level hold >+is( $future_holds->count, 0, 'current_holds does not return a future next available hold'); >+# 9788b: current_holds does not return future item level hold > $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); > AddReserve($branch_1, $requesters{$branch_1}, $bibnum, > $bibitems, 1, $resdate, $expdate, $notes, > $title, $itemnumber, $found); #item level hold > $future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); >-is( $future_holds->count, 0, 'holds_placed_before_today does not return a future item level hold' ); >-# 9788c: holds_placed_before_today returns future wait (confirmed future hold) >+is( $future_holds->count, 0, 'current_holds does not return a future item level hold' ); >+# 9788c: current_holds returns future wait (confirmed future hold) > ModReserveAffect( $itemnumber, $requesters{$branch_1} , 0); #confirm hold > $future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); >-is( $future_holds->count, 1, 'holds_placed_before_today returns a future wait (confirmed future hold)' ); >+is( $future_holds->count, 1, 'current_holds returns a future wait (confirmed future hold)' ); > # End of tests for bug 9788 > > $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); >-- >2.9.3
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 17737
:
58018
|
58019
|
58673
|
58674
|
58675
|
59872
|
59876
|
59877
|
59878
|
59879
|
62105
|
62106
|
62107
|
62108