Bug 38962 - Make bulkmarcimport.pl import records properly
Summary: Make bulkmarcimport.pl import records properly
Status: RESOLVED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low critical
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-24 08:09 UTC by Magnus Enger
Modified: 2025-01-24 12:24 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2025-01-24 08:09:24 UTC
To reproduce in KTD: 

- Find a record in the staff client
- Save the record as MARCXML
- Import the record with bulkmarcimport.pl:

perl /usr/share/koha/bin/migration_tools/bulkmarcimport.pl -b -v -m --file my_record.marcxml

- Log into the database and look at the last record added: 

MariaDB [koha_kohadev]> select * from biblio_metadata where biblionumber = (SELECT max(biblionumber) FROM biblio_metadata)\G
*************************** 1. row ***************************
              id: 442
    biblionumber: 444
          format: marcxml
          schema: MARC21
        metadata: <?xml version="1.0" encoding="UTF-8"?>
<record
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
    xmlns="http://www.loc.gov/MARC21/slim">

  <leader>00080    a2200049   4500</leader>
  <controlfield tag="005">20250124080114.0</controlfield>
  <datafield tag="999" ind1=" " ind2=" ">
    <subfield code="c">444</subfield>
    <subfield code="d">444</subfield>
  </datafield>
</record>

       timestamp: 2025-01-24 08:01:14
record_source_id: NULL
1 row in set (0.000 sec)

Only MARC fields 005 and 999 are present.
Comment 1 Jan Kissig 2025-01-24 09:06:34 UTC
I can confirm the the dubious behavior on 24.12.00.005
Comment 2 Katrin Fischer 2025-01-24 09:18:31 UTC
That is... not really good? Upping severity.
Is this limited to MARCXML or also happens with .mrc?
Comment 3 Magnus Enger 2025-01-24 09:25:34 UTC
I only tested MARCXML.
Comment 4 Jan Kissig 2025-01-24 11:42:43 UTC
I just rechecked and I think the problem was sitting in front of the keyboard :)

The command was missing the value for -m which then defaults to ISO2709

perl /usr/share/koha/bin/migration_tools/bulkmarcimport.pl -b -v -m --file my_record.marcxml'

It should be 

perl /usr/share/koha/bin/migration_tools/bulkmarcimport.pl -b -v -m=MARCXML --file my_record.marcxml
Comment 5 Magnus Enger 2025-01-24 12:14:33 UTC
Oh my! I had -m, but I didn't actually provide a value for it... *facepalm*
Comment 6 Katrin Fischer 2025-01-24 12:23:57 UTC
You know what? Better this way than it being a bad bad bug :)