From 246f299df1ecbc41bdf15dffc01dac25a62fec2b Mon Sep 17 00:00:00 2001 From: Jan Kissig Date: Fri, 13 Mar 2026 10:17:26 +0000 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize --- admin/marc-overlay-rules.pl | 11 +++++--- .../en/modules/admin/marc-overlay-rules.tt | 25 +++++++++++-------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/admin/marc-overlay-rules.pl b/admin/marc-overlay-rules.pl index bebaa1d6ac..e472ffdaa4 100755 --- a/admin/marc-overlay-rules.pl +++ b/admin/marc-overlay-rules.pl @@ -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; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt index ab5bfc3a6d..5d59b5ba6e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt @@ -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, };