From cd5c7736036af08f6e364bb2c6fdcdd92d154e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Fri, 5 Mar 2021 13:32:43 +0200 Subject: [PATCH] Bug 27879: Remove unnecessary Koha::Hold::is_at_destination function It does the same thing as is_waiting(). A waiting hold should never be anywhere else than the pickup branch, if it is it is not a waiting hold. --- Koha/Hold.pm | 14 -------------- .../bootstrap/en/includes/holds-table.inc | 6 +----- reserve/request.pl | 2 +- t/db_dependent/Hold.t | 10 ---------- 4 files changed, 2 insertions(+), 30 deletions(-) diff --git a/Koha/Hold.pm b/Koha/Hold.pm index 3d14f2b2a6..f098232b89 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -371,20 +371,6 @@ sub is_cancelable_from_opac { return 0; # if ->is_in_transit or if ->is_waiting or ->is_in_processing } -=head3 is_at_destination - -Returns true if hold is waiting -and the hold's pickup branch matches -the hold item's holding branch - -=cut - -sub is_at_destination { - my ($self) = @_; - - return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() ); -} - =head3 biblio Returns the related Koha::Biblio object for this hold diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc index 78735ba4a0..5a210e3985 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc @@ -38,7 +38,7 @@ [% UNLESS ( HOLD.is_waiting || HOLD.is_in_transit || HOLD.is_in_processing) %] [% SET all_holds_waiting = 0 %] [% END %] - [% IF ( HOLD.is_at_destination ) %] + [% IF ( HOLD.is_waiting ) %] [% ELSIF HOLD.is_in_transit %] @@ -101,7 +101,6 @@ Status: [% IF ( HOLD.is_waiting ) %] - [% IF ( HOLD.is_at_destination ) %] Item waiting at [% HOLD.branch.branchname | html %] [% IF ( HOLD.desk_id ) %], [% HOLD.desk.desk_name | html %],[% END %] [% IF ( HOLD.waitingdate ) %] @@ -111,9 +110,6 @@ [% END %] [% END %] - [% ELSE %] - Item in transit to [% Branches.GetName( HOLD.branchcode ) | html %] - [% END %] [% ELSE %] [% IF ( HOLD.is_in_transit ) %] [% SET transfer = HOLD.item.get_transfer %] diff --git a/reserve/request.pl b/reserve/request.pl index 1751a0aa92..4205c36a06 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -658,7 +658,7 @@ foreach my $biblionumber (@biblionumbers) { $reserve{'wbrcode'} = $res->branchcode(); $reserve{'itemnumber'} = $res->itemnumber(); $reserve{'wbrname'} = $res->branch()->branchname(); - $reserve{'atdestination'} = $res->is_at_destination(); + $reserve{'atdestination'} = $res->is_waiting(); $reserve{'desk_name'} = ( $res->desk() ) ? $res->desk()->desk_name() : '' ; $reserve{'found'} = $res->is_found(); $reserve{'inprocessing'} = $res->is_in_processing(); diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t index 5b71b64292..344f31cbea 100755 --- a/t/db_dependent/Hold.t +++ b/t/db_dependent/Hold.t @@ -132,16 +132,6 @@ is( $hold->is_cancelable_from_opac, 0, "In transit hold is not cancelable" ); $hold->found('P'); is( $hold->is_cancelable_from_opac, 0, "In processing hold is not cancelable" ); -# Test method is_at_destination -$hold->found(undef); -ok( !$hold->is_at_destination(), "Unfound hold cannot be at destination" ); -$hold->found('T'); -ok( !$hold->is_at_destination(), "In transit hold cannot be at destination" ); -$hold->found('W'); -ok( !$hold->is_at_destination(), "Waiting hold where hold branchcode is not the same as the item's holdingbranch is not at destination" ); -$item->holdingbranch( $branches[1]->{branchcode} ); -ok( $hold->is_at_destination(), "Waiting hold where hold branchcode is the same as the item's holdingbranch is at destination" ); - $schema->storage->txn_rollback(); subtest "delete() tests" => sub { -- 2.17.1