bug 3049: display correct due date of renewed loans
authorGalen Charlton <galen.charlton@liblime.com>
Wed, 8 Apr 2009 19:46:01 +0000 (14:46 -0500)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 26 May 2009 19:15:09 +0000 (21:15 +0200)
The intranet item display provided by moredetail.pl
would display the original due date of the item, and
would thus be incorrect if the item had been renewed
and got a different due date.

The incorrect date was coming from items.onloan,
which AddIssue() sets to the due date.  This patch
fixes the bug in two ways:

[1] AddRenewal() now updates items.onloan with the
    correct due date.
[2] Two templates were updated to display the
    due date from (indirectly) issues.date_due
    instead of items.onloan, thus making it less
    likely that the wrong value will be displayed.

This patch does *not* update items.onloan to reflect
the correct due date.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
C4/Circulation.pm
catalogue/moredetail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl

index 2d852bd..e490e6f 100644 (file)
@@ -2007,7 +2007,7 @@ sub AddRenewal {
 
     # Update the renewal count on the item, and tell zebra to reindex
     $renews = $biblio->{'renewals'} + 1;
-    ModItem({ renewals => $renews }, $biblio->{'biblionumber'}, $itemnumber);
+    ModItem({ renewals => $renews, onloan => $datedue->output('iso') }, $biblio->{'biblionumber'}, $itemnumber);
 
     # Charge a new rental fee, if applicable?
     my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
index b72f126..6f62661 100755 (executable)
@@ -109,11 +109,11 @@ foreach my $item (@items){
     }
     $item->{'homebranchname'} = GetBranchName($item->{'homebranch'});
     $item->{'holdingbranchname'} = GetBranchName($item->{'holdingbranch'});
-    if ($item->{'onloan'} eq ''){
-        $item->{'issue'}= 0;
-    } else {
-        $item->{'onloan'} = format_date($item->{'onloan'});
+    if ($item->{'datedue'}) {
+        $item->{'datedue'} = format_date($item->{'datedue'});
         $item->{'issue'}= 1;
+    } else {
+        $item->{'issue'}= 0;
     }
 }
 $template->param(count => $data->{'count'},
index afb3dd3..fd7a162 100644 (file)
@@ -62,7 +62,7 @@
             
             <ol class="bibliodetails">
             <li><span class="label">Current Location:</span> <!-- TMPL_VAR NAME="holdingbranchname" -->&nbsp;</li>
-            <li><span class="label">Checkout Status:</span> <!-- TMPL_IF NAME="issue" -->Checked out to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="cardnumber" --></a>, Due back on <!-- TMPL_VAR NAME="onloan" --><!-- TMPL_ELSE -->Not Checked out <!-- /TMPL_IF --></li>
+            <li><span class="label">Checkout Status:</span> <!-- TMPL_IF NAME="issue" -->Checked out to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="cardnumber" --></a>, Due back on <!-- TMPL_VAR NAME="datedue" --><!-- TMPL_ELSE -->Not Checked out <!-- /TMPL_IF --></li>
             <li><span class="label">Lost Status:</span>
                 <!-- TMPL_IF NAME="CAN_user_circulate" -->
                     <form action="updateitem.pl" method="post">
index 43970a5..e183744 100644 (file)
@@ -248,7 +248,7 @@ if (alreadyreserved > "0"){
             <td><!-- TMPL_IF NAME="copynumber" --><!-- TMPL_VAR NAME="copynumber" --><!-- TMPL_ELSE -->&nbsp;<!-- /TMPL_IF --></td>
             <td>
                <!-- TMPL_IF Name="onloan" -->
-            <span class="checkedout">Due <!-- TMPL_VAR NAME="onloan" --></span>
+            <span class="checkedout">Due <!-- TMPL_VAR NAME="date_due" --></span>
                        <!-- TMPL_ELSE -->
                <!-- TMPL_IF Name="transfertwhen" -->
             In transit from <!-- TMPL_VAR NAME="transfertfrom" -->,