From db78cdfc4c71cf0bd25cfbe395b6a1c3641ccad0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 2 Feb 2018 14:21:49 -0300 Subject: [PATCH] Bug 20133: UI Changes Add a checkbox to enable/disable the feature for given group of libraries. Important note: Only the top level node can turn the feature, the idea is to avoid confusion, ease testing (by limiting the number of cases) and force libraries to define one tree per feature (Maybe this is wrong, but maybe good to start) --- admin/library_groups.pl | 4 ++ .../prog/en/modules/admin/library_groups.tt | 51 +++++++++++++++++++--- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/admin/library_groups.pl b/admin/library_groups.pl index c540948b89..c84e6d2d9b 100755 --- a/admin/library_groups.pl +++ b/admin/library_groups.pl @@ -46,6 +46,7 @@ if ( $action eq 'add' ) { my $parent_id = $cgi->param('parent_id') || undef; my $title = $cgi->param('title') || undef; my $description = $cgi->param('description') || undef; + my $ft_hide_patron_info = $cgi->param('ft_hide_patron_info') || 0; my $branchcode = $cgi->param('branchcode') || undef; if ( !$branchcode && Koha::Library::Groups->search( { title => $title } )->count() ) { @@ -57,6 +58,7 @@ if ( $action eq 'add' ) { parent_id => $parent_id, title => $title, description => $description, + ft_hide_patron_info => $ft_hide_patron_info, branchcode => $branchcode, } )->store(); @@ -68,6 +70,7 @@ elsif ( $action eq 'edit' ) { my $id = $cgi->param('id') || undef; my $title = $cgi->param('title') || undef; my $description = $cgi->param('description') || undef; + my $ft_hide_patron_info = $cgi->param('ft_hide_patron_info') || 0; if ($id) { my $group = Koha::Library::Groups->find($id); @@ -76,6 +79,7 @@ elsif ( $action eq 'edit' ) { { title => $title, description => $description, + ft_hide_patron_info => $ft_hide_patron_info, } )->store(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt index 954722dd93..2b908d958e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt @@ -22,9 +22,11 @@ $('.edit-group').on('click', function() { var id = $(this).data('groupId'); + var parent_id = $(this).data('groupParentId'); var title = $(this).data('groupTitle'); var description = $(this).data('groupDescription'); - edit_group( id, title, description ); + var ft_hide_patron_info = $(this).data('groupFt_hide_patron_info'); + edit_group( id, parent_id, title, description, ft_hide_patron_info ); }); $('.delete-group').on('click', function() { @@ -51,14 +53,33 @@ $('#add-group-modal-title').focus(); }); + $('#add-group-modal-ft_hide_patron_info').prop('checked', false); + if ( parent_id ) { + $('#add-group-modal-ft_hide_patron_info').parent().hide(); + } else { + $('#add-group-modal-ft_hide_patron_info').parent().show(); + } $('#add-group-modal').modal('show'); } - function edit_group( id, title, description ) { + function edit_group( id, parent_id, title, description, ft_hide_patron_info ) { $('#edit-group-modal-id').val( id ); $('#edit-group-modal-title').val( title ); $('#edit-group-modal-description').val( description ); + if ( parent_id ) { + $('#edit-group-modal-ft_hide_patron_info').prop('checked', false); + $('#edit-group-modal-ft_hide_patron_info').parent().hide(); + } else { + if ( ft_hide_patron_info ) { + $('#edit-group-modal-ft_hide_patron_info').prop('checked', true); + } else { + $('#edit-group-modal-ft_hide_patron_info').prop('checked', false); + } + + $('#edit-group-modal-ft_hide_patron_info').parent().show(); + } + $('#edit-group-modal').on('shown', function() { $('#edit-group-modal-title').focus(); }); @@ -133,6 +154,7 @@   Description + Features enabled   [% PROCESS tree group=root_group %] @@ -157,15 +179,19 @@

- + required

- +

+

+ + +