Bug 17737: Rename holds_placed_before_today with current_holds
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 9 Jan 2017 08:13:11 +0000 (09:13 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 13 Apr 2017 12:49:12 +0000 (08:49 -0400)
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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

Koha/Item.pm
catalogue/detail.pl
circ/transferstoreceive.pl
opac/opac-reserve.pl
reserve/request.pl
t/db_dependent/Holds.t
t/db_dependent/Reserves.t

index 617f10c..a921018 100644 (file)
@@ -185,11 +185,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;
index 25a28c5..63ba1ad 100755 (executable)
@@ -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';
index 02664a5..bf1a756 100755 (executable)
@@ -102,7 +102,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'};
index 740f405..1939ec9 100755 (executable)
@@ -472,7 +472,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||;
index 22147a9..89dace6 100755 (executable)
@@ -389,7 +389,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 );
 
index d49deea..1b4f1df 100755 (executable)
@@ -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;
index 08d88f8..ab20156 100755 (executable)
@@ -404,8 +404,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);
@@ -416,21 +416,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));