When wrapping long lines of text, the line is divided by removing each
word from the end of the line and putting it in a new one until the line
is the right width. When the word to be removed appears multiple time
in the line, it is not the last occurrence that is removed.
This patch changes the regular expression used to remove the part of
the text that is wrapped to a new line, making sure it removes it at
the end of the text.
Test plan:
1. Go to Tools > Patron card creator
2. Have a card template and a card batch
-> If needs be, you can create them by using
New > Card template or New > Card batch
3. Create a layout and use one text field containing a long text with
at least one word which is repeated a minimum of 2 times
(preferably towrdds the end of the text, since it has to be picked
as one of the words to appear in the new line). You can use this:
one two three one two three one two three one two three
one two three one two three one two three one two three ...
4. Go to Manage > Card batches and export a batch
5. Choose the layout set up in 3.
6. Click the Export button and open the resulting pdf file
7. Notice all the repeated word have been grouped
-> For this example : all of the ones appear first, followed by
all the twos and only then the threes.
8. Apply patch
9. Repeat step 4 through 7
=> this time the order of the words has not changed!
Signed-off-by: Gabriel DeCarufel <gabriel@inlibro.com>
Signed-off-by: William Frazilien <william.frazilien@inlibro.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Text fields in Patron Card Text Layouts can contain regular
expression metacharacters, which - instead of being treated as
literal values - are interpreted and prevent line wrapping. This
causes the process to get stuck in an infinite loop, which keeps
running even after the web server has timed out (at least when
using CGI).
This patch escapes the relevant input from the text field so the
regular expression substitution treats characters as literals
instead of as metacharacters.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
== Test plan ==
This is an oversimplification of a full patron card setup used in production.
1. Create a batch with 1 patron
2. Create a layout and set
the name
"Print card number as barcode"
"Barcode type:" to "Code 39"
3. Create a card template without filling anything
4. Export the batch using the layout and template
5. You should have a white page with a barcode
And no errors in the relevant log file
This show that this setup isn't completely bogus
(although Code 39 is the only type working...)
6. Layout: set "Barcode type:" to Industrial2of5
7. Export the batch
8. You should have a white page with no barcode
And errors in the relevant log file
"Invalid Characters"
This is the bug.
9. Layout: set "Barcode type:" to COOP2of5
10. Export the batch
11. You should have a white page with no barcode
And errors in the relevant log file
"Invalid Characters"
This is the bug.
12. Apply this patch
13. Retry with both non-working patches
1. You should have a white page with a barcode
2. And no errors in the relevant log file
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This patch simply adds POD descriptions to subs affected by first patch.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
To reproduce:
Text, images and barcode positions are always layed out based on PostScript points, regardless of unit defined in card layout.
To reproduce:
- Test on top of Bug 18541 (introduces layout grid)
- Create a card layout with a text field, an image and a barcode. Use points
as layout unit
- Activate layout grid
- Create PDF output, save
- Change layout unit to mm
- Create PDF output, save
- Compare PDFs. Verify that the positions are unchanged (still using points)
To test:
- Apply patch
- Create again PDF
- Verify that elements are positionad as expected (using unit, e.g. mm)
- Bonus test: Repeat with other units
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Add description to POD for draw_guide_grid
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: Moved the description from draw_guide_box to .._grid.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Just adding the POD framework to make qa tools happy. The authors
are encouraged to complete this information.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Add a layout grid to patron card creator to figure out the positions of text
fields, barcode and images.
To test:
- Apply on top of patch 18465
- Go to Home > Tools > Patron card creator
- Edit or create a layout
- Turn on new choice 'Guide grid' in section 'General settings'
- Leave 'Units' unchanged
- Crate a PDF using 'Card batches'
- Notice that card is printed with a layout grid that reflects selected unit
with each 5th and 10th line in different color, unit description displayed
bottom left, card dimensions displayed top right in small print inside the
layout grid
- Print PDF. Set printer settings in Adobe Reader or other PDF printing
software to 'Actual size' to prevent scaling to printer's printable
region
- Mesure out printed PDF and verify that grid corresponds to selecte unit.
- Go back to layout definition and choose an other unit, repeat steps
to verify that grid respects selected unit.
- Go back to layout definition, turn grid off, create PDF, verify that grid
does not display in PDF
Note for testers / QAers: Position of card elements (text, image...) do not
respect the unit, this will be fixed in Bug 18550
Followed test plan and it worked as intended
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Fields with underscore like B_address do not print on patron cards.
To reproduce:
- Create patron card layout using fields with underscore in their name
(e.g. <surname><B_address> )
- Print (export) patron card
- Verify that fields without underscore are replaced by their value,
but fields with underscore do not replace but show the field name
To test:
- Apply patch
- Try to reproduce and verify that fields with underscore are replace
as expected
Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Mainly a
perl -p -i -e 's/^.*3.07.00.049.*\n//' **/*.pm
Then some adjustements
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
The size of the barcode in patron card creator was hardcoded to 1% of the card height and 80% of the card width.
This patch exposes both values in the layout editor. If no values are given, the previousely hard coded values (0.01 / 0.8) are used in order to work with existing card definitions.
To test:
- Go to Home > Tools > Patron card creator
- Export a patron card (PDF) from en existing definition
- Apply patch
- Export patron card again, compare results (should be the same)
- Go to Home > Tools > Patron card creator > Manage card layouts
- Edit the layout you use for testing and set barcode scaling values e.g. to 0.03 for height and 0.4 for widht
- Export patron card again, verify that barcode size changed
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Most of them were found and fixed using codespell.
Fix also some related grammar issues.
In C4/Serials.pm a variable was renamed to make future codespelling
checks easier.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
http://bugs.koha-community.org/show_bug.cgi?id=14383
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
http://bugs.koha-community.org/show_bug.cgi?id=9987
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This patch provides a much better quality of images on patron cards.
It inserts images at a higher resolution into the PDF file and then scales it down internally in PDF.
Additionaly, the patch removes the follwing warning:
"my" variable $template masks earlier declaration in same scope at /usr/share/kohaclone/patroncards/create-pdf.pl line 66
To test:
- Create patron cards, save them as PDF and display them with a PDF viewer, e.g. at 400%
- Without patch, the images are very pixelated.
- Apply patch
- Verify that in the PDF the images now display with a much better quality.
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This change is similar to Bug 8375 which introduced ttf fonts for
labels printing in order to support diacritics and utf-8 encoding,
but this change was never implemented for patron cards.
Test scenario:
1. make sure that you have <ttf> font mapping in koha-conf.xml
2. define partron card layout, template, profile and batch
(with utf-8 chars, probably in patron firstname or surname)
3. verify that without this patch pdf export file is error message
Wide character in compress at /usr/share/perl5/PDF/Reuse.pm line 820
4. apply this patch and verify that generated pdf has correct encoding
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This patch touches a lot of code, but basically it removes version
information from use C4::* in our code.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
All script still compiles after the patch (confirmed by pre-applypatch hook)
Can't use an undefined value as an ARRAY reference at /home/koha/koha.prod/C4/Patroncards/Patroncard.pm line 86.
This is caused by testing for text at line 87 rather than line 85. This patch moves the test to line 85.
This patch fixes two bugs:
1. Correcting the text alignment alogrithms for center and right alignment
2. Changes a reference to layout to a copy of the layout to avoid performing
operations on the layout.
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
As discussed with Chris Nighswonger on #koha, this patch
removes the calls to syslog and replaces them with warns
so that error messages generated by the labels code
are sent to the Apache error log. This avoids splitting
this sort of logging across multiple files and is consistent
with current practice in most of the rest of Koha.
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This is simply cut&paste from the older labels module code in an effort to preserve the existing patron card code for use
in the patron card creator module. This is NOT functioning code at the moment.