From 8010eeb0db2ae2c9362747e511cdae7c52e4fc92 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 20 Apr 2018 11:52:17 +0000 Subject: [PATCH] Bug 20100: (QA follow-up) Use template logic instead of js to disable superlib box Content-Type: text/plain; charset=utf-8 Signed-off-by: Marcel de Rooy --- .../prog/en/modules/members/member-flags.tt | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt index f5631f2..8cb5135 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt @@ -36,9 +36,18 @@
  • [% END %] [% IF ( loo.checked ) %] - + [% IF disable_superlibrarian_privs && loo.bit == 0 %] + + + [% ELSE %] + + [% END %] [% ELSE %] - + [% IF disable_superlibrarian_privs && loo.bit == 0 %] + + [% ELSE %] + + [% END %] [% END %] [% PROCESS main_permissions name=loo.flag %] @@ -85,13 +94,13 @@ $("#permissionstree").treeview({animated: "fast", collapsed: true}); // Enforce Superlibrarian Privilege Mutual Exclusivity - if($('input[id="flag-0"]:checked').length){ + if( $('input[id="flag-0"]:checked').length || $(".superlib:checked").length ){ if ($('input[name="flag"]:checked').length > 1){ alert(_("Inconsistency detected! The superlibrarian privilege is mutually exclusive of other privileges, as it includes them all. This patron's privileges will now be reset to include only superlibrarian.")); } $('input[name="flag"]').each(function() { - if($(this).attr('id') != "flag-0"){ + if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){ $(this).prop('disabled', true); $(this).prop('checked', false); } @@ -99,9 +108,9 @@ } $('input#flag-0').click(function() { - if($('input[id="flag-0"]:checked').length){ + if( $('input[id="flag-0"]:checked').length || $(".superlib:checked").length ){ $('input[name="flag"]').each(function() { - if($(this).attr('id') != "flag-0"){ + if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){ $(this).prop('disabled', true); $(this).prop('checked', false); } @@ -122,12 +131,6 @@ } }); - [% IF disable_superlibrarian_privs %] - $("input#flag-0").attr("disabled", true); - $("form").submit(function(e) { - $("input#flag-0").removeAttr("disabled"); - }); - [% END %] }); // manage checking/unchecking parent permissions -- 2.1.4