Bug 34157 - Exporting labels as a barcode range can cause 500 error
Summary: Exporting labels as a barcode range can cause 500 error
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Chris Nighswonger
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-29 18:30 UTC by Lucas Gass
Modified: 2024-02-19 19:46 UTC (History)
3 users (show)

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


Attachments
Bug 34157: Exporting labels as a barcode range can cause 500 error (2.35 KB, patch)
2024-02-19 19:46 UTC, Matthias Le Gac
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass 2023-06-29 18:30:34 UTC
To recreate:
 
1. Make or edit a label layout. For "Choose layout type:" select " Bibliographic data precedes barcode".
2. Label creator > New > Barcode range
3. Choose a barcode range.
4. Choose the layout from above.
5. 500 error:

Can't call method "metadata" on an undefined value at /usr/share/koha/lib/C4/Labels/Label.pm line 342.


Seems like this is related to Bug 29697.
Comment 1 Katrin Fischer 2023-07-16 13:36:08 UTC
I am not sure about this one. 

I was thinking of barcode range as a feature to pre-produce labels. So you can than add them to the items and scan them in at the same time when cataloguing.

I believe as the range allows for you to enter any number and isn't linking to existing items, it probably won't/can't work with labels using bibliographic information.

Maybe we need to catch this in a nicer way?
Comment 2 Heather 2023-07-17 18:54:57 UTC
We stumbled on this bug.  Yes--we use printing a barcode range to pre-produce labels, to put on an item and then wand in to an item record (e.g., receiving a serial issue, cataloging a book, etc.)  But we want our library name on the barcode, so were experimenting with trying to get our library name on the label and discovered this "500 error."

Our experimenting is related to bug 31507, "When printing barcode range labels library name does not print."

--h2
Comment 3 Katrin Fischer 2023-07-17 20:53:08 UTC
Hi Heather, thx for commenting, that makes a lot of sense actually. I think this is bug 12316 (that I closed prematurely not thinking of this use case).
Comment 4 Heather 2023-07-17 20:58:10 UTC
And thank you for mentioning that other bug, Katrin--I'll go comment on that one!

Cheerio!
h2
Comment 5 Marie-Luce Laflamme 2024-02-08 16:54:39 UTC
Same here. Barcode range is mainly used to print them in advance. Strangely, the same barcode range can't have different results.
When we stick to just barcodes in the layout, it works like a charm. But if we add free text (e.g. 'City library') in the there, we hit a 500 error.
Comment 6 Marie-Luce Laflamme 2024-02-08 17:37:42 UTC
The layout option 'bibliographic data precedes barcode' appears to rely on itemnumber, which it isn't ideal when printing a barcode range.



Before the test

Layout
- Add a new layout including free text
- choose layout type: 'bibliographic data precedes barcode'
- Add text between quotation marks in the list fields  (e.g. 'Centrale library')
- Save

Itemnumber check
- Find your database max(itemnumber)


Barcode check
- Find a barcode range 1 that is not currently in your database
    notes:  max(barcode) can be a good start.
            This range should be smaller < than max(itemnumber)
- Find another barcode range 2 that is not currently in your database
        This second range of numbers should be larger > than max(itemnumber)

Test plan
1. In Label creator > Add > Barcode range
2. Enter your barcode range 1; the one smaller < max(itemnumber)
3. Click on "Print range"
4. Choose the layout from above
5. Click on "Export"
6. View the pdf
  --> ok, Koha is printing text on each label   
7. Redo steps 2 to 3 with the barcode range 2; the one larger > max(itemnumber)
8. Select the DEFAULT layout
9. Check the pdf
  --> Koha generate all barcodes correctly
10. Keep your barcode range 2 and redo steps 2 to 3, but...
11. Select the layout with text previously added
12. Check the pdf
  --> Koha open up a 500 error page or empty page
Comment 7 Matthias Le Gac 2024-02-19 19:46:16 UTC
Created attachment 162282 [details] [review]
Bug 34157: Exporting labels as a barcode range can cause 500 error

The layout option 'bibliographic data precedes barcode' appears to rely on itemnumber, which it isn't ideal when printing a barcode range.



Before the test

Layout
- Add a new layout including free text
- choose layout type: 'bibliographic data precedes barcode'
- Add text between quotation marks in the list fields  (e.g. 'Centrale library')
- Save

Itemnumber check
- Find your database max(itemnumber)


Barcode check
- Find a barcode range 1 that is not currently in your database
    notes:  max(barcode) can be a good start.
            This range should be smaller < than max(itemnumber)
- Find another barcode range 2 that is not currently in your database
        This second range of numbers should be larger > than max(itemnumber)

Test plan
1. In Label creator > Add > Barcode range
2. Enter your barcode range 1; the one smaller < max(itemnumber)
3. Click on "Print range"
4. Choose the layout from above
5. Click on "Export"
6. View the pdf
  --> ok, Koha is printing text on each label   
7. Redo steps 2 to 3 with the barcode range 2; the one larger > max(itemnumber)
8. Select the DEFAULT layout
9. Check the pdf
  --> Koha generate all barcodes correctly
10. Keep your barcode range 2 and redo steps 2 to 3, but...
11. Select the layout with text previously added
12. Check the pdf
  --> Koha open up a 500 error page or empty page
13. apply the patch
14. Perform the same steps as before, but this time without encountering any errors. Koha is printing text on each label during step 12.