Bugzilla – Attachment 32736 Details for
Bug 12590
Support deletion of biblio in svc API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12590 - Support deletion of biblio in svc API
PASSED-QA-Bug-12590---Support-deletion-of-biblio-i.patch (text/plain), 3.09 KB, created by
Katrin Fischer
on 2014-10-25 18:23:54 UTC
(
hide
)
Description:
[PASSED QA] Bug 12590 - Support deletion of biblio in svc API
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-10-25 18:23:54 UTC
Size:
3.09 KB
patch
obsolete
>From f6b32b5f8f72c2a0aea356db272f5cd3be244c58 Mon Sep 17 00:00:00 2001 >From: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com> >Date: Thu, 17 Jul 2014 10:55:20 +0200 >Subject: [PATCH] [PASSED QA] Bug 12590 - Support deletion of biblio in svc API > >The /svc endpoint allows you to create and update biblio records. >This patch extends it so that it is also possible to delete a biblio. > >Test plan >* Create a new biblio by sending a POST request to /svc/new_bib with a > marcxml record as request body. Note the biblionumber it gets assigned. >* Make some changes to the marcxml record, and update it by sending > a POST request to /svc/bib/{bibilonumber} >* Observe that the changes are persisted on the biblio record. >* Now delete the bilblio by sending a DELETE request to > /svc/bib/{biblionumber} >* Observe that the biblio is indeed gone from the db. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >This works as described and passes tests and QA script. >I tested using curl for a record with and one without items: > >curl -X DELETE 'http://localhost:8080/cgi-bin/koha/svc/bib/2' --cookie /tmp/svc.cookies ><?xml version='1.0' standalone='yes'?> ><response> > <error>This Biblio has items attached, please delete them first before deleting this biblio </error> ></response> > >curl -X DELETE 'http://localhost:8080/cgi-bin/koha/svc/bib/3' --cookie /tmp/svc.cookies ><?xml version='1.0' standalone='yes'?> ><response> > <status>OK, biblio deleted</status> ></response> > >The deletion is processed correctly and the indexes are updated. >--- > svc/bib | 25 +++++++++++++++++++++++-- > 1 file changed, 23 insertions(+), 2 deletions(-) > >diff --git a/svc/bib b/svc/bib >index 8f6a168..d7cd169 100755 >--- a/svc/bib >+++ b/svc/bib >@@ -48,11 +48,17 @@ if ($path_info =~ m!^/(\d+)$!) { > print $query->header(-type => 'text/xml', -status => '400 Bad Request'); > } > >-# are we retrieving or updating a bib? >+# are we retrieving, updating or deleting a bib? > if ($query->request_method eq "GET") { > fetch_bib($query, $biblionumber); >-} else { >+} elsif ($query->request_method eq "POST") { > update_bib($query, $biblionumber); >+} elsif ($query->request_method eq "DELETE") { >+ delete_bib($query, $biblionumber); >+} else { >+ print $query->header(-type => 'text/xml', -status => '405 Method not allowed'); >+ print XMLout({ error => 'Method not allowed' }, NoAttr => 1, RootName => 'response', XMLDecl => 1); >+ exit 0; > } > > exit 0; >@@ -120,3 +126,18 @@ sub update_bib { > > print XMLout($result, NoAttr => 1, RootName => 'response', XMLDecl => 1, NoEscape => $do_not_escape); > } >+ >+sub delete_bib { >+ my $query = shift; >+ my $biblionumber = shift; >+ my $error = DelBiblio($biblionumber); >+ >+ if (defined $error) { >+ print $query->header(-type => 'text/xml', -status => '400 Bad request'); >+ print XMLout({ error => $error }, NoAttr => 1, RootName => 'response', XMLDecl => 1); >+ exit 0; >+ } >+ >+ print $query->header(-type => 'text/xml'); >+ print XMLout({ status => 'OK, biblio deleted' }, NoAttr => 1, RootName => 'response', XMLDecl => 1); >+} >-- >1.9.1
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 12590
:
29786
|
32697
| 32736