From 3c485bb1c568a1b23c27e11e9ed3fbf8b25f5d4c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 27 Jun 2022 10:15:16 +0100 Subject: [PATCH] Bug 28854: (follow-up) Disable bundle editing for checked out This patch disables the add and remove options under bundle management when the bundled item in question is checked out. Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/catalogue/detail.tt | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 4b8df62200..ce14db485f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -373,7 +373,7 @@ [% FOREACH item IN items %] - + [% IF (StaffDetailItemSelection) %] @@ -1612,13 +1612,18 @@ Note that permanent location is a code, and location may be an authval. $(document).ready(function() { [% IF bundlesEnabled %] // Bundle handling - function createChild ( row, itemnumber ) { + function createChild ( row, itemnumber, duedate ) { // Toolbar var bundle_toolbar = $('
'); bundle_toolbar.append(' ' + _("Add to bundle") + ''); bundle_toolbar.append(' ' + _("Remove from bundle") + ''); + // Disable management if there's a duedate + if(duedate) { + bundle_toolbar.children('.btn').addClass("disabled"); + } + // This is the table we'll convert into a DataTable var bundles_table = $(''); @@ -1717,7 +1722,12 @@ Note that permanent location is a code, and location may be an authval. }, { "data": function( row, type, val, meta ) { - var result = '\n'; + var result; + if (duedate) { + result = '\n'; + } else { + result = '\n'; + } return result; }, "title": _("Actions"), @@ -1727,7 +1737,7 @@ Note that permanent location is a code, and location may be an authval. } ] }, bundle_settings, 1); - $(".tbundle").on("click", ".remove", function(){ + $(".tbundle").on("click", ".remove:not(.disabled)", function(){ var bundle_table = $(this).closest('table'); var host_itemnumber = bundle_table.data('itemnumber'); var component_itemnumber = $(this).data('itemnumber'); @@ -1909,6 +1919,7 @@ Note that permanent location is a code, and location may be an authval. var dTable = $(this).closest('table').DataTable({ 'retrieve': true }); var itemnumber = tr.data('itemnumber'); + var duedate = tr.data('duedate'); var row = dTable.row( tr ); if ( row.child.isShown() ) { @@ -1918,7 +1929,7 @@ Note that permanent location is a code, and location may be an authval. } else { // Open this row - createChild(row, itemnumber); + createChild(row, itemnumber, duedate); tr.addClass('shown'); } } ); -- 2.39.5