From f5e1819e314b6e33c54bb9537ff2eeb1d7483ebd Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 21 Nov 2014 08:13:46 -0500 Subject: [PATCH] [PASSED QA] 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. --- koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 28 ++++++++++++++----------- 1 file 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 5c18219..a135496 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js @@ -281,7 +281,7 @@ $(document).ready(function() { if ( oObj.can_renew ) { // Do nothing } else if ( oObj.can_renew_error == "on_reserve" ) { - content += "" + content += "" + "" + ON_HOLD + "" + ""; @@ -324,18 +324,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.9.1