[Koha-bugs] [Bug 33036] REST API: Merge biblio records

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sun Nov 19 20:27:54 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33036

Thomas Klausner <domm at plix.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #159103|0                           |1
        is obsolete|                            |

--- Comment #33 from Thomas Klausner <domm at plix.at> ---
Created attachment 159120
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=159120&action=edit
Bug 33036: REST API: Merge biblio records implements merging of records +
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 at gmail.com>
Co-authored-by: Thomas Klausner <domm at plix.at>
Co-authored-by: Mark Hofstetter <<mark at hofstetter.at>>
Signed-off-by: Jan Kissig <jkissig at th-wildau.de>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list