Bug 37902: TODOs

There are still different structures we won't handle properly.
This patch adds conditionals to prevent failures or warnings.

Should be done, but later.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2024-09-12 12:35:33 +02:00 committed by Katrin Fischer
parent 101fd97cb7
commit c7786b419c
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 15 additions and 3 deletions

View File

@ -878,13 +878,24 @@ sub attributes_from_api {
my $params;
my $columns_info = $self->_result->result_source->columns_info;
if ( ref($from_api_params) && ref($from_api_params) eq 'ARRAY' ) {
# TODO No fixup if an ARRAY is passed
return $from_api_params;
}
while ( my ( $key, $value ) = each %{$from_api_params} ) {
my $koha_field_name =
exists $from_api_mapping->{$key}
? $from_api_mapping->{$key}
: $key;
$params->{$koha_field_name} = $self->_recursive_fixup( $key, $value, $columns_info->{$koha_field_name} );
if ( exists $columns_info->{$koha_field_name} ) {
# TODO No fixup if the name is from an embed (eg. suggester.borrowernumber)
# See warnings produced by t/db_dependent/Koha/REST/Plugin/Objects.t if this test is removed
$params->{$koha_field_name} = $self->_recursive_fixup( $key, $value, $columns_info->{$koha_field_name} );
} else {
$params->{$koha_field_name} = $value;
}
}
return $params;

View File

@ -284,8 +284,9 @@ controller, and thus shouldn't be called twice in it.
);
}
$filtered_params =
$result_set->attributes_from_api($filtered_params);
if ( defined $filtered_params ) {
$filtered_params = $result_set->attributes_from_api($filtered_params);
}
$c->dbic_validate_operators( { filtered_params => $filtered_params } );