From fd575181480dc822e1903959962c2a248e147584 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 8 Oct 2020 11:15:44 -0400 Subject: [PATCH] Bug 26633: Add advanced editor for transfer limits The current transfer limits editor works great for Koha instances with small numbers of branches. However, for consortiums with dozens or even hundreds of libraries, the editor does not work well or effectively. We should provide an "advanced" editor displays all to/from library combinations in a grid and allows them to be edited in a manner somewhat similar to the transport cost matrix editor. Test Plan: 1) Apply this patch 2) Browse to the transfer limits editor 3) Click the new "Switch to advanced editor" link 4) Select a collection code/item type to edit limits for 5) Test the "Check all" function 6) Test the "Uncheck all" function 7) Test the "Check" column function 8) Test the "Uncheck" column function 9) Test the "Check" row function 10) Test the "Uncheck" row function 11) Test individual checkboxes/table cells Signed-off-by: Lisette Scheer Signed-off-by: Lisette Scheer Signed-off-by: Lisette Scheer Signed-off-by: Lisette Scheer Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- admin/transfer_limits.pl | 42 ++ .../modules/admin/branch_transfer_limits.tt | 9 +- .../prog/en/modules/admin/transfer_limits.tt | 437 ++++++++++++++++++ 3 files changed, 487 insertions(+), 1 deletion(-) create mode 100755 admin/transfer_limits.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/transfer_limits.tt diff --git a/admin/transfer_limits.pl b/admin/transfer_limits.pl new file mode 100755 index 0000000000..98801efa63 --- /dev/null +++ b/admin/transfer_limits.pl @@ -0,0 +1,42 @@ +#!/usr/bin/perl + +# copyright 2020 ByWater Solutions +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use CGI qw ( -utf8 ); +use C4::Auth; +use C4::Context; +use C4::Output; +use C4::Koha; +use C4::Circulation + qw{ IsBranchTransferAllowed DeleteBranchTransferLimits CreateBranchTransferLimit }; + +my $input = new CGI; + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "admin/transfer_limits.tt", + query => $input, + type => "intranet", + flagsrequired => { parameters => 'manage_transfers' }, + debug => 1, + } +); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt index 2647ee28f8..cd7b7768f2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt @@ -28,7 +28,14 @@

Check the boxes for the libraries you allow your items to be transferred to.

-
[% IF ( limitType == 'ccode' ) %]For all collection codes: [% ELSE %]For all item types: [% END %] Select all | Clear all
+
+ [% IF ( limitType == 'ccode' ) %]For all collection codes: [% ELSE %]For all item types: [% END %] + Select all + | + Clear all + | + Switch to advanced editor +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transfer_limits.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transfer_limits.tt new file mode 100644 index 0000000000..117863348f --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transfer_limits.tt @@ -0,0 +1,437 @@ +[% USE raw %] +[% USE To %] +[% USE Asset %] +[% USE Branches %] +[% USE Koha %] +[% USE ItemTypes %] +[% USE AuthorisedValues %] +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Administration › Library checkin and transfer policy +[% INCLUDE 'doc-head-close.inc' %] + + + +[% SET BranchTransferLimitsType = Koha.Preference('BranchTransferLimitsType') %] +[% SET branches = Branches.all %] + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'prefs-admin-search.inc' %] + + + +
+
+
+
+

Checkin and transfer policy

+ +

+ [% IF BranchTransferLimitsType == "itemtype" %] + + + [% ELSE #BranchTransferLimitsType == "ccode" %] + + + [% END %] + + + + Loading... + +

+ +

Check the boxes for the libraries you allow your items to be transferred to.

+
+ Check all + | + Uncheck all + | + Switch to basic editor +
+ + + + + + + + [% FOREACH to IN branches %] + + [% END %] + + + + + + [% FOREACH b IN branches %] + + [% END %] + + + + + [% FOREACH from IN branches %] + + + + [% FOREACH to IN branches %] + + [% END %] + + [% END %] + +
   +

Check

+

Uncheck

+
 From / To[% b.branchname | html %]
+

Check

+

Uncheck

+
[% from.branchname | html %] + [% IF to.branchcode == from.branchcode %] +   + [% ELSE %] + + + [% END %] +
+
+
+ +
+ +
+
+ +[% MACRO jsinclude BLOCK %] + [% Asset.js("js/admin-menu.js") | $raw %] + [% INCLUDE 'datatables.inc' %] + [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] + +[% END %] +[% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5