From bb8e2b08598fc93156caaf72e31c585be6fc22c6 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 30 Aug 2024 08:38:35 -0300 Subject: [PATCH] Bug 37791: Fix 'Biblio not found' messages on the API This patch fixes some API-related cases of 'Biblio' terminology incorrectly used. To test: 1. Run: $ ktd --shell k$ git grep 'Biblio not found' => FAIL: Several occurences 2. Run: k$ git grep 'render_resource_not_found("Biblio")' => FAIL: Several occurences 3. Apply this patches 4. Repeat 1 and 2 => SUCCESS: No more occurences! 5. Run: k$ prove t/db_dependent/api/v1/ => SUCCESS: Tests pass! 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Olivier V --- Koha/REST/V1/Biblios/ItemGroups.pm | 4 ++-- Koha/REST/V1/DeletedBiblios.pm | 2 +- Koha/REST/V1/Holds.pm | 2 +- api/v1/swagger/paths/biblios.yaml | 22 +++++++++++----------- api/v1/swagger/paths/biblios_merge.yaml | 2 +- api/v1/swagger/paths/deleted_biblios.yaml | 4 ++-- api/v1/swagger/paths/holds.yaml | 2 +- api/v1/swagger/paths/items.yaml | 2 +- t/db_dependent/api/v1/deleted_biblios.t | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Koha/REST/V1/Biblios/ItemGroups.pm b/Koha/REST/V1/Biblios/ItemGroups.pm index f855294027..8667a05eca 100644 --- a/Koha/REST/V1/Biblios/ItemGroups.pm +++ b/Koha/REST/V1/Biblios/ItemGroups.pm @@ -97,7 +97,7 @@ sub add { return try { my $biblio = Koha::Biblios->find( $c->param('biblio_id') ); - return $c->render_resource_not_found("Biblio") + return $c->render_resource_not_found("Bibliographic record") unless $biblio; my $item_group_data = $c->req->json; @@ -121,7 +121,7 @@ sub add { if ( $_->isa('Koha::Exceptions::Object::FKConstraint') and $_->broken_fk eq 'biblio_id' ) { - return $c->render_resource_not_found("Biblio"); + return $c->render_resource_not_found("Bibliographic record"); } } diff --git a/Koha/REST/V1/DeletedBiblios.pm b/Koha/REST/V1/DeletedBiblios.pm index 5fee139357..d21aa0401c 100644 --- a/Koha/REST/V1/DeletedBiblios.pm +++ b/Koha/REST/V1/DeletedBiblios.pm @@ -51,7 +51,7 @@ sub get { my $biblio = Koha::Old::Biblios->find( { biblionumber => $c->param('biblio_id') }, $attributes ); - return $c->render_resource_not_found("Biblio") + return $c->render_resource_not_found("Bibliographic record") unless $biblio; return try { diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm index bdbe6952eb..ac9979e0ba 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -133,7 +133,7 @@ sub add { unless ($biblio) { return $c->render( status => 400, - openapi => "Biblio not found." + openapi => "Bibliographic record not found" ); } diff --git a/api/v1/swagger/paths/biblios.yaml b/api/v1/swagger/paths/biblios.yaml index 005d75ec23..039fb1b52a 100644 --- a/api/v1/swagger/paths/biblios.yaml +++ b/api/v1/swagger/paths/biblios.yaml @@ -100,7 +100,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "406": @@ -155,7 +155,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "406": @@ -207,7 +207,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "409": @@ -266,7 +266,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "406": @@ -344,7 +344,7 @@ schema: $ref: ../swagger.yaml#/definitions/error "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: ../swagger.yaml#/definitions/error "406": @@ -419,7 +419,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "500": @@ -519,7 +519,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "406": @@ -702,7 +702,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "500": @@ -749,7 +749,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "406": @@ -822,7 +822,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "406": @@ -899,7 +899,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "500": diff --git a/api/v1/swagger/paths/biblios_merge.yaml b/api/v1/swagger/paths/biblios_merge.yaml index d3608ea35b..a46cdf974b 100644 --- a/api/v1/swagger/paths/biblios_merge.yaml +++ b/api/v1/swagger/paths/biblios_merge.yaml @@ -29,7 +29,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" '404': - description: Biblio not found + description: Bibliographic record not found schema: "$ref": "../swagger.yaml#/definitions/error" '401': diff --git a/api/v1/swagger/paths/deleted_biblios.yaml b/api/v1/swagger/paths/deleted_biblios.yaml index e5c6e4fff0..f4fcae318f 100644 --- a/api/v1/swagger/paths/deleted_biblios.yaml +++ b/api/v1/swagger/paths/deleted_biblios.yaml @@ -39,7 +39,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "406": @@ -94,7 +94,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "406": diff --git a/api/v1/swagger/paths/holds.yaml b/api/v1/swagger/paths/holds.yaml index 7d75826d93..abf00fd726 100644 --- a/api/v1/swagger/paths/holds.yaml +++ b/api/v1/swagger/paths/holds.yaml @@ -485,7 +485,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "409": diff --git a/api/v1/swagger/paths/items.yaml b/api/v1/swagger/paths/items.yaml index 62209a4eda..6fe27117c4 100644 --- a/api/v1/swagger/paths/items.yaml +++ b/api/v1/swagger/paths/items.yaml @@ -454,7 +454,7 @@ schema: $ref: "../swagger.yaml#/definitions/error" "404": - description: Biblio not found + description: Bibliographic record not found schema: $ref: "../swagger.yaml#/definitions/error" "500": diff --git a/t/db_dependent/api/v1/deleted_biblios.t b/t/db_dependent/api/v1/deleted_biblios.t index b0b7fbb568..2f13fb7189 100755 --- a/t/db_dependent/api/v1/deleted_biblios.t +++ b/t/db_dependent/api/v1/deleted_biblios.t @@ -103,7 +103,7 @@ subtest 'get() tests' => sub { my $biblio_exist = $builder->build_sample_biblio(); $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios/" . $biblio_exist->biblionumber => { Accept => 'application/marc' } )->status_is(404) - ->json_is( '/error', 'Biblio not found' ); + ->json_is( '/error', 'Bibliographic record not found' ); subtest 'marc-in-json encoding tests' => sub { -- 2.34.1