From 74ee4ed719d5c9b4155004733b2b1ef0acd73f96 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. --- .../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 bd0c2a9023..0cc312989b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -361,7 +361,7 @@ [% FOREACH item IN items %] - + [% IF (StaffDetailItemSelection) %] @@ -1449,13 +1449,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 = $(''); @@ -1554,7 +1559,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"), @@ -1564,7 +1574,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'); @@ -1746,6 +1756,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() ) { @@ -1755,7 +1766,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.20.1