Bug 11703 [QA Followup] - Restore showing earliest renewal date for 'too early' renewals
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 7 May 2014 15:17:38 +0000 (11:17 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 3 Jul 2014 14:22:10 +0000 (11:22 -0300)
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc
koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js
svc/checkouts.pl

index 536a055..df9ca78 100644 (file)
@@ -13,7 +13,7 @@
     var BY = _("by _AUTHOR_");
     var ON_HOLD = _("On hold");
     var NOT_RENEWABLE = _("Not renewable");
-    var NOT_RENEWABLE_TOO_SOON = _("Cannot renew, renewal is premature");
+    var NOT_RENEWABLE_TOO_SOON = _("No renewal before %s");
     var RENEWALS_REMAINING = _("%s of %s renewals remaining");
     var HOLD_IS_SUSPENDED = _("Hold is <strong>suspended</strong>");
     var UNTIL = _("until %s");
index 4ab7be1..11dcc42 100644 (file)
@@ -238,7 +238,7 @@ $(document).ready(function() {
                         span_class = "renewals-allowed";
                     } else if ( oObj.can_renew_error == "too_soon" ) {
                         content += "<span class='renewals-disabled'>"
-                                + NOT_RENEWABLE_TOO_SOON
+                                + NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date )
                                 + "</span>";
 
                         span_style = "display: none";
index bcb3444..9de51ac 100755 (executable)
@@ -27,7 +27,8 @@ use JSON qw(to_json);
 
 use C4::Auth qw(check_cookie_auth);
 use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
-use C4::Circulation qw(GetIssuingCharges CanBookBeRenewed GetRenewCount);
+use C4::Circulation
+  qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate);
 use C4::Context;
 
 use Koha::DateUtils;
@@ -116,6 +117,15 @@ while ( my $c = $sth->fetchrow_hashref() ) {
 
     my ( $can_renew, $can_renew_error ) =
       CanBookBeRenewed( $c->{borrowernumber}, $c->{itemnumber} );
+    my $can_renew_date =
+      $can_renew_error eq 'too_soon'
+      ? output_pref(
+        {
+            dt => GetSoonestRenewDate( $c->{borrowernumber}, $c->{itemnumber} ),
+            as_due_date => 1
+        }
+      )
+      : undef;
 
     my ( $renewals_count, $renewals_allowed, $renewals_remaining ) =
       GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} );
@@ -134,6 +144,7 @@ while ( my $c = $sth->fetchrow_hashref() ) {
         price          => $c->{replacementprice} || q{},
         can_renew      => $can_renew,
         can_renew_error     => $can_renew_error,
+        can_renew_date      => $can_renew_date,
         itemnumber          => $c->{itemnumber},
         borrowernumber      => $c->{borrowernumber},
         biblionumber        => $c->{biblionumber},