Bug 37762: Vuejs sysprefs store: Allow fetching multiple sys pref values

Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2026-01-12 11:48:56 -01:00 committed by Lucas Gass
parent 6dab32ee02
commit 2a1fa8d091
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 19 additions and 5 deletions

View File

@ -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: "",

View File

@ -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);
}