From f9d6395c51b3f969d095762181d8c7b098229732 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 21 Nov 2014 08:13:46 -0500 Subject: [PATCH] Bug 13293 - Regression: Override renewal limit option broken with AJAX circ The "Override renewal limit" checkbox no longer works to un-hide the renewal checkboxes in the table of checkouts. I assume this is because the script works in such a way that it is looking for the checkboxes before they are part of the document. Test Plan: 1) Apply this patch 2) Check the "Override renewal limit" checkbox 3) Note the checkbox now appears Note, this change allows the "X of Y renewals remaining" to be displayed for non-renewable items. I left this as it is for two reasons: 1) it gives the librarian more information that may be useful, and 2) it looks nicer and more uniform. --- koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 28 +++++++++++++--------- 1 files changed, 16 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js index 9a022df..6c7a365 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js @@ -278,7 +278,7 @@ $(document).ready(function() { if ( oObj.can_renew ) { // Do nothing } else if ( oObj.can_renew_error == "on_reserve" ) { - content += "" + content += "" + "" + ON_HOLD + "" + ""; @@ -321,18 +321,22 @@ $(document).ready(function() { span_class = "renewals-allowed"; } - if ( oObj.renewals_remaining && oObj.onsite_checkout == 0 ) { - content += "" - + "" - + ""; + var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" ); + var can_renew = ( oObj.renewals_remaining > 0 && !oObj.can_renew_error ); + if ( oObj.onsite_checkout == 0 ) { + if ( can_renew || can_force_renew ) { + content += "" + + "" + + ""; - content += "(" - + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) - + ")"; + content += "(" + + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) + + ")"; + } } content += ""; -- 1.7.2.5