From 0da975638a099603771684628096117d14ad7a24 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. Signed-off-by: Frederic Demians I confirm the bug and the solution. Signed-off-by: Katrin Fischer Passes tests and QA script, works as described. Exception: on-site checkouts can't be renewed. Signed-off-by: Mason James --- .../intranet-tmpl/prog/en/js/checkouts.js | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js index b1847f0e06..56c9346645 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js @@ -248,7 +248,7 @@ $(document).ready(function() { if ( oObj.can_renew ) { // Do nothing } else if ( oObj.can_renew_error == "on_reserve" ) { - content += "" + content += "" + "" + ON_HOLD + "" + ""; @@ -277,19 +277,23 @@ $(document).ready(function() { span_class = "renewals-allowed"; } - if ( oObj.renewals_remaining ) { - content += "" - + "" - + ""; + var can_force_renew = ( oObj.can_renew_error != "on_reserve" ); + var can_renew = ( oObj.renewals_remaining > 0 && !oObj.can_renew_error ); - content += "(" - + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) - + ")"; - } + if ( can_renew || can_force_renew ) { + content += "" + + "" + + ""; + + content += "(" + + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) + + ")"; + } content += ""; -- 2.39.5