https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28806
--- Comment #34 from Chris Nighswonger <[email protected]> --- Created attachment 202626 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202626&action=edit Bug 28806: Fix silent label content loss for items with NULL homebranch _get_label_item() selected item, biblioitem, biblio, and branch data with implicit INNER joins, including i.homebranch = br.branchcode. An item whose homebranch is NULL (or references a deleted branch) returns no row at all, so every downstream field is empty and draw_label_text() silently skips all text lines: a BIBBAR/BIB/ALT label collapses to barcode-only output with nothing in the logs. Where version-specific code then dies on missing data, label-create-pdf.pl has already printed the CGI attachment header, so the browser receives the zero-byte PDF reported here and in several related bug reports. Convert the branches join to a LEFT JOIN, using explicit JOIN syntax for the other tables, and log a warning (rather than proceed on an empty hashref) when no row is found at all. Verified in koha-testing-docker against the label-create-pdf.pl code path: before, a BIBBAR export for a NULL-homebranch item produced barcode-only output (1343 bytes); after, the full label renders (22570 bytes, text + barcode). Output for items with valid homebranch is byte-identical before and after. Behavior is independent of PDF::Reuse version (tested 0.39 and 0.43). Test plan: 1) Create an item and NULL its homebranch: UPDATE items SET homebranch = NULL WHERE itemnumber = <n>; 2) Add the item to a label batch with a BIBBAR layout and export PDF -- without this patch the label contains only the barcode -- with this patch title/author/etc. render as expected 3) Export a batch of normal items before and after -- output is unchanged 4) prove t/db_dependent/Labels/ t/db_dependent/Patroncards/ t/Creators.t -- all tests pass AI Assistance: Claude Fable 5 (Anthropic) identified the mechanism while re-testing this bug's reports in koha-testing-docker (reproduced the NULL-homebranch data loss and the zero-byte failure mode), implemented the fix, and verified before/after behavior. Human author directed the investigation, confirmed the data-corruption theory from the bug discussion, and reviewed the change. Assisted-by: Claude Fable 5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
