Use the mapping instead of building a fake hash only to get the key name.
To test:
1. apply this patch
2. prove t/Koha/REST/Plugin/Query.t
3. sign off
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
my $param = $string;
$param =~ s/^(\+|\-|\s)//;
if ( $result_set ) {
- $param = (keys %{$result_set->attributes_from_api({ $param => 1 })})[0];
+ my $model_param = $result_set->from_api_mapping->{$param};
+ $param = $model_param if defined $model_param;
}
if ( $string =~ m/^\+/ or