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 <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
706cd01ba2
commit
020bc275b0
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 } ), {} );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue