@@ -, +, @@ --- Koha/REST/V1/Suggestions.pm | 6 ++++-- api/v1/swagger/definitions/suggestion.json | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) --- a/Koha/REST/V1/Suggestions.pm +++ a/Koha/REST/V1/Suggestions.pm @@ -29,6 +29,8 @@ use Koha::Suggestions; use Koha::ItemTypes; use Koha::Libraries; +use List::MoreUtils qw/any/; + use Try::Tiny; sub list { @@ -175,8 +177,8 @@ sub _validate_body { } foreach my $param ( keys %{ $body } ) { - unless (/^$param$/ ~~ @allowed_fields) { - # Ouch ! Some mandatory field is missing! + unless (any { /^$param$/ } @allowed_fields) { + # Ouch ! User trying to edit field he has no rights to edit! my $verb = $updating ? 'updated ' : 'specified '; return $c->$cb({error => 'You ' . $verb . $param . ', but allowed fields are only ' . join(', ', @allowed_fields)}, 403); --- a/api/v1/swagger/definitions/suggestion.json +++ a/api/v1/swagger/definitions/suggestion.json @@ -10,7 +10,7 @@ "description": "borrowernumber for the person making the suggestion, foreign key linking to the borrowers table" }, "suggesteddate": { - "type": "string", + "type": ["string", "null"], "description": "the suggestion was submitted" }, "managedby": { @@ -70,7 +70,7 @@ "description": "volume description" }, "publicationyear": { - "type": "string", + "type": ["string", "null"], "description": "year of publication" }, "place": { --