Bug 35380: Make record sources available in overlay rules

This patch enhances the filters in record overlay rules when using the "Source" module. The available filter values are now system defined in Administration -> Record sources and can be extended by own record souces. The former hard coded values (f.e. batchmod, intranet) are added to the database and cannot be deleted.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
Jan Kissig 2026-03-13 10:17:26 +00:00 committed by Martin Renvoize
parent d7dd72b1a4
commit 246f299df1
No known key found for this signature in database
GPG Key ID: 2D86E0EAEC83711B
2 changed files with 23 additions and 13 deletions

View File

@ -26,6 +26,7 @@ use C4::Output qw( output_html_with_http_headers );
use C4::ImportBatch;
use Koha::MarcOverlayRules;
use Koha::Patron::Categories;
use Koha::RecordSources;
my $input = CGI->new;
my $op = $input->param('op') || '';
@ -124,10 +125,14 @@ my $categories = Koha::Patron::Categories->search_with_library_limits(
{ order_by => ['description'], columns => [ 'categorycode', 'description' ] }
)->unblessed;
my @record_sources =
map { $_->{name} } @{ Koha::RecordSources->search->unblessed };
$template->param(
rules => $rules,
categories => $categories,
messages => $errors
rules => $rules,
categories => $categories,
record_sources => \@record_sources,
messages => $errors
);
output_html_with_http_headers $input, $cookie, $template->output;

View File

@ -491,16 +491,21 @@
categories.unshift({ categorycode: "*", description: "*" });
categories = categories.reduce((a, c) => ({ ...a, [c.categorycode]: c.description }), {});
var module_filter_options = {
source: {
"*": "*",
batchmod: _("Batch record modification"),
intranet: _("Staff interface MARC editor"),
batchimport: _("Staged MARC import"),
z3950: _("Z39.50"),
bulkmarcimport: _("bulkmarcimport.pl"),
import_lexile: _("import_lexile.pl"),
},
var module_filter_options = {
source: {
'*': '*',
[% FOREACH record_source IN record_sources %]
[% SWITCH record_source %]
[% CASE 'batchmod' %]'[% record_source %]': _("Batch record modification"),
[% CASE 'intranet' %]'[% record_source %]':_("Staff interface MARC editor"),
[% CASE 'batchimport' %]'[% record_source %]': _("Staged MARC import"),
[% CASE 'z3950' %]'[% record_source %]': _("Z39.50"),
[% CASE 'bulkmarkimport' %]'[% record_source %]': _("bulkmarcimport.pl"),
[% CASE 'import_lexile' %]'[% record_source %]': _("import_lexile.pl"),
[% CASE %] '[% record_source %]' : '[% record_source | html %]',
[% END %]
[% END %]
},
categorycode: categories,
};