c60a6d8cd9
+ attached items, subscriptions etc via the API as an alternative to the web interface: cgi-bin/koha/cataloguing/merge.pl This is a slightly improved version of Zenos patch: I (domm) have converted the code in Koha::Biblio to a more DBICy style and packed it into a transaction (as requested in Comment 23) Even the QA script is happy now! To test: 1) you need an API user with the permissions "editcatalogue" 2) two records: one to be merged into (with biblio_id, eg 262) and another one from which to merge (with biblio_id_to_merge, eg 9) which will be deleted! both records may/should have items, subscription, subscriptionhistory, serial, suggestions orders and holds 3) check both records via the web 4) Apply patch 5) Write a JSON file with inside the field 'biblio_id_to_merge' and the biblionumber from wihich to merge. As example: { "biblio_id_to_merge" : 9 } 6) Execute an API call with correct headers and location. For example: curl -s -u koha:koha --header "Content-Type: application/json" --header "Accept: application/marc-in-json" --request POST "http://127.0.0.1:8080/api/v1/biblios/262/merge" -d @file.json You must to setup the headers and to use a json file with parameters 7) The record with the id 9 is deleted now, the record with 262 has all items, etc attached, the return is: return code 200 and the changed record 262 in marc-in-json format 8) It is possible to override biblio data with an external bib record. You need to put external bib record into the json file in marc-in-json format. To write use the json file uploaded as example You need to fill the fields 'rules' and 'datarecord'. The field 'rules' must contains 'override_ext' To do the call: curl -s -u koha:koha --header "Content-Type: application/json" --header "Accept: application/marc-in-json" --request POST "http://127.0.0.1:8080/api/v1/biblios/XXX/merge" -d @file_with_recod.json 9) The record in 'biblio_id_to_merge' is deleted now, in biblio XXX now there are the bibliographic data of field 'datarecord' of json file, the return is: return code 200 and the changed record XXX in marc-in-json format 10) Go into intranet and do a search. Select two or (better) more record. 11) Merge them; merge must be a success. 12) Test with prove -v t/db_dependent/Koha/Biblio.t 13) Test with prove -v t/db_dependent/api/v1/biblios.t To test with curl the step 8 you can customize the json file attached in bugzilla. The marc-in-json record inside follows the MAR21 standard Sponsored-by: Technische Hochschule Wildau Co-authored-by: Zeno Tajoli <ztajoli@gmail.com> Co-authored-by: Thomas Klausner <domm@plix.at> Co-authored-by: Mark Hofstetter <<mark@hofstetter.at>> Signed-off-by: Jan Kissig <jkissig@th-wildau.de> Bug 33036: Update of test number. File ../biblios.t was update with a new subutest. So we need this update to have a 'OK' after test running. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
28 lines
1 KiB
YAML
28 lines
1 KiB
YAML
---
|
|
type: object
|
|
properties:
|
|
biblio_id_to_merge:
|
|
type: integer
|
|
description: Biblionumber from which to merge
|
|
rules:
|
|
type:
|
|
- string
|
|
- "null"
|
|
description: Internally identifier of a merge algoritm. Now two identifier are supported, 'override' and 'override_ext'.
|
|
'override' is to use when you the bibliographic data of biblio_id as resulting bibliographic data. The null value is equivalent
|
|
of 'override'.
|
|
'override_ext' is to use only with a value in datarecord field. In fact is mandatory to use if you insert a record inside datarecord field.
|
|
framework_to_use:
|
|
type:
|
|
- string
|
|
- "null"
|
|
description: Framework code, you can use it only with a value in datarecord field. With null value it uses the framework
|
|
code of record to be merged into.
|
|
datarecord:
|
|
description: Bibliographic record used as result of the merge. It uses the format MARC-in-JSON
|
|
type:
|
|
- object
|
|
- "null"
|
|
additionalProperties: false
|
|
required:
|
|
- biblio_id_to_merge
|