From 3910adbd7eb0f1c50a5e09a13d18e2e26f563a30 Mon Sep 17 00:00:00 2001 From: Alex Sassmannshausen Date: Thu, 2 Mar 2017 17:52:10 +0100 Subject: [PATCH] Add per borrower category create ILL privilege. * admin/categories.pl: Add validation & update for `canplaceill`. * koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt: Add `canplaceill` handling. * ill/ill-requests.pl: Pass `canplaceill` to template. * koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc: Check for `canplaceill`. * opac/opac-illrequests.pl: Pass `canplaceill` to template. * koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt: Check for `canplaceill`. * installer/data/mysql/kohastructure.sql: Create `canplaceill` column. * installer/data/mysql/atomicupdate/ill_cat_permission.sql: New file. --- admin/categories.pl | 3 ++ ill/ill-requests.pl | 2 ++ .../data/mysql/atomicupdate/ill_cat_permission.sql | 4 +++ installer/data/mysql/kohastructure.sql | 1 + .../intranet-tmpl/prog/en/includes/ill-toolbar.inc | 32 ++++++++++---------- .../prog/en/modules/admin/categories.tt | 29 ++++++++++++++++++ .../bootstrap/en/modules/opac-illrequests.tt | 34 ++++++++++++---------- opac/opac-illrequests.pl | 6 ++-- 8 files changed, 77 insertions(+), 34 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/ill_cat_permission.sql diff --git a/admin/categories.pl b/admin/categories.pl index 358ef7d8c8..753d012935 100755 --- a/admin/categories.pl +++ b/admin/categories.pl @@ -91,6 +91,7 @@ elsif ( $op eq 'add_validate' ) { my $category_type = $input->param('category_type'); my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions'); my $checkPrevCheckout = $input->param('checkprevcheckout'); + my $canplaceill = $input->param('canplaceill'); my $default_privacy = $input->param('default_privacy'); my @branches = grep { $_ ne q{} } $input->multi_param('branches'); @@ -121,6 +122,7 @@ elsif ( $op eq 'add_validate' ) { $category->category_type($category_type); $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions); $category->checkprevcheckout($checkPrevCheckout); + $category->canplaceill($canplaceill); $category->default_privacy($default_privacy); eval { $category->store; @@ -147,6 +149,7 @@ elsif ( $op eq 'add_validate' ) { category_type => $category_type, BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions, checkprevcheckout => $checkPrevCheckout, + canplaceill => $canplaceill, default_privacy => $default_privacy, }); eval { diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index 5ab56b8722..f56187374d 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -219,6 +219,8 @@ my $ir = Koha::Illrequest->new; $template->param( backends => $ir->available_backends, + canplaceill => Koha::Patrons->find($patronnumber) + ->_result->categorycode->canplaceill, media => [ "Book", "Article", "Journal" ], query_type => $op, branches => Koha::Libraries->search->unblessed, diff --git a/installer/data/mysql/atomicupdate/ill_cat_permission.sql b/installer/data/mysql/atomicupdate/ill_cat_permission.sql new file mode 100644 index 0000000000..aa391c86e2 --- /dev/null +++ b/installer/data/mysql/atomicupdate/ill_cat_permission.sql @@ -0,0 +1,4 @@ +-- Add new column to categories table +ALTER TABLE categories +ADD COLUMN `canplaceill` tinyint(1) NOT NULL default '0' +AFTER `checkprevcheckout`; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e37930b789..22d606e759 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -330,6 +330,7 @@ CREATE TABLE `categories` ( -- this table shows information related to Koha patr `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron category if this item has previously been checked out to this patron if 'yes', not if 'no', defer to syspref setting if 'inherit'. + `canplaceill` tinyint(1) NOT NULL default '0', -- can this patron category place interlibrary loan requests PRIMARY KEY (`categorycode`), UNIQUE KEY `categorycode` (`categorycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc index 3f541d9283..61aa63108f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc @@ -1,21 +1,23 @@ [% USE Koha %] [% IF Koha.Preference('ILLModule ') %]
- [% IF backends.size > 1 %] - - [% ELSE %] - - New ILL request - + [% IF canplaceill %] + [% IF backends.size > 1 %] + + [% ELSE %] + + New ILL request + + [% END %] [% END %] List requests diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt index b28b634c3c..835cb01b8f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt @@ -211,6 +211,23 @@ [% END %] + [% IF ( Koha.Preference('ILLModule') ) %] +
  • + + + + Choose whether patrons of this category can create new interlibrary loan requests. + +
  • + [% END %]