Bug 32923: Fix x-koha-embed from EHoldings/*/*
We were validating twice the input and it broke the x-koha-embed header.
I don't really know what's happening, but here is how to recreate the
problem:
1. Edit Koha/REST/V1/ERM/EHoldings/Packages/EBSCO.pm
2. Add the following lines in Koha/REST/V1/ERM/EHoldings/Packages/EBSCO.pm, in the list method
warn $c->req->headers->header('x-koha-embed');
3. curl -v -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/erm/eholdings/ebsco/packages --header "x-koha-embed: resources+count,vendor"
=> There is no vendor in the response
=> The warn displays "resources+count"
If you apply this patch you will notice that "vendor" is part of the
response and the warn displays "resources+count, vendor"
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 855e09163a
)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
parent
89ae006532
commit
2f27e2c34a
6 changed files with 21 additions and 21 deletions
|
@ -26,7 +26,7 @@ use Scalar::Util qw( blessed );
|
|||
use Try::Tiny qw( catch try );
|
||||
|
||||
sub list {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
|
||||
|
@ -87,7 +87,7 @@ sub list {
|
|||
}
|
||||
|
||||
sub get {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my ( $vendor_id, $package_id ) = split '-',
|
||||
|
@ -119,7 +119,7 @@ sub get {
|
|||
}
|
||||
|
||||
sub edit {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my $body = $c->validation->param('body');
|
||||
|
|
|
@ -33,7 +33,7 @@ use Try::Tiny qw( catch try );
|
|||
=cut
|
||||
|
||||
sub list {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
return try {
|
||||
my $packages_set =
|
||||
Koha::ERM::EHoldings::Packages->search( { 'me.external_id' => undef } );
|
||||
|
@ -50,7 +50,7 @@ sub list {
|
|||
=cut
|
||||
|
||||
sub get {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my $package_id = $c->validation->param('package_id');
|
||||
|
@ -81,7 +81,7 @@ Controller function that handles adding a new Koha::ERM::EHoldings::Package obje
|
|||
=cut
|
||||
|
||||
sub add {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
Koha::Database->new->schema->txn_do(
|
||||
|
@ -147,7 +147,7 @@ Controller function that handles updating a Koha::ERM::EHoldings::Package object
|
|||
=cut
|
||||
|
||||
sub update {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
my $package_id = $c->validation->param('package_id');
|
||||
my $package = Koha::ERM::EHoldings::Packages->find( $package_id );
|
||||
|
@ -217,7 +217,7 @@ sub update {
|
|||
=cut
|
||||
|
||||
sub delete {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
my $package = Koha::ERM::EHoldings::Packages->find( $c->validation->param('package_id') );
|
||||
unless ($package) {
|
||||
|
|
|
@ -34,7 +34,7 @@ use Try::Tiny;
|
|||
=cut
|
||||
|
||||
sub list {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
|
||||
|
@ -121,7 +121,7 @@ sub list {
|
|||
=cut
|
||||
|
||||
sub get {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my ( $vendor_id, $package_id, $resource_id ) = split '-',
|
||||
|
@ -177,7 +177,7 @@ sub get {
|
|||
=cut
|
||||
|
||||
sub edit {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my $body = $c->validation->param('body');
|
||||
|
|
|
@ -33,7 +33,7 @@ use Try::Tiny qw( catch try );
|
|||
=cut
|
||||
|
||||
sub list {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my $package_id = $c->validation->param('package_id');
|
||||
|
@ -57,7 +57,7 @@ Controller function that handles retrieving a single Koha::ERM::EHoldings::Resou
|
|||
=cut
|
||||
|
||||
sub get {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my $resource_id = $c->validation->param('resource_id');
|
||||
|
|
|
@ -34,7 +34,7 @@ use Try::Tiny qw( catch try );
|
|||
=cut
|
||||
|
||||
sub list {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
|
||||
|
@ -114,7 +114,7 @@ sub list {
|
|||
=cut
|
||||
|
||||
sub get {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my $title_id = $c->validation->param('title_id');
|
||||
|
|
|
@ -34,7 +34,7 @@ use Try::Tiny qw( catch try );
|
|||
=cut
|
||||
|
||||
sub list {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my $titles_set = Koha::ERM::EHoldings::Titles->new;
|
||||
|
@ -54,7 +54,7 @@ Controller function that handles retrieving a single Koha::ERM::EHoldings::Title
|
|||
=cut
|
||||
|
||||
sub get {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
my $title_id = $c->validation->param('title_id');
|
||||
|
@ -84,7 +84,7 @@ Controller function that handles adding a new Koha::ERM::EHoldings::Title object
|
|||
=cut
|
||||
|
||||
sub add {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
return try {
|
||||
Koha::Database->new->schema->txn_do(
|
||||
|
@ -150,7 +150,7 @@ Controller function that handles updating a Koha::ERM::EHoldings::Title object
|
|||
=cut
|
||||
|
||||
sub update {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
my $title_id = $c->validation->param('title_id');
|
||||
my $title = Koha::ERM::EHoldings::Titles->find( $title_id );
|
||||
|
@ -217,7 +217,7 @@ sub update {
|
|||
=cut
|
||||
|
||||
sub delete {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
my $title = Koha::ERM::EHoldings::Titles->find( $c->validation->param('title_id') );
|
||||
unless ($title) {
|
||||
|
@ -244,7 +244,7 @@ sub delete {
|
|||
=cut
|
||||
|
||||
sub import_from_list {
|
||||
my $c = shift->openapi->valid_input or return;
|
||||
my $c = shift or return;
|
||||
|
||||
my $body = $c->validation->param('body');
|
||||
my $list_id = $body->{list_id};
|
||||
|
|
Loading…
Reference in a new issue