Bugzilla – Attachment 166564 Details for
Bug 34597
Expired patrons can still place ILL requests through OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34597: Implementation
Bug-34597-Implementation.patch (text/plain), 5.31 KB, created by
Pedro Amorim
on 2024-05-10 13:37:14 UTC
(
hide
)
Description:
Bug 34597: Implementation
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-05-10 13:37:14 UTC
Size:
5.31 KB
patch
obsolete
>From e5cae06df9c7661ad762c18c1e46c1a6fa7afd98 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 28 Mar 2024 12:52:29 +0000 >Subject: [PATCH] Bug 34597: Implementation > >New can_patron_place_ill_in_opac method to include all rules >that need checking to determine if a patron is allowed >to place an ILL request on the OPAC or not. >Added effective_BlockExpiredPatronOpacActions_contains rule to >this new method. > >Test plan, k-t-d,: >1) Install FreeForm and enable ILLmodule, run: >bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) >1.5) Checkout FreeForm's reorganize_ILL branch: > cd /kohadevbox/koha/Koha/Illbackends/FreeForm > git checkout reorganize_ILL > koha-plack --restart kohadev >2) Edit a patron category, visit: ><staff_url>/cgi-bin/koha/admin/categories.pl >3) Set 'Placing an ILL request' for the "Block expired patrons" input config >4) Add a new patron of one of the above category, make sure this patron is expired (set an expirydate to the past). >5) Login as that user and visit ILL page in OPAC: >/cgi-bin/koha/opac-illrequests.pl >6) Confirm there is no "Create a new request" button >7) Access the create a new request page url directly: ><opac_url>/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=FreeForm >8) Confirm you get a 403 page >9) Set the 'Block expired actions' to "Follow system preference BlockExpiredPatronOpacActions" >10) Test different values of the BlockExpiredPatronOpacActions system preference and confirm the behaviour matches what's configured >--- > Koha/ILL/Request.pm | 26 +++++++++++++++++++ > .../bootstrap/en/modules/opac-illrequests.tt | 4 +-- > opac/opac-illrequests.pl | 11 ++++---- > 3 files changed, 34 insertions(+), 7 deletions(-) > >diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm >index 49050abd90..04c99863ee 100644 >--- a/Koha/ILL/Request.pm >+++ b/Koha/ILL/Request.pm >@@ -2104,6 +2104,32 @@ sub strings_map { > return $strings; > } > >+=head3 can_patron_place_ill_in_opac >+ >+ my $can_patron_place_ill_in_opac = Koha::Illrequest->can_patron_place_ill_in_opac($patron); >+ >+Returns whether the given patron can place an ILL request in OPAC >+ >+=over >+ >+=item patron >+ >+Patron object >+ >+=back >+ >+=cut >+ >+sub can_patron_place_ill_in_opac { >+ my ( $self, $patron ) = @_; >+ >+ return 0 >+ unless $patron->_result->categorycode->can_place_ill_in_opac >+ && !( $patron->is_expired >+ && $patron->category->effective_BlockExpiredPatronOpacActions_contains('ill_request') ); >+ return 1; >+} >+ > =head3 get_op_param_deprecation > > my $op = $req->check_url_param_deprecation($params); >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 8adb5229df..38c8709357 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >@@ -117,7 +117,7 @@ > <h1>Interlibrary loan requests</h1> > [% INCLUDE messages %] > >- [% IF can_place_ill_in_opac %] >+ [% IF can_patron_place_ill_in_opac %] > <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"> >@@ -240,7 +240,7 @@ > </div> > [% END %] > </div> >- [% IF can_place_ill_in_opac %] >+ [% IF can_patron_place_ill_in_opac %] > <fieldset class="action illrequest-actions"> > <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" /> > <input type="hidden" name="op" value="cud-update" /> >diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl >index 92f3e5e4f6..26be90a546 100755 >--- a/opac/opac-illrequests.pl >+++ b/opac/opac-illrequests.pl >@@ -73,7 +73,8 @@ if ( $illrequest_id = $params->{illrequest_id} ) { > } > } > >-if ( ( $op eq 'cud-create' || $op eq 'cancreq' || $op eq 'cud-update' ) && !$patron->_result->categorycode->can_place_ill_in_opac ) { >+my $can_patron_place_ill_in_opac = Koha::ILL::Request->can_patron_place_ill_in_opac($patron); >+if ( ( $op eq 'cud-create' || $op eq 'cancreq' || $op eq 'cud-update' ) && !$can_patron_place_ill_in_opac ) { > print $query->redirect('/cgi-bin/koha/errors/403.pl'); > exit; > } >@@ -181,10 +182,10 @@ if ( $op eq 'list' ) { > } > > $template->param( >- can_place_ill_in_opac => $patron->_result->categorycode->can_place_ill_in_opac, >- message => $params->{message}, >- illrequestsview => 1, >- op => $op >+ can_patron_place_ill_in_opac => $can_patron_place_ill_in_opac, >+ message => $params->{message}, >+ illrequestsview => 1, >+ op => $op > ); > > output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >-- >2.39.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 34597
:
164052
|
164053
|
164054
|
164055
|
165415
|
165416
|
165417
|
165418
|
166563
|
166564
|
166668
|
166669
|
166670
|
166671
|
166672
|
167481
|
167482
|
167483
|
167484
|
167485
|
167486