From 7eabf447d1df66c31743c1160e3d83b771ea1b54 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 12 May 2023 08:33:32 +0000 Subject: [PATCH] Bug 33335: (QA follow-up) Polishing and comments Just send the codes and descriptions only to client. Adding a few comments to the reduce construction. Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 020bc275b05ac74bacf52325ac2933d56e78ce32) Signed-off-by: Matt Blenkinsop --- admin/marc-overlay-rules.pl | 2 +- .../intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/admin/marc-overlay-rules.pl b/admin/marc-overlay-rules.pl index b3e0a86f8d..6c737b49a7 100755 --- a/admin/marc-overlay-rules.pl +++ b/admin/marc-overlay-rules.pl @@ -133,7 +133,7 @@ elsif ($op eq 'doedit' || $op eq 'add') { } my $categories = Koha::Patron::Categories->search_with_library_limits( {}, - { order_by => ['description'] } )->unblessed; + { order_by => ['description'], columns => [ 'categorycode', 'description' ] } )->unblessed; $template->param( rules => $rules, 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 fbdc3813ad..fd96291086 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 @@ -456,6 +456,8 @@ }); var categories = [% To.json( categories ) | $raw %]; + // Add * => * to this array of objects, and *reduce* it to one object + // Note: This allows displaying a sorted list of categories later, but we still depend on an object! categories.unshift({ categorycode: '*', description: '*'}); categories = categories.reduce( ( a,c ) => ( { ...a, [c.categorycode]: c.description } ), {} ); -- 2.39.5