https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18611 Bug ID: 18611 Summary: Create labels action fails in manage-marc-import.pl if an item has been deleted from the import batch. Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Label/patron card printing Assignee: cnighswonger@foundations.edu Reporter: barton@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org On the manage marc import screen, clicking Import Batch on a batch containing a deleted item gives the message "Error attempting to create label batch. Please ask your system administrator to check the log for more details.", and creates an empty PDF file. To replicate: 1) Import a marc record including items. 2) Delete one of the items in the batch. 3) In Home › Tools › Manage staged MARC records, click '(Create label batch)' on the batch in question. 4) This will show the message "Error attempting to create label batch. Please ask your system administrator to check the log for more details." The logs in /var/log/koha/INSTANCE/intranet-error.log will look like this: 123456 [Mon May 15 11:14:21.848772 2017] [cgi:error] [pid 15635] [client a.b.c.d:xxxxx] AH01215: [Mon May 15 11:14:21 2017] manage-marc-import.pl: DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_xyzzy`.`creator_batches`, CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE) [for Statement "INSERT INTO creator_batches (batch_id, item_number, branch_code, creator) VALUES (?,?,?,?);" with ParamValues: 0=164, 1=123456, 2="APL", 3='Labels'] at /usr/share/koha/lib/C4/Creators/Batch.pm line 69., referer: http://asdfsadf... [Mon May 15 11:14:21.849012 2017] [cgi:error] [pid 15635] [client a.b.c.d:xxxxx] AH01215: [Mon May 15 11:14:21 2017] manage-marc-import.pl: Database returned the following error on attempted INSERT: Cannot add or update a child row: a foreign key constraint fails (`koha_xyzzy`.`creator_batches`, CONSTRAINT `creator_batches_ibfk_3` FOREIGN KEY (`item_number`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE) at /usr/share/koha/lib/C4/Creators/Batch.pm line 71., referer: http://asdfsadf... [Mon May 15 11:14:21.849147 2017] [cgi:error] [pid 15635] [client a.b.c.d:xxxxx] AH01215: [Mon May 15 11:14:21 2017] manage-marc-import.pl: create_labelbatch_from_importbatch() : Error attempting to add item #123456 of import batch #11048 to label batch. at /usr/share/koha/intranet/cgi-bin/tools/manage-marc-import.pl line 198., referer: http://asdfsadf ... I think we need to have /usr/share/koha/lib/C4/Creators/Batch.pm exclude items where the itemnumber is null. -- You are receiving this mail because: You are watching all bug changes.