Summary: | Single label PDF export not working | ||
---|---|---|---|
Product: | Koha | Reporter: | Isabel Pineda <isabel.pineda> |
Component: | Label/patron card printing | Assignee: | Chris Nighswonger <cnighswonger> |
Status: | RESOLVED DUPLICATE | QA Contact: | Testopia <testopia> |
Severity: | critical | ||
Priority: | P3 | CC: | caroline.cyr-la-rose, dcook, egpetridis, lucas |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
See Also: |
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31241 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28806 |
||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: |
Description
Isabel Pineda
2022-02-01 13:52:00 UTC
It appears to be working on master. Isabel, could you add some more information about your setup for the labels? Hi Katrin. Of course. The template is set this way: page height: 2.5 cm page width: 5 cm label width: 5.8 cm label height: 4 cm top page margin: -0.6 cm left page margin: 0 cm top text margin: 1.3 cm left text margin: 0 cm number of columns: 1 number of rows: 1 gap between columns: 0 cm gap between rows: 0 cm The label layout: barcode type: Code 39 layout type: BIBBAR Data fields: itemcallnumber Text justification: left Font: Helvetica Font size: 12 Oblique title: yes The problem is that an empty pdf file is generated when I there is only a single label. If it is a batch with at least 2 labels, it works fine. It used to work for me with single labels and the same settings before version 21.11. The problem occurs when clicking the "Export" button in the table of items, Actions column. To test: 1) If you do not already have label templates and layouts, add some (can use the settings in comment 2, but any will do) 2) Go to Tools > Label creator > New > Label batch 3) Add one barcode in the box 4) Click Add items 5) Click the 'Export full batch' button 6) Choose the label template and layout 7) Click Export 8) Click Download as PDF --> PDF is generated 9) In the label batch, select the item (the checkbox on the right) 10) Click 'Export selected items' 11) Repeat steps 6-8 --> PDF is generated 12) In the label batch, click the 'Export' button in the Actions column 13) Repeat steps 6-8 --> No PDF is generated Could this be related to https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28806 ? (In reply to Caroline Cyr La Rose from comment #3) > The problem occurs when clicking the "Export" button in the table of items, > Actions column. > > To test: > 1) If you do not already have label templates and layouts, add some (can use > the settings in comment 2, but any will do) > 2) Go to Tools > Label creator > New > Label batch > 3) Add one barcode in the box > 4) Click Add items > 5) Click the 'Export full batch' button > 6) Choose the label template and layout > 7) Click Export > 8) Click Download as PDF > --> PDF is generated > 9) In the label batch, select the item (the checkbox on the right) > 10) Click 'Export selected items' > 11) Repeat steps 6-8 > --> PDF is generated > 12) In the label batch, click the 'Export' button in the Actions column > 13) Repeat steps 6-8 > --> No PDF is generated Thank you. Yes, this way it works, at least it does now that I upgraded to version 22.05. I remember that the single export button in the table used to work in Koha 21.05 and previous versions. (In reply to Manos PETRIDIS from comment #4) > Could this be related to > https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28806 ? Thank you. No, in my case all printed characters are Latin characters. (In reply to Isabel Pineda from comment #6) > (In reply to Manos PETRIDIS from comment #4) > > Could this be related to > > https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28806 ? > > Thank you. No, in my case all printed characters are Latin characters. We are using Koha in Spanish, though. Maybe this has something to do with the problem. I am able to recreate this in current master. 1. Make a label batch. 2. Go to 'label-edit-batch.pl' and select at least one item in the table. ( #batcht ) 3. Use the 'Export' button to export at one item. 4. Choose template/layout etc. 5. Download as PDF This is the error I see: Can't locate object method "get_attr" via package "-2" (perhaps you forgot to load "-2"?) at /kohadevbox/koha/labels/label-create-pdf.pl line 127 (In reply to Lucas Gass from comment #8) > This is the error I see: > Can't locate object method "get_attr" via package "-2" (perhaps you forgot > to load "-2"?) at /kohadevbox/koha/labels/label-create-pdf.pl line 127 See the comment here: https://github.com/Koha-Community/Koha/blob/master/C4/Creators/Batch.pm#L156 What is being passed in as the batch id? (In reply to Chris Nighswonger from comment #9) > (In reply to Lucas Gass from comment #8) > > > This is the error I see: > > Can't locate object method "get_attr" via package "-2" (perhaps you forgot > > to load "-2"?) at /kohadevbox/koha/labels/label-create-pdf.pl line 127 > > See the comment here: > > https://github.com/Koha-Community/Koha/blob/master/C4/Creators/Batch.pm#L156 > > What is being passed in as the batch id? At a minimum this error should be trapped here: https://github.com/Koha-Community/Koha/blob/master/labels/label-create-pdf.pl#L59 (In reply to Chris Nighswonger from comment #9) > (In reply to Lucas Gass from comment #8) > > > This is the error I see: > > Can't locate object method "get_attr" via package "-2" (perhaps you forgot > > to load "-2"?) at /kohadevbox/koha/labels/label-create-pdf.pl line 127 > > See the comment here: > > https://github.com/Koha-Community/Koha/blob/master/C4/Creators/Batch.pm#L156 > > What is being passed in as the batch id? The URL to create the PDF should similar to this: https://jl-staff.campus.foundations.edu/cgi-bin/koha/labels/label-create-pdf.pl?batch_id=858&template_id=1&layout_id=5&start_label=1&label_id=25498 If batch_id is non-existent or an invalid value, C4::Creators::Batch->retrieve will return -2. (In reply to Lucas Gass from comment #8) > I am able to recreate this in current master. > > 1. Make a label batch. > 2. Go to 'label-edit-batch.pl' and select at least one item in the table. ( > #batcht ) batch_id originates from element_id passed in to label-edit-batch.pl. ie. https://jl-staff.campus.foundations.edu/cgi-bin/koha/labels/label-edit-batch.pl?op=edit&element_id=858 > 3. Use the 'Export' button to export at one item. > 4. Choose template/layout etc. The fact that you are able to get this far would seem to indicate that a valid batch_id is being passed in to this point. > 5. Download as PDF > > This is the error I see: > Can't locate object method "get_attr" via package "-2" (perhaps you forgot > to load "-2"?) at /kohadevbox/koha/labels/label-create-pdf.pl line 127 It appears that by the time you get to this point, the batch_id has become corrupted somehow. Please post both the label-edit-batch.pl URL and the label-create-pdf-pl URL for your failure case. If one of the folks experiencing this issue could post both the label-edit-batch.pl URL and the label-create-pdf.pl URL for your failure case, please. Also, please post the output from the following query limited by the batch_id of your failure case: SELECT * FROM creator_batches WHERE batch_id=<your-batch_id-here>; (In reply to Caroline Cyr La Rose from comment #3) > The problem occurs when clicking the "Export" button in the table of items, This is important. There are two separate JS functions which are attached to these export "options." The Export button triggers one[1] while the 'Export selected items' triggers another[2]. In the former, batch_id is passed in via a TT variable; in the latter it is extracted from the data value of the element. I wonder if the latter is munged up somehow... If so, this could explain the discrepancy I mentioned in comment #12. So what we need to see is the resulting URL generated by each of these functions. Perhaps someone with the issue can grab these from the network tab in the browser debug console and post them here? [1] https://github.com/Koha-Community/Koha/blob/cdf34ce15603edfee5453ce7b232d2ceb0aa61e7/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt#L353 [2] https://github.com/Koha-Community/Koha/blob/cdf34ce15603edfee5453ce7b232d2ceb0aa61e7/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt#L364 Former and latter should be swapped in comment #14... where's the edit comment options when you need it? ;-P *** This bug has been marked as a duplicate of bug 31220 *** Good catch. Thanks! |