From 3ea6b60676c0955b092748b74e8e1bf3cc42bd04 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatetsolutions.com>
Date: Thu, 11 Jan 2018 09:44:08 -0500
Subject: [PATCH] Bug 18856: (QA follow-up) Rename method to avoid confusion
Content-Type: text/plain; charset=utf-8

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Hmm. I would have liked the opac parameter even better ;)
---
 Koha/Hold.pm                                          | 6 +++---
 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 6 +++---
 t/db_dependent/Hold.t                                 | 8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Koha/Hold.pm b/Koha/Hold.pm
index 4ddd8be..23d5d44 100644
--- a/Koha/Hold.pm
+++ b/Koha/Hold.pm
@@ -223,17 +223,17 @@ sub is_in_transit {
     return $self->found() eq 'T';
 }
 
-=head3 is_cancelable
+=head3 is_cancelable_from_opac
 
 Returns true if hold is a cancelable hold
 
-Holds may be only canceled if they are found.
+Holds may be only canceled if they are not found.
 
 This is used from the OPAC.
 
 =cut
 
-sub is_cancelable {
+sub is_cancelable_from_opac {
     my ($self) = @_;
 
     return 1 unless $self->is_found();
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
index 6604cb6..ad048d0 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
@@ -685,7 +685,7 @@
                                             </td>
                                             [% IF SuspendHoldsOpac %]
                                                 <td>
-                                                    [% IF ( RESERVE.is_cancelable ) %]
+                                                    [% IF ( RESERVE.is_cancelable_from_opac ) %]
                                                         [% IF RESERVE.suspend %]
                                                             <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
                                                                 <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
@@ -726,11 +726,11 @@
                                                                 </form>
                                                             [% END # / IF AutoResumeSuspendedHolds %]
                                                         [% END # / IF RESERVE.suspend %]
-                                                    [% END # / IF ( RESERVE.is_cancelable )%]
+                                                    [% END # / IF ( RESERVE.is_cancelable_from_opac )%]
                                                 </td>
                                             [% END # / IF SuspendHoldsOpac %]
                                             <td class="modify">
-                                                [% IF ( RESERVE.is_cancelable ) %]
+                                                [% IF ( RESERVE.is_cancelable_from_opac ) %]
                                                     <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
                                                     <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
                                                     <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t
index 635b9b5..4258ba3 100755
--- a/t/db_dependent/Hold.t
+++ b/t/db_dependent/Hold.t
@@ -124,13 +124,13 @@ isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' );
 is( $hold->is_found, 0, 'The hold is not found' );
 ok( !$hold->is_in_transit, 'The hold is not in transit' );
 
-# Test method is_cancelable
+# Test method is_cancelable_from_opac
 $hold->found(undef);
-is( $hold->is_cancelable, 1, "Unfound hold is cancelable" );
+is( $hold->is_cancelable_from_opac, 1, "Unfound hold is cancelable" );
 $hold->found('W');
-is( $hold->is_cancelable, 0, "Waiting hold is not cancelable" );
+is( $hold->is_cancelable_from_opac, 0, "Waiting hold is not cancelable" );
 $hold->found('T');
-is( $hold->is_cancelable, 0, "In transit hold is not cancelable" );
+is( $hold->is_cancelable_from_opac, 0, "In transit hold is not cancelable" );
 
 # Test method is_at_destination
 $hold->found(undef);
-- 
2.1.4