Bugzilla – Attachment 188672 Details for
Bug 17387
Add an undelete feature for items/biblios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17387: add deleted biblios restore api
Bug-17387-add-deleted-biblios-restore-api.patch (text/plain), 2.86 KB, created by
Jacob O'Mara
on 2025-10-30 16:38:13 UTC
(
hide
)
Description:
Bug 17387: add deleted biblios restore api
Filename:
MIME Type:
Creator:
Jacob O'Mara
Created:
2025-10-30 16:38:13 UTC
Size:
2.86 KB
patch
obsolete
>From 7d48e7f78fb34441c795c1c4ebf05abb63311845 Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <Jacob.omara@openfifth.co.uk> >Date: Thu, 30 Oct 2025 09:54:37 +0000 >Subject: [PATCH] Bug 17387: add deleted biblios restore api > >--- > Koha/REST/V1/DeletedBiblios.pm | 26 +++++++++++++ > api/v1/swagger/paths/deleted_biblios.yaml | 45 +++++++++++++++++++++++ > 2 files changed, 71 insertions(+) > >diff --git a/Koha/REST/V1/DeletedBiblios.pm b/Koha/REST/V1/DeletedBiblios.pm >index 30c94eff220..74c62a8d6a2 100644 >--- a/Koha/REST/V1/DeletedBiblios.pm >+++ b/Koha/REST/V1/DeletedBiblios.pm >@@ -165,4 +165,30 @@ sub list { > }; > } > >+=head3 restore >+ >+Controller function that handles restoring a single deleted biblio object >+ >+=cut >+ >+sub restore { >+ my $c = shift->openapi->valid_input or return; >+ >+ my $deleted_biblio = Koha::Old::Biblios->find( $c->param('biblio_id') ); >+ >+ return $c->render_resource_not_found("Bibliographic record") >+ unless $deleted_biblio; >+ >+ return try { >+ my $biblio = $deleted_biblio->restore; >+ >+ return $c->render( >+ status => 200, >+ openapi => { biblio_id => $biblio->biblionumber } >+ ); >+ } catch { >+ $c->unhandled_exception($_); >+ }; >+} >+ > 1; >diff --git a/api/v1/swagger/paths/deleted_biblios.yaml b/api/v1/swagger/paths/deleted_biblios.yaml >index f4fcae318fc..dff1890ea9d 100644 >--- a/api/v1/swagger/paths/deleted_biblios.yaml >+++ b/api/v1/swagger/paths/deleted_biblios.yaml >@@ -118,3 +118,48 @@ > x-koha-authorization: > permissions: > catalogue: "1" >+ put: >+ x-mojo-to: DeletedBiblios#restore >+ operationId: restoreDeletedBiblio >+ tags: >+ - biblios >+ summary: Restore deleted biblio >+ parameters: >+ - $ref: "../swagger.yaml#/parameters/biblio_id_pp" >+ produces: >+ - application/json >+ responses: >+ "200": >+ description: Biblio restored successfully >+ schema: >+ type: object >+ "400": >+ description: Bad request >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ "401": >+ description: Authentication required >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ "403": >+ description: Access forbidden >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ "404": >+ description: Deleted bibliographic record not found >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ "500": >+ description: | >+ Internal server error. Possible `error_code` attribute values: >+ >+ * `internal_server_error` >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ "503": >+ description: Under maintenance >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ x-koha-authorization: >+ permissions: >+ editcatalogue: edit_catalogue >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17387
:
188670
|
188671
|
188672
|
188673
|
188674
|
188675
|
188676
|
188677
|
188678
|
188679
|
188680
|
188681
|
188682
|
188683
|
188684
|
188685
|
188686
|
188687
|
188688
|
188689
|
188690
|
188691
|
188692
|
188693
|
188694
|
188695
|
188696
|
188697
|
188698
|
188699
|
188700
|
188701
|
188780
|
188781
|
188782
|
188783
|
188784
|
188785
|
188786
|
188787
|
188788
|
188789
|
188790
|
188791
|
188792
|
188793
|
188794
|
188795
|
189046
|
189047
|
189048
|
189049
|
189050
|
189051
|
189052
|
189053
|
189054
|
189055
|
189056
|
189057
|
189058
|
189059
|
189060
|
189061
|
189062
|
189082
|
189083
|
189084
|
189085
|
189086
|
189087
|
189088
|
189089
|
189090
|
189091
|
189092
|
189093
|
189094
|
189095
|
189096
|
189097
|
189098
|
189099
|
189100
|
189101
|
189102
|
189103
|
189104
|
189105
|
189106
|
189107
|
189108
|
189109
|
189110
|
189111
|
189112
|
189113
|
189114
|
189115
|
189116
|
189117
|
189118
|
189119