Browse Source

Bug 17737: Rename holds_placed_before_today with current_holds

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
17.05.x
Jonathan Druart 6 years ago
committed by Kyle M Hall
parent
commit
b01fe1a666
  1. 4
      Koha/Item.pm
  2. 2
      catalogue/detail.pl
  3. 2
      circ/transferstoreceive.pl
  4. 2
      opac/opac-reserve.pl
  5. 2
      reserve/request.pl
  6. 4
      t/db_dependent/Holds.t
  7. 16
      t/db_dependent/Reserves.t

4
Koha/Item.pm

@ -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;

2
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';

2
circ/transferstoreceive.pl

@ -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'};

2
opac/opac-reserve.pl

@ -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||;

2
reserve/request.pl

@ -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 );

4
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;

16
t/db_dependent/Reserves.t

@ -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));

Loading…
Cancel
Save