[Koha] Koha won't import items when importing MARC records

Caroline Cyr La Rose caroline.cyr-la-rose at inlibro.com
Sat Jul 1 06:03:20 NZST 2023

Hi Kevin,

Whenever I have this problem, it's because the branchcode doesn't exist.

Is PRBHS a branchcode in your system?

I also noticed your first 952 has $bStory Collection. Is that a typo 
from when you copied, or is this the actual value? If so, then Story 
Collection needs to be a branchcode also.

I'm not sure if the system would block for a lack of item type, but I 
noticed your 952's don't have item types ($y) either. I don't *think* it 
would block if there are no item types, it would probably block if the 
item type code was wrong, but you might have problems later in 
circulation if your items don't have item types.

Good luck with your project!


On 2023-06-30 13:20, Furst, Kevin wrote:
> Hello,
> TL;DR = When importing MARC records, items don't import and fail.
> I am transitioning from Follett Destiny to Koha. After doing a MARC export
> from Follett, I noticed that when staging records for import, Koha would
> parse the biblio records fine but wouldn't find any item records. After
> searching past messages in this list, I found that Follett has item records
> as 852 instead of 952. I used MARCedit to change those to 952 and also
> added a and b records to match the libraries listed in Koha. After doing
> that and trying again, item records were then found during staging.
> However when I import the staged records, it just fails and gives me
> nothing in the detailed messages in the UI. If I remove the 952 records, it
> works fine and imports all the other records thus I know something is wrong
> with my 952 entries. I have checked that there are p barcodes and a and b
> home and current libraries.
> In the Koha logs on the server, this is the only error message I get when I
> try to run an import and it fails.  To me it seems like a FK is missing on
> import but I don't know what. Looking at the schema example, I'm wondering
> if I'm supposed to be importing things to 942 and 999 along with 952. I do
> not know if, when importing MARC records, Koha creates its own enumerated
> ids for biblio, item number, etc. if that stuff isn't in the import file...
> or if it isn't there, will it fail?
> BIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
> execute failed: Cannot add or update a child row: a foreign key constraint
> fails (`koha_library`.`items`, CONSTRAINT `items_ibfk_>
> Broken FK constraint at
> /usr/share/koha/lib/Koha/BackgroundJob/MARCImportCommitBatch.pm line 91.
> Here are a couple of 952 records from the Follett export to Koha import
> file to see if something simple is wrong. I'm hoping it's something simple
> on these lines.
> =952  \\$p34517100010472$aPRBHS$bPRBHS$bStory
> Collection$v10.00USD$x14441$eaRegular at c20060929@fTransfer from PRB Elem. at j
> @j at j@i at i@i$hSC Otf$x1127380
> =952  \\$p3333300007200O$aPRBHS$bPRBHS$v20.00USD$x17292$eaRegular at c20050604
> @j at j@j at i@i at i$hR 639 Can pb$x527111
> (Beyond that, I haven't really tinkered with anything in the default MARC
> framework settings in admin.
> Here is my version :
> *Koha version: Rosalie*
> I would really appreciate any help, I've been working on this for over a
> week now.
> *Kevin Furst*
> Technology Director
> Pine River-Backus Schools
> o | 218.587.8030
> @ | kfurst at prbschools.org
> Technology Office/Help Desk:  218-587-8510
> *Confidentiality Notice: This E-mail message, including any attachments, is
> for the sole use of the intended recipient(s) and may contain confidential
> and privileged information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the intended recipient, please
> contact the sender by reply E-mail and destroy all copies of the original
> message.*
> _______________________________________________
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha

Caroline Cyr-La-Rose, M.L.I.S. (she/her)
Librarian | Product Manager

1-833-INLIBRO (465-4276), ext. 221
caroline.cyr-la-rose at inlibro.com

More information about the Koha mailing list