Bugzilla – Attachment 145354 Details for
Bug 18203
Add per borrower category restrictions on placing ILL requests in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18203: Add per borrower category restrictions on ILL placement
Bug-18203-Add-per-borrower-category-restrictions-o.patch (text/plain), 14.41 KB, created by
Pedro Amorim
on 2023-01-17 10:33:47 UTC
(
hide
)
Description:
Bug 18203: Add per borrower category restrictions on ILL placement
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-01-17 10:33:47 UTC
Size:
14.41 KB
patch
obsolete
>From d5c9af1ccaf6acb40d8af7e85fdf511a9a2e0afc Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 16 Jan 2023 12:58:32 +0000 >Subject: [PATCH] Bug 18203: Add per borrower category restrictions on ILL > placement > >Test Plan: >- Enable ILLModule sys pref and install any backend >- Verify you can place new ILL requests in OPAC and Intranet >- Apply patch >- Run dbic >- Verify you can no longer place new ILL requests in OPAC and Intranet >- In borrower categories, set 'Can place ILL' to yes. >- Verify you can place new ILL requests in OPAC and Intranet. > >Signed-off-by: David Nind <david@davidnind.com> >--- > admin/categories.pl | 3 ++ > ill/ill-requests.pl | 1 + > .../data/mysql/atomicupdate/bug_18203.pl | 17 ++++++++++ > installer/data/mysql/kohastructure.sql | 1 + > .../prog/en/includes/ill-toolbar.inc | 34 ++++++++++--------- > .../prog/en/modules/admin/categories.tt | 26 ++++++++++++++ > .../bootstrap/en/modules/opac-illrequests.tt | 18 +++++----- > opac/opac-illrequests.pl | 6 ++-- > 8 files changed, 79 insertions(+), 27 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_18203.pl > >diff --git a/admin/categories.pl b/admin/categories.pl >index 53c4182b47..5e2a704e9e 100755 >--- a/admin/categories.pl >+++ b/admin/categories.pl >@@ -72,6 +72,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 $reset_password = $input->param('reset_password'); > my $change_password = $input->param('change_password'); >@@ -105,6 +106,7 @@ elsif ( $op eq 'add_validate' ) { > $category->can_be_guarantee($can_be_guarantee); > $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions); > $category->checkprevcheckout($checkPrevCheckout); >+ $category->canplaceill($canplaceill); > $category->default_privacy($default_privacy); > $category->reset_password($reset_password); > $category->change_password($change_password); >@@ -138,6 +140,7 @@ elsif ( $op eq 'add_validate' ) { > can_be_guarantee => $can_be_guarantee, > BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions, > checkprevcheckout => $checkPrevCheckout, >+ canplaceill => $canplaceill, > default_privacy => $default_privacy, > reset_password => $reset_password, > change_password => $change_password, >diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl >index fc7da41710..92ae4e6d52 100755 >--- a/ill/ill-requests.pl >+++ b/ill/ill-requests.pl >@@ -433,6 +433,7 @@ if ( $backends_available ) { > > $template->param( > backends => $backends, >+ canplaceill => Koha::Patrons->find($patronnumber)->_result->categorycode->canplaceill, > types => [ "Book", "Article", "Journal" ], > query_type => $op, > branches => Koha::Libraries->search, >diff --git a/installer/data/mysql/atomicupdate/bug_18203.pl b/installer/data/mysql/atomicupdate/bug_18203.pl >new file mode 100755 >index 0000000000..77d786b5ce >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_18203.pl >@@ -0,0 +1,17 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "18203", >+ description => "Add per borrower category restrictions on ILL placement", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ unless ( column_exists('categories', 'canplaceill') ) { >+ $dbh->do(q{ >+ ALTER TABLE `categories` >+ ADD COLUMN `canplaceill` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'can this patron category place interlibrary loan requests' >+ AFTER `checkprevcheckout`; >+ }); >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 59607073ca..bceec97a4a 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1672,6 +1672,7 @@ CREATE TABLE `categories` ( > `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL DEFAULT -1 COMMENT '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' COMMENT 'Default privacy setting for this patron category', > `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT '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 COMMENT 'can this patron category place interlibrary loan requests', > `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees', > `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,', > `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC', >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 03fec59ce1..601395459d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc >@@ -2,22 +2,24 @@ > [% IF Koha.Preference('ILLModule ') && CAN_user_ill %] > <div id="toolbar" class="btn-toolbar"> > [% IF backends_available %] >- [% IF backends.size > 1 %] >- <div class="dropdown btn-group"> >- <button class="btn btn-default dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> >- <i class="fa fa-plus"></i> New ILL request <span class="caret"></span> >- </button> >- <ul class="dropdown-menu" aria-labelledby="ill-backend-dropdown"> >- [% FOREACH backend IN backends %] >- <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=[% backend | uri %]">[% backend | html %]</a></li> >- [% END %] >- </ul> >- </div> >- [% ELSE %] >- <a id="ill-new" class="btn btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=[% backends.0 | html %]"> >- <i class="fa fa-plus"></i> New ILL request >- </a> >- [% END %] >+ [% IF canplaceill %] >+ [% IF backends.size > 1 %] >+ <div class="dropdown btn-group"> >+ <button class="btn btn-default dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> >+ <i class="fa fa-plus"></i> New ILL request <span class="caret"></span> >+ </button> >+ <ul class="dropdown-menu" aria-labelledby="ill-backend-dropdown"> >+ [% FOREACH backend IN backends %] >+ <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=[% backend | uri %]">[% backend | html %]</a></li> >+ [% END %] >+ </ul> >+ </div> >+ [% ELSE %] >+ <a id="ill-new" class="btn btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=[% backends.0 | html %]"> >+ <i class="fa fa-plus"></i> New ILL request >+ </a> >+ [% END %] >+ [% END %] > [% ELSE %] > <a id="ill-new" class="btn btn-default disabled" href=""> > <i class="fa fa-plus"></i> New ILL request >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 2bb5921b81..70a1029977 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >@@ -405,6 +405,23 @@ > </div> > </li> > [% END %] >+ [% IF ( Koha.Preference('ILLModule') ) %] >+ <li> >+ <label for="canplaceill">Can place ILL: </label> >+ <select id="canplaceill" name="canplaceill"> >+ [% IF category.canplaceill %] >+ <option value="0">No</option> >+ <option value="1" selected="selected">Yes</option> >+ [% ELSE %] >+ <option value="0" selected="selected">No</option> >+ <option value="1">Yes</option> >+ [% END %] >+ </select> >+ <div class="hint"> >+ Choose whether patrons of this category can create new interlibrary loan requests. >+ </div> >+ </li> >+ [% END %] > <li> > <label for="default_privacy">Default privacy: </label> > <select id="default_privacy" name="default_privacy"> >@@ -509,6 +526,12 @@ > </td> > </tr> > [% END %] >+ [% IF ( Koha.Preference('ILLModule') ) %] >+ <tr> >+ <th scope="row">Can place ILL: </th> >+ <td>[% IF category.canplaceill %]Yes[% ELSE %]No[% END %]</td> >+ </tr> >+ [% END %] > <tr><th scope="row">Can be guarantee</th><td>[% IF category.can_be_guarantee %]Yes[% ELSE %]No[% END %]</td></tr> > <tr> > <th scope="row">Default privacy: </th> >@@ -571,6 +594,9 @@ > [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %] > <th scope="col">Check previous checkout?</th> > [% END %] >+ [% IF ( Koha.Preference('ILLModule') ) %] >+ <th scope="col">Can place ILL?</th> >+ [% END %] > <th scope="col">Can be guarantee</th> > <th scope="col">Default privacy</th> > <th scope="col">Exclude from local holds priority</th> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >index 1ce9da4755..9566da56cd 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >@@ -112,8 +112,9 @@ > <h1>Interlibrary loan requests</h1> > [% INCLUDE messages %] > >- <div id="illrequests-create-button" class="dropdown btn-group"> >- [% IF backends.size > 1 %] >+ [% IF canplaceill %] >+ <div id="illrequests-create-button" class="dropdown btn-group"> >+ [% IF backends.size > 1 %] > <button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> > <i class="fa fa-plus" aria-hidden="true"></i> Create a new request <span class="caret"></span> > </button> >@@ -122,12 +123,13 @@ > <a class="dropdown-item" href="/cgi-bin/koha/opac-illrequests.pl?method=create&backend=[% backend | uri %]">[% backend | html %]</a> > [% END %] > </div> >- [% ELSE %] >- <a id="ill-new" class="btn btn-primary" href="/cgi-bin/koha/opac-illrequests.pl?method=create&backend=[% backends.0 | html %]"> >- <i class="fa fa-plus" aria-hidden="true"></i> Create a new request >- </a> >- [% END %] >- </div> >+ [% ELSE %] >+ <a id="ill-new" class="btn btn-primary" href="/cgi-bin/koha/opac-illrequests.pl?method=create&backend=[% backends.0 | html %]"> >+ <i class="fa fa-plus" aria-hidden="true"></i> Create a new request >+ </a> >+ [% END %] >+ </div> >+ [% END %] > > <table id="illrequestlist" class="table table-bordered table-striped"> > <caption class="sr-only">Requests</caption> >diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl >index e619707451..d59ca1252b 100755 >--- a/opac/opac-illrequests.pl >+++ b/opac/opac-illrequests.pl >@@ -56,6 +56,7 @@ my $reduced = C4::Context->preference('ILLOpacbackends'); > my $backends = Koha::Illrequest::Config->new->available_backends($reduced); > my $backends_available = ( scalar @{$backends} > 0 ); > $template->param( backends_available => $backends_available ); >+my $patron = Koha::Patrons->find($loggedinuser); > > my $op = $params->{'method'} || 'list'; > >@@ -154,9 +155,7 @@ if ( $op eq 'list' ) { > } > } > >- $params->{cardnumber} = Koha::Patrons->find({ >- borrowernumber => $loggedinuser >- })->cardnumber; >+ $params->{cardnumber} = $patron->cardnumber; > $params->{opac} = 1; > my $backend_result = $request->backend_create($params); > if ($backend_result->{stage} eq 'copyrightclearance') { >@@ -181,6 +180,7 @@ if ( $op eq 'list' ) { > } > > $template->param( >+ canplaceill => $patron->_result->categorycode->canplaceill, > message => $params->{message}, > illrequestsview => 1, > method => $op >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18203
:
60805
|
60806
|
145331
|
145349
|
145354
|
148707
|
148719
|
149010
|
153345
|
153346
|
153347
|
153370
|
153371
|
153372
|
155316
|
155317
|
155318
|
158126
|
158127
|
158128