[Koha-patches] [PATCH] (bug #2812) fix holds cancel in OPAC

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Wed Aug 26 01:44:29 CEST 2009


From: Nahuel ANGELINETTI <nahuel.angelinetti at biblibre.com>

This fix the user ability to cancel holds in OPAC.
At the moment, a user can cancel all his holds, but in fact, only items that are not in transfert or waiting to be checked out can be cancelled by the user.
---
 koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl |   10 +++++++---
 opac/opac-user.pl                                  |    4 ++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
index 3ae68e5..962ce34 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
@@ -363,9 +363,13 @@ $.tablesorter.addParser({
                     <!-- /TMPL_IF -->
                 </td>
 		<td>
-		<form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
-		<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
-		<input type="submit" name="submit" class="icon delete cancel" value="Cancel" onclick="return confirmDelete('Are you sure you want to cancel this hold?');" /></form>
+		<!-- TMPL_IF NAME="cancelable" -->
+			<form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
+			<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
+			<input type="submit" name="submit" class="icon delete cancel" value="Cancel" onclick="return confirmDelete('Are you sure you want to cancel this hold?');" /></form>
+		<!-- TMPL_ELSE -->
+			&nbsp;
+		<!-- /TMPL_IF -->
 		</td>
 
             </tr>
diff --git a/opac/opac-user.pl b/opac/opac-user.pl
index 06b48f4..f09350b 100755
--- a/opac/opac-user.pl
+++ b/opac/opac-user.pl
@@ -239,6 +239,10 @@ foreach my $res (@reserves) {
         push @waiting, $res;
         $wcount++;
     }
+    # can be cancelled
+    #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
+    $res->{'cancelable'} = 1 if    ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
+    
 }
 
 $template->param( WAITING => \@waiting );
-- 
1.6.0.4




More information about the Koha-patches mailing list