Bug 43519: Direct links to article request form still work when the feature is disabled

This patch adds a check for the ArticleRequests system preference in
opac-request-article.pl so that the page will return a 404 error if the
preference is disabled.

To test, apply the patch and restart services.

- If necessary, enable the ArticleRequests system preference and
  configure a circulation rule to allow article requests.
- Locate a bibliographic record in the OPAC which will accept an article
  request. Note the biblionumber of the record you select.
  - Click "Request article" and complete the process. It should finish
    successfully.
- Disable the ArticleRequests system preference.
- Return to the OPAC and navigate directly to the page for requesting an
  article:
  http://localhost:8080/cgi-bin/koha/opac-request-article.pl?biblionumber=X
  ...where X is the biblionumber you noted before.
  - This should trigger a 404 error.

Sponsored-by: Athens County Public Libraries

Signed-off-by: Bastien CHAUVET <bastien.chauvet@inlibro.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Owen Leonard 2026-09-17 09:32:30 -04:00 committed by Pedro Amorim
parent 04314c4fbc
commit b09bc3c948
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,12 @@ use Try::Tiny;
my $cgi = CGI->new; my $cgi = CGI->new;
# if ArticleRequests is disabled, leave immediately
if ( !C4::Context->preference('ArticleRequests') ) {
print $cgi->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{ {
template_name => "opac-request-article.tt", template_name => "opac-request-article.tt",