Bug 14463 - Setting autobarcode to <branch>yymm00001 exports blank barcode labels
Summary: Setting autobarcode to <branch>yymm00001 exports blank barcode labels
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: 3.20
Hardware: Other Linux
: P5 - low enhancement (vote)
Assignee: Chris Nighswonger
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-25 20:27 UTC by Lennon Mazonde
Modified: 2016-06-21 21:37 UTC (History)
2 users (show)

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


Attachments
Sample of pdf output when autobarcode is set to "<branch>yymm00001" (30.45 KB, application/pdf)
2015-06-25 20:27 UTC, Lennon Mazonde
Details
Example barcode (13.10 KB, image/png)
2015-06-28 01:49 UTC, Bernardo Gonzalez Kriegel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lennon Mazonde 2015-06-25 20:27:59 UTC
Created attachment 40640 [details]
Sample of pdf  output when autobarcode is set to "<branch>yymm00001"

Overview:

Setting the autobarcode preference in Administration to generate barcodes in the form "<branch>yymm00001" exports blank barcode labels in the Label Creator (it prints out the digit/letters but not the barcode lines)

Steps to Reproduce

1. Set barcode preference under Administration > Cataloging > Record Structure > autobarcode >  Barcodes are generated in the form "<branch>yymm00001"

2. Add items with barcodes generated using the preference above to a batch under Tools > Label Creator and export batch

3. Select any template and  layout and export

4. Download as PDF and open resulting file

Actual Results

The resulting pdf contains all the bibliographic and barcode (digits and letters) information but not the actual barcode lines. See attachment labelled "Labels without barcode"

The intranet error log (/var/log/koha/instancename/intranet-error.log) of the Koha instance produces the following error results:

[Thu Jun 25 15:24:52.560515 2015] [cgi:error] [pid 14148] [client 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015] label-create-pdf.pl: Use of uninitialized value in -e at /usr/share/koha/lib/C4/Creators/PDF.pm line 226., referer:   http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl
[Thu Jun 25 15:24:52.560758 2015] [cgi:error] [pid 14148] [client 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015] label-create-pdf.pl: ERROR in koha-conf.xml -- missing <font type="Ft2">/path/to/font.ttf</font> at /usr/share/koha/lib/C4/Creators/PDF.pm line 229., referer: http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl
[Thu Jun 25 15:24:52.578821 2015] [cgi:error] [pid 14148] [client 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015] label-create-pdf.pl: Use of uninitialized value in -e at /usr/share/koha/lib/C4/Creators/PDF.pm line 226., referer: http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl
[Thu Jun 25 15:24:52.579064 2015] [cgi:error] [pid 14148] [client 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015] label-create-pdf.pl: ERROR in koha-conf.xml -- missing <font type="Ft2">/path/to/font.ttf</font> at /usr/share/koha                      /lib/C4/Creators/PDF.pm line 229., referer: http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl

Expected Results:

Exported pdf labels should include all bibliographic and barcode data, including actual barcode lines. 

Setting the autobarcode preference to generate in the form <year>-0001, <year>-0002 results in all the data, including barcode lines, being generated and printed.

Build Date and Hardware:

Occurred in both Koha 3.18 and 3.20 running on Ubuntu Server 14.04 (both on a vps and dedicated server)

Additional Information:

I'm running a Koha install with multiple instances. Error occurs in the one instance that has autobarcode generating in <branchcode>yymm0001 and not in the other instances where it is set to generate in <year>-0001, <year>-0002


This is my first time posting a bug, please do forgive me if i've broken any bug writing guidelines :) I'm not sure what severity level to give the bug so i left it at the default.

Kind regards,

Lennon Mazonde
Comment 1 Chris Nighswonger 2015-06-25 21:14:29 UTC
(In reply to Lennon Mazonde from comment #0)

> [Thu Jun 25 15:24:52.560515 2015] [cgi:error] [pid 14148] [client
> 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015]
> label-create-pdf.pl: Use of uninitialized value in -e at
> /usr/share/koha/lib/C4/Creators/PDF.pm line 226., referer:  
> http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl
> [Thu Jun 25 15:24:52.560758 2015] [cgi:error] [pid 14148] [client
> 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015]
> label-create-pdf.pl: ERROR in koha-conf.xml -- missing <font
> type="Ft2">/path/to/font.ttf</font> at
> /usr/share/koha/lib/C4/Creators/PDF.pm line 229., referer:
> http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl
> [Thu Jun 25 15:24:52.578821 2015] [cgi:error] [pid 14148] [client
> 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015]
> label-create-pdf.pl: Use of uninitialized value in -e at
> /usr/share/koha/lib/C4/Creators/PDF.pm line 226., referer:
> http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl
> [Thu Jun 25 15:24:52.579064 2015] [cgi:error] [pid 14148] [client
> 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015]
> label-create-pdf.pl: ERROR in koha-conf.xml -- missing <font
> type="Ft2">/path/to/font.ttf</font> at /usr/share/koha                     
> /lib/C4/Creators/PDF.pm line 229., referer:
> http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl
> 

The problem appears to be that you do not have the font configuration set correctly in your koha-conf.xml. This is evident from the lines like:

ERROR in koha-conf.xml -- missing <font> type="Ft2">/path/to/font.ttf</font>

You will need to set the path to match the location of the Truetype fonts on your system.

This should fix the problem. If it does, please close the bug; otherwise, feel free to update with more information.

> 
> This is my first time posting a bug, please do forgive me if i've broken any
> bug writing guidelines :)

This is actual a fantastic bug report! Thanks for taking time to do it right. That saves loads of time when trying to figure out just what is going on.
Comment 2 Chris Nighswonger 2015-06-26 13:52:03 UTC
You may read more about the TT font pathing foo here:

http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8375#c69
Comment 3 Bernardo Gonzalez Kriegel 2015-06-26 14:14:43 UTC
(In reply to Lennon Mazonde from comment #0)

> Setting the autobarcode preference in Administration to generate barcodes in
> the form "<branch>yymm00001" exports blank barcode labels in the Label
> Creator (it prints out the digit/letters but not the barcode lines)
> 
...
> [Thu Jun 25 15:24:52.560515 2015] [cgi:error] [pid 14148] [client
> 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015]
> label-create-pdf.pl: Use of uninitialized value in -e at
> /usr/share/koha/lib/C4/Creators/PDF.pm line 226., referer:  
> http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl

Are you using EAN13 barcodes?
I think that they can only be digits, perhaps your branch code is the culprit.

From PDF::Reuse::Barcode page:

EAN13
Creates EAN13 barcodes from a string of 12 or 13 digits. The check number (the 13:th digit) is calculated if not supplied. If there is given check number it is not controlled.
Comment 4 Chris Nighswonger 2015-06-26 14:38:46 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #3)
> (In reply to Lennon Mazonde from comment #0)
> 
> > Setting the autobarcode preference in Administration to generate barcodes in
> > the form "<branch>yymm00001" exports blank barcode labels in the Label
> > Creator (it prints out the digit/letters but not the barcode lines)
> > 
> ...
> > [Thu Jun 25 15:24:52.560515 2015] [cgi:error] [pid 14148] [client
> > 197.221.240.195:38832] AH01215: [Thu Jun 25 21:24:52 2015]
> > label-create-pdf.pl: Use of uninitialized value in -e at
> > /usr/share/koha/lib/C4/Creators/PDF.pm line 226., referer:  
> > http://staffdemo.muhachabooks.com/cgi-bin/koha/labels/label-print.pl
> 
> Are you using EAN13 barcodes?
> I think that they can only be digits, perhaps your branch code is the
> culprit.
> 
> From PDF::Reuse::Barcode page:
> 
> EAN13
> Creates EAN13 barcodes from a string of 12 or 13 digits. The check number
> (the 13:th digit) is calculated if not supplied. If there is given check
> number it is not controlled.

Regardless, it will always die at the same point due to missing TTF paths in the configuration file.
Comment 5 Chris Nighswonger 2015-06-26 14:43:06 UTC
(In reply to Chris Nighswonger from comment #4)
> 
> Regardless, it will always die at the same point due to missing TTF paths in
> the configuration file.

Here is the point of failure based on the log posted:

http://tinyurl.com/orn9pnr

The missing paths cause $ttf_path->{content} to not be initialized which causes the '-e' to bork. There really should be a more graceful error handler in play here.

Of course, there may be another issue at play here as well, and that may be what Bernardo has pointed out.
Comment 6 Lennon Mazonde 2015-06-27 18:14:17 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #3)

> Are you using EAN13 barcodes?
> I think that they can only be digits, perhaps your branch code is the
> culprit.
> 

Hi Bernado, 

No i'm using Code 39. I've tried using the other barcode types available in the label creator but the problem still persists.
Comment 7 Lennon Mazonde 2015-06-27 18:54:16 UTC
(In reply to Chris Nighswonger from comment #1)
> 
> 
> The problem appears to be that you do not have the font configuration set
> correctly in your koha-conf.xml. This is evident from the lines like:
> 
> ERROR in koha-conf.xml -- missing <font> type="Ft2">/path/to/font.ttf</font>
> 
> You will need to set the path to match the location of the Truetype fonts on
> your system.
> 
> This should fix the problem. If it does, please close the bug; otherwise,
> feel free to update with more information.
> 

Hi Chris, sorry for the late response. I'm assuming 'Ft2' stands for Freetype2? I don't seem to have that font installed anywhere in my directories (/usr/share/fonts/truetype/). How do i install it (noob alert, step-by-step instructions would be appreciated)?

Note: As a test, i copied and renamed one of the fonts in /usr/share/fonts/truetype/ to 'Ft2.ttf' and set the path in koha-conf.xml to  

<font type="Ft2">/usr/share/fonts/truetype/ttf-dejavu/Ft2.ttf</font>. 

The error still occurs and the intranet error logs show the following 

ERROR in koha-conf.xml -- missing <font type="Ft1">/path/to/font.ttf</font> 

The missing font type changed from Ft2 to Ft1
Comment 8 Lennon Mazonde 2015-06-27 18:59:28 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #3)

> 
> Are you using EAN13 barcodes?
> I think that they can only be digits, perhaps your branch code is the
> culprit.
> 

If i remove the branchcode from the barcodes (using MarcEdit) and remain with digits (eg from 'phsl150004' to '150004') the barcodes print properly, which i think confirms that the problem is with the branchcode
Comment 9 Chris Nighswonger 2015-06-27 19:46:36 UTC
(In reply to Lennon Mazonde from comment #7)
> (In reply to Chris Nighswonger from comment #1)
> > 
> > 
> > The problem appears to be that you do not have the font configuration set
> > correctly in your koha-conf.xml. This is evident from the lines like:
> > 
> > ERROR in koha-conf.xml -- missing <font> type="Ft2">/path/to/font.ttf</font>
> > 
> > You will need to set the path to match the location of the Truetype fonts on
> > your system.
> > 
> > This should fix the problem. If it does, please close the bug; otherwise,
> > feel free to update with more information.
> > 
> 
> Hi Chris, sorry for the late response. I'm assuming 'Ft2' stands for
> Freetype2? I don't seem to have that font installed anywhere in my
> directories (/usr/share/fonts/truetype/). How do i install it (noob alert,
> step-by-step instructions would be appreciated)?
> 
> Note: As a test, i copied and renamed one of the fonts in
> /usr/share/fonts/truetype/ to 'Ft2.ttf' and set the path in koha-conf.xml to
> 
> 
> <font type="Ft2">/usr/share/fonts/truetype/ttf-dejavu/Ft2.ttf</font>. 
> 
> The error still occurs and the intranet error logs show the following 
> 
> ERROR in koha-conf.xml -- missing <font type="Ft1">/path/to/font.ttf</font> 
> 
> The missing font type changed from Ft2 to Ft1

The log segment you posted originally (whether or not it is related to the EAN13 issue) shows that your system is misconfigured. As you have discovered above, you will have to configure all of the required fonts in your koha-conf.xml file in order to clear the log of errors and have other things work correctly (mainly diacriticals).

The best place to get step-by-step instructions would be on the user (or maybe in this case, the developer) list. Bug 8375 may also yield some insight.

After reading your subsequent followup, I do agree with Bernardo that the root of you issue is probably EAN13 issues.

Sorry for not being more descriptive, but my time is crunched atm.
Comment 10 Bernardo Gonzalez Kriegel 2015-06-28 01:49:38 UTC
Created attachment 40698 [details]
Example barcode

As you can see, there is no problem to generate labels with barcodes as you propose, but all letters must be UpperCase. 

If not you will find a new warning: label-create-pdf.pl: Barcode generation failed for item 35 with this error: Invalid Characters, referer: http://staffdev.koha-community.org.ar/cgi-bin/koha/labels/label-print.pl
Comment 11 Bernardo Gonzalez Kriegel 2015-06-28 02:16:53 UTC
Well, after long hours debugging relevant code if found that we all were wrong

Lennon because it's possible to print barcodes in this format, but all letters must be in upper case. See the new attach.

Me because the problem has nothing to do with EAN13, or CODE39. Chris was right in that. The attached example use CODE39

Chris because there is no problem in the font configuration, the messages observed are real and have nothing to do with this problem.

I found that our previous RM Galen inserted a followup to Bug 8375,
it's addition duplicates a similar routine, that produces the messages of missing fonts Ft1 and Ft2.

So if you agree I will close this bug.
I opened a new one with a fix for the font path problem, Bug 14468,
you are welcome to test and sign.

Regards
Comment 12 Lennon Mazonde 2015-06-28 11:45:31 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #11)
> Well, after long hours debugging relevant code if found that we all were
> wrong
> 
> Lennon because it's possible to print barcodes in this format, but all
> letters must be in upper case. See the new attach.
> 
> Me because the problem has nothing to do with EAN13, or CODE39. Chris was
> right in that. The attached example use CODE39
> 
> Chris because there is no problem in the font configuration, the messages
> observed are real and have nothing to do with this problem.
> 
> I found that our previous RM Galen inserted a followup to Bug 8375,
> it's addition duplicates a similar routine, that produces the messages of
> missing fonts Ft1 and Ft2.
> 
> So if you agree I will close this bug.
> I opened a new one with a fix for the font path problem, Bug 14468,
> you are welcome to test and sign.
> 
> Regards

Thanks for all your work with the debugging. You can close this bug and i'll be keen to test Bug 14468 (and sign off on it?). 

Thanks again for your help Chris and Bernado