Fix for Bug 2941 Transfers cannot be canceled once initiated
authorOwen Leonard <oleonard@myacpl.org>
Fri, 22 Apr 2011 20:57:38 +0000 (16:57 -0400)
committerChris Cormack <chrisc@catalyst.net.nz>
Sat, 23 Apr 2011 05:22:05 +0000 (17:22 +1200)
This patch includes the changes by Catalyst found at
http://git.catalyst.net.nz/gw?p=koha.git;a=shortlog;h=refs/heads/bug_2941
and adds a "cancel transfer" link to the transferstoreceive
script, including a redirect check to send the user back to
that report.

Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
circ/returns.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt

index 5a0cc09..d7fad0c 100755 (executable)
@@ -3,6 +3,7 @@
 # Copyright 2000-2002 Katipo Communications
 #           2006 SAN-OP
 #           2007-2010 BibLibre, Paul POULAIN
+#           2010 Catalyst IT
 #
 # This file is part of Koha.
 #
@@ -171,6 +172,8 @@ my $barcode     = $query->param('barcode');
 my $exemptfine  = $query->param('exemptfine');
 my $dropboxmode = $query->param('dropboxmode');
 my $dotransfer  = $query->param('dotransfer');
+my $canceltransfer = $query->param('canceltransfer');
+my $dest = $query->param('dest');
 my $calendar    = C4::Calendar->new( branchcode => $userenv_branch );
 #dropbox: get last open day (today - 1)
 my $today       = C4::Dates->new();
@@ -183,6 +186,17 @@ if ($dotransfer){
     ModItemTransfer($transferitem, $userenv_branch, $tobranch); 
 }
 
+if ($canceltransfer){
+    $itemnumber=$query->param('itemnumber');
+    DeleteTransfer($itemnumber);
+    if($dest eq "ttr"){
+        print $query->redirect("/cgi-bin/koha/circ/transferstoreceive.pl");
+        exit;
+    } else {
+        $template->param( transfercancelled => 1);
+    }
+}
+
 # actually return book and prepare item table.....
 if ($barcode) {
     $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
@@ -321,6 +335,7 @@ if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) {
         WrongTransfer  => 1,
         TransferWaitingAt => $messages->{'WrongTransfer'},
         WrongTransferItem => $messages->{'WrongTransferItem'},
+        itemnumber => $itemnumber,
     );
 
     my $reserve    = $messages->{'ResFound'};
index a766bcc..620f770 100644 (file)
@@ -80,7 +80,7 @@ function Dopop(link) {
 </div>
 [% END %]
 <!-- case of a mistake in transfer loop -->
-[% IF ( WrongTransfer ) %]<div class="dialog message"><!-- WrongTransfer --><h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a> to [% TransferWaitingAt %]</h3>
+[% IF ( WrongTransfer ) %]<div class="dialog message"><!-- WrongTransfer --><h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a> to [% TransferWaitingAt %] or <a href="/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber %]&amp;canceltransfer=1">Cancel Transfer</a></h3>
 [% IF ( wborcnum ) %]<h5>Hold for:</h5>
         <ul><li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
             [% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li>
index 50d7ae3..2c84d5d 100644 (file)
@@ -50,6 +50,7 @@ $(document).ready(function() {
                 <th>On hold for</th>
                 <th>Home library</th>
                 <th>Call no.</th>
+                <th>&nbsp;</th>
             </tr></thead>
             <tbody>[% FOREACH reser IN branchesloo.reserv %]
                 [% IF ( reser.messcompa ) %]
@@ -79,6 +80,7 @@ $(document).ready(function() {
                     </td>
                     <td>[% reser.homebranch %]</td>
                     <td>[% reser.itemcallnumber %]</td>
+                    <td><a href="/cgi-bin/koha/circ/returns.pl?itemnumber=[% reser.itemnumber %]&amp;canceltransfer=1&amp;dest=ttr">Cancel Transfer</a></td>
                 </tr>
             [% END %]</tbody>
             </table>