Bugzilla – Attachment 58638 Details for
Bug 17736
Move GetReservesFromBiblionumber to Koha::Biblio->holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17736: [Follow-up] Rename to current_holds
Bug-17736-Follow-up-Rename-to-currentholds.patch (text/plain), 4.84 KB, created by
Marcel de Rooy
on 2017-01-06 12:55:19 UTC
(
hide
)
Description:
Bug 17736: [Follow-up] Rename to current_holds
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-01-06 12:55:19 UTC
Size:
4.84 KB
patch
obsolete
>From 2a824c10ab4d4559d5ec06adf89f9cce73478ae4 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 6 Jan 2017 10:48:48 +0100 >Subject: [PATCH] Bug 17736: [Follow-up] Rename to current_holds >Content-Type: text/plain; charset=utf-8 > >It is not about when the hold was 'placed' but if the hold pertains to >the future or not. > >Test plan: >[1] Git grep on holds_placed_before_today. >[2] Run t/db_dependent/Koha/Biblios.t >[3] Run t/db_dependent/Reserves.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/ILSDI/Services.pm | 2 +- > C4/SIP/ILS/Item.pm | 2 +- > Koha/Biblio.pm | 6 +++--- > acqui/parcel.pl | 2 +- > serials/routing-preview.pl | 2 +- > t/db_dependent/Koha/Biblios.t | 6 +++--- > 6 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index d6d7630..5257650 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -219,7 +219,7 @@ sub GetRecords { > # Get most of the needed data > my $biblioitemnumber = $biblioitem->{'biblioitemnumber'}; > my $biblio = Koha::Biblios->find( $biblionumber ); >- my $holds = $biblio->holds_placed_before_today->unblessed; >+ my $holds = $biblio->current_holds->unblessed; > my $issues = GetBiblioIssues($biblionumber); > my $items = GetItemsByBiblioitemnumber($biblioitemnumber); > >diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm >index c7b8ea7..3329497 100644 >--- a/C4/SIP/ILS/Item.pm >+++ b/C4/SIP/ILS/Item.pm >@@ -95,7 +95,7 @@ sub new { > my $borrower = GetMember(borrowernumber=>$issue->{'borrowernumber'}); > $item->{patron} = $borrower->{'cardnumber'}; > my $biblio = Koha::Biblios->find( $item->{biblionumber } ); >- my $holds = $biblio->holds_placed_before_today->unblessed; >+ my $holds = $biblio->current_holds->unblessed; > $item->{hold_queue} = $holds; > $item->{hold_shelf} = [( grep { defined $_->{found} and $_->{found} eq 'W' } @{$item->{hold_queue}} )]; > $item->{pending_queue} = [( grep {(! defined $_->{found}) or $_->{found} ne 'W' } @{$item->{hold_queue}} )]; >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 5b3ce08..7c86d5a 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -265,16 +265,16 @@ sub holds { > return Koha::Holds->_new_from_dbic($hold_rs); > } > >-=head3 holds_placed_before_today >+=head3 current_holds > >-my $holds = $biblio->holds_placed_before_today >+my $holds = $biblio->current_holds > > Return the holds placed on this bibliographic record. > It does not include future holds. > > =cut > >-sub holds_placed_before_today { >+sub current_holds { > my ($self) = @_; > my $dtf = Koha::Database->new->schema->storage->datetime_parser; > return $self->holds( >diff --git a/acqui/parcel.pl b/acqui/parcel.pl >index 8d59182..c874781 100755 >--- a/acqui/parcel.pl >+++ b/acqui/parcel.pl >@@ -141,7 +141,7 @@ for my $order ( @orders ) { > $line{holds} = 0; > my @itemnumbers = GetItemnumbersFromOrder( $order->{ordernumber} ); > my $biblio = Koha::Biblios->find( $order->{ordernumber} ); >- $line{holds} = $biblio->holds_placed_before_today->search( >+ $line{holds} = $biblio->current_holds->search( > { > itemnumber => { -in => \@itemnumbers }, > } >diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl >index 47d373f..491bf2b 100755 >--- a/serials/routing-preview.pl >+++ b/serials/routing-preview.pl >@@ -74,7 +74,7 @@ if($ok){ > # get existing reserves ..... > > my $biblio = Koha::Biblios->find( $biblionumber ); >- my $holds = $biblio->holds_placed_before_today; >+ my $holds = $biblio->current_holds; > my $count = $holds->count; > while ( my $hold = $holds->next ) { > $count-- if $hold->is_waiting; >diff --git a/t/db_dependent/Koha/Biblios.t b/t/db_dependent/Koha/Biblios.t >index dce43ad..d39b2f9 100644 >--- a/t/db_dependent/Koha/Biblios.t >+++ b/t/db_dependent/Koha/Biblios.t >@@ -44,7 +44,7 @@ my $biblioitem = $schema->resultset('Biblioitem')->new( > } > )->insert(); > >-subtest 'holds + holds_placed_before_today' => sub { >+subtest 'holds + current_holds' => sub { > plan tests => 5; > C4::Reserves::AddReserve( $patron->branchcode, $patron->borrowernumber, $biblio->biblionumber ); > my $holds = $biblio->holds; >@@ -57,8 +57,8 @@ subtest 'holds + holds_placed_before_today' => sub { > C4::Reserves::AddReserve( $patron->branchcode, $patron->borrowernumber, $biblio->biblionumber, undef, undef, dt_from_string->add( days => 2 ) ); > $holds = $biblio->holds; > is( $holds->count, 1, '->holds should return future holds' ); >- $holds = $biblio->holds_placed_before_today; >- is( $holds->count, 0, '->holds_placed_before_today should not return future holds' ); >+ $holds = $biblio->current_holds; >+ is( $holds->count, 0, '->current_holds should not return future holds' ); > $holds->delete; > > }; >-- >2.1.4
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 17736
:
58015
|
58016
|
58017
|
58056
|
58057
|
58106
|
58107
|
58108
|
58628
|
58629
|
58630
|
58631
|
58632
|
58633
|
58634
|
58635
|
58636
|
58637
|
58638
|
58639
|
58640
|
58641
|
58642
|
58643
|
58644
|
58645
|
59846
|
59847
|
59848
|
59849
|
59850
|
59851
|
59852
|
59853
|
59854
|
59855
|
59859
|
59860
|
61406
|
61407
|
61408
|
61409
|
61410
|
61411
|
61412
|
61413
|
61414
|
61415
|
61416