Bug 12590 - Support deletion of biblio in svc API
authorPetter Goksoyr Asen <boutrosboutrosboutros@gmail.com>
Thu, 17 Jul 2014 08:55:20 +0000 (10:55 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 27 Oct 2014 14:13:49 +0000 (11:13 -0300)
commitca756f44d76df3074b4b53c97898f26ede65a711
treee83b0c3bc08dbeff0e924bd4cc3062012904f3df
parent5ff9f513ed6b901099571c89cd716f9248332729
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.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
svc/bib