Bug 41594: Disable access to invoice-files.pl if AcqEnableFiles disabled

This patch makes it so that invoice-files.pl returns 404 if
AcqEnableFiles is disabled

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. Go to /cgi-bin/koha/acqui/invoice-files.pl?invoiceid=999
3. Note that you see a 404 page
4. Change "AcqEnableFiles" syspref to "Do"
5. Go to /cgi-bin/koha/acqui/invoice-files.pl?invoiceid=999
6. Note that you now see a "Files for invoice" page

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
David Cook 2026-01-12 02:05:47 +00:00 committed by Jacob O'Mara
parent 7302a4d8f2
commit b201ee97b8
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -31,7 +31,7 @@ use Modern::Perl;
use CGI;
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Output qw( output_html_with_http_headers output_error );
use C4::Acquisition qw( GetInvoice GetInvoiceDetails );
use Koha::Misc::Files;
@ -45,6 +45,10 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
}
);
if ( !C4::Context->preference('AcqEnableFiles') ) {
output_error( $input, '404' );
}
my $invoiceid = $input->param('invoiceid') // '';
my $op = $input->param('op') // '';
my %errors;