From d31b0bfdfc2d15eb94255240b6233315120f2bfe 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 Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- .../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 f5631f2001..8cb513510f 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.39.5