[Koha-patches] [PATCH] bug 3049: display correct due date of renewed loans

Galen Charlton galen.charlton at liblime.com
Wed Apr 8 21:46:01 CEST 2009


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.
---
 C4/Circulation.pm                                  |    2 +-
 catalogue/moredetail.pl                            |    8 ++++----
 .../prog/en/modules/catalogue/moredetail.tmpl      |    2 +-
 .../prog/en/modules/reserve/request.tmpl           |    2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 5337bf0..4b02a26 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -2123,7 +2123,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 );
diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl
index b72f126..6f62661 100755
--- a/catalogue/moredetail.pl
+++ b/catalogue/moredetail.pl
@@ -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'},
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl
index 4c8ce24..0026405 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tmpl
@@ -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">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl
index 2348916..be254ea 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl
@@ -289,7 +289,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" -->,
-- 
1.5.6.5




More information about the Koha-patches mailing list