diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js index 49b2f3212b..3e6226e6e5 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js @@ -11,6 +11,10 @@ export class SysprefAPIClient { this.httpClient.get({ endpoint: "/?pref=" + variable, }), + getAll: variables => + this.httpClient.get({ + endpoint: "/?" + variables.map(p => `pref=${p}`).join("&"), + }), update: (variable, value) => this.httpClient.post({ endpoint: "", diff --git a/svc/config/systempreferences b/svc/config/systempreferences index ff2d45ffb2..d35324780e 100755 --- a/svc/config/systempreferences +++ b/svc/config/systempreferences @@ -81,19 +81,29 @@ GET /svc/config/systempreferences/$preference =item url query -preference=$pref_name +pref=$pref_name + +or + +pref=$pref_name1&pref=$pref_name2 + =back -Used to get a single system preference. +Used to get a single system preference value or a list of system preference values =cut sub get_preference { - my $preference = scalar $query->param('pref'); + my @prefs = $query->multi_param('pref'); - my $value = C4::Context->preference($preference); - $response->param( value => $value ); + if ( scalar @prefs > 1 ) { + my %results = map { $_ => C4::Context->preference($_) } @prefs; + $response->param( value => \%results ); + } else { + my $value = C4::Context->preference( $prefs[0] ); + $response->param( value => $value ); + } C4::Service->return_success($response); }