Bug 17736: [Follow-up] Rename to current_holds
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 6 Jan 2017 09:48:48 +0000 (10:48 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 31 Mar 2017 12:02:14 +0000 (12:02 +0000)
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>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

C4/ILSDI/Services.pm
C4/SIP/ILS/Item.pm
Koha/Biblio.pm
acqui/parcel.pl
serials/routing-preview.pl
t/db_dependent/Koha/Biblios.t

index 64630b6..287ac02 100644 (file)
@@ -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);
 
index c7b8ea7..3329497 100644 (file)
@@ -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}} )];
index f666eaa..f0c8308 100644 (file)
@@ -266,16 +266,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(
index a747aa5..44af970 100755 (executable)
@@ -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 },
         }
index 47d373f..491bf2b 100755 (executable)
@@ -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;
index 5f28df6..59defcf 100644 (file)
@@ -45,7 +45,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;
@@ -58,8 +58,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;
 
 };