(bug #2812) fix holds cancel in OPAC
authorNahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Fri, 24 Jul 2009 14:01:48 +0000 (16:01 +0200)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 16 Sep 2009 21:19:29 +0000 (23:19 +0200)
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.

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
opac/opac-user.pl

index 68a9140..5a33cec 100644 (file)
@@ -355,9 +355,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>
index d8f8317..0c43f52 100755 (executable)
@@ -246,6 +246,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 );