Bug 10762: Change the size of barcodes in label creator
Test plan: 1)Home > Tools > Label creator > Manage Layout or New Layout 2)Make a new layout or edit an existing one 3)Notice the 2 new fields "Barcode width/Barcode height" 4)Save it like this 5)Create a batch of barcode and export if in PDF 6)Notice the size of barcode 7)Go back to your existing layout 8)Enter some values (Barcode width: 1.6 / Barcode height: 0.04), save 9)Take back your batch of barcode and export it in PDF 10)The barcode should be 2x bigger Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Johanna Miettunen <johanna.miettunen@haaga-helia.fi> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
b4cfe0019a
commit
2cf45462fe
6 changed files with 55 additions and 6 deletions
|
@ -31,6 +31,8 @@ sub _check_params {
|
|||
'oblique_title',
|
||||
'font',
|
||||
'font_size',
|
||||
'scale_width',
|
||||
'scale_height',
|
||||
'callnum_split',
|
||||
'text_justify',
|
||||
'format_string',
|
||||
|
@ -77,6 +79,8 @@ sub new {
|
|||
oblique_title => 1,
|
||||
font => 'TR',
|
||||
font_size => 3,
|
||||
scale_width => 0.8,
|
||||
scale_height => 0.02,
|
||||
callnum_split => 0,
|
||||
text_justify => 'L',
|
||||
format_string => join(', ', @{ PRESET_FIELDS() }),
|
||||
|
|
|
@ -37,6 +37,8 @@ sub _check_params {
|
|||
'oblique_title',
|
||||
'font',
|
||||
'font_size',
|
||||
'scale_width',
|
||||
'scale_height',
|
||||
'callnum_split',
|
||||
'justify',
|
||||
'format_string',
|
||||
|
@ -225,8 +227,8 @@ sub _BAR {
|
|||
my $self = shift;
|
||||
my $barcode_llx = $self->{'llx'} + $self->{'left_text_margin'}; # this places the bottom left of the barcode the left text margin distance to right of the left edge of the label ($llx)
|
||||
my $barcode_lly = $self->{'lly'} + $self->{'top_text_margin'}; # this places the bottom left of the barcode the top text margin distance above the bottom of the label ($lly)
|
||||
my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width
|
||||
my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height
|
||||
my $barcode_width = $self->{'scale_width'} * $self->{'width'}; # You can choose the width of barcode, default value is 0.8 : 80% of the label width
|
||||
my $barcode_y_scale_factor = $self->{'scale_height'} * $self->{'height'}; # You can choose the height of barcode, default value is 0.01 : 10% of the label height
|
||||
return 0, 0, 0, $barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor;
|
||||
}
|
||||
|
||||
|
@ -234,8 +236,8 @@ sub _BIBBAR {
|
|||
my $self = shift;
|
||||
my $barcode_llx = $self->{'llx'} + $self->{'left_text_margin'}; # this places the bottom left of the barcode the left text margin distance to right of the left edge of the label ($self->{'llx'})
|
||||
my $barcode_lly = $self->{'lly'} + $self->{'top_text_margin'}; # this places the bottom left of the barcode the top text margin distance above the bottom of the label ($lly)
|
||||
my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width
|
||||
my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height
|
||||
my $barcode_width = $self->{'scale_width'} * $self->{'width'}; # You can choose the width of barcode, default value is 0.8 : 80% of the label width
|
||||
my $barcode_y_scale_factor = $self->{'scale_height'} * $self->{'height'}; # You can choose the height of barcode, default value is 0.01 : 10% of the label height
|
||||
my $line_spacer = ($self->{'font_size'} * 1); # number of pixels between text rows (This is actually leading: baseline to baseline minus font size. Recommended starting point is 20% of font size.).
|
||||
my $text_lly = ($self->{'lly'} + ($self->{'height'} - $self->{'top_text_margin'}));
|
||||
return $self->{'llx'}, $text_lly, $line_spacer, $barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor;
|
||||
|
@ -245,8 +247,8 @@ sub _BARBIB {
|
|||
my $self = shift;
|
||||
my $barcode_llx = $self->{'llx'} + $self->{'left_text_margin'}; # this places the bottom left of the barcode the left text margin distance to right of the left edge of the label ($self->{'llx'})
|
||||
my $barcode_lly = ($self->{'lly'} + $self->{'height'}) - $self->{'top_text_margin'}; # this places the bottom left of the barcode the top text margin distance below the top of the label ($self->{'lly'})
|
||||
my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width
|
||||
my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height
|
||||
my $barcode_width = $self->{'scale_width'} * $self->{'width'}; # You can choose the width of barcode, default value is 0.8 : 80% of the label width
|
||||
my $barcode_y_scale_factor = $self->{'scale_height'} * $self->{'height'}; # You can choose the height of barcode, default value is 0.01 : 10% of the label height
|
||||
my $line_spacer = ($self->{'font_size'} * 1); # number of pixels between text rows (This is actually leading: baseline to baseline minus font size. Recommended starting point is 20% of font size.).
|
||||
my $text_lly = (($self->{'lly'} + $self->{'height'}) - $self->{'top_text_margin'} - (($self->{'lly'} + $self->{'height'}) - $barcode_lly));
|
||||
return $self->{'llx'}, $text_lly, $line_spacer, $barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor;
|
||||
|
@ -270,6 +272,8 @@ sub new {
|
|||
oblique_title => $params{'oblique_title'},
|
||||
font => $params{'font'},
|
||||
font_size => $params{'font_size'},
|
||||
scale_width => $params{'scale_width'},
|
||||
scale_height => $params{'scale_height'},
|
||||
callnum_split => $params{'callnum_split'},
|
||||
justify => $params{'justify'},
|
||||
format_string => $params{'format_string'},
|
||||
|
|
23
installer/data/mysql/atomicupdate/update-BZ_10762.pl
Normal file
23
installer/data/mysql/atomicupdate/update-BZ_10762.pl
Normal file
|
@ -0,0 +1,23 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => "10762",
|
||||
description => "Add 2 columns in 'creator_layouts' which define the width and height of barcodes",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ($dbh, $out) = @$args{qw(dbh out)};
|
||||
unless ( column_exists ( 'creator_layouts', 'scale_width' )) {
|
||||
$dbh->do( q {
|
||||
ALTER TABLE creator_layouts
|
||||
ADD COLUMN scale_width FLOAT default 0.8 NOT NULL AFTER font_size
|
||||
});
|
||||
}
|
||||
unless ( column_exists ( 'creator_layouts', 'scale_height')) {
|
||||
$dbh->do( q {
|
||||
ALTER TABLE creator_layouts
|
||||
ADD COLUMN scale_height FLOAT default 0.01 NOT NULL AFTER scale_width
|
||||
});
|
||||
}
|
||||
say $out "Table creator_layouts updated with 2 new columns";
|
||||
},
|
||||
}
|
|
@ -193,6 +193,14 @@
|
|||
<label for="font_size">Font size: </label>
|
||||
<input type="text" name="font_size" id="font_size" size="2" value="[% font_size | html %]" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="scale_width">Barcode width: </label>
|
||||
<input type="text" name="scale_width" id="scale_width" size="2" value="[% scale_width | html %]" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="scale_height">Barcode height: </label>
|
||||
<input type="text" name="scale_height" id="scale_height" size="2" value="[% scale_height | html %]" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="oblique_title">Oblique title: </label>
|
||||
[% IF ( oblique_title ) %]
|
||||
|
|
|
@ -145,6 +145,8 @@ foreach my $item (@{$items}) {
|
|||
oblique_title => $layout->get_attr('oblique_title'),
|
||||
font => $layout->get_attr('font'),
|
||||
font_size => $layout->get_attr('font_size'),
|
||||
scale_width => $layout->get_attr('scale_width'),
|
||||
scale_height => $layout->get_attr('scale_height'),
|
||||
callnum_split => $layout->get_attr('callnum_split'),
|
||||
justify => $layout->get_attr('text_justify'),
|
||||
format_string => $layout->get_attr('format_string'),
|
||||
|
@ -169,6 +171,8 @@ foreach my $item (@{$items}) {
|
|||
oblique_title => $layout->get_attr('oblique_title'),
|
||||
font => $layout->get_attr('font'),
|
||||
font_size => $layout->get_attr('font_size'),
|
||||
scale_width => $layout->get_attr('scale_width'),
|
||||
scale_height => $layout->get_attr('scale_height'),
|
||||
callnum_split => $layout->get_attr('callnum_split'),
|
||||
justify => $layout->get_attr('text_justify'),
|
||||
format_string => $layout->get_attr('format_string'),
|
||||
|
@ -196,6 +200,8 @@ foreach my $item (@{$items}) {
|
|||
oblique_title => $layout->get_attr('oblique_title'),
|
||||
font => $layout->get_attr('font'),
|
||||
font_size => $layout->get_attr('font_size'),
|
||||
scale_width => $layout->get_attr('scale_width'),
|
||||
scale_height => $layout->get_attr('scale_height'),
|
||||
callnum_split => $layout->get_attr('callnum_split'),
|
||||
justify => $layout->get_attr('text_justify'),
|
||||
format_string => $layout->get_attr('format_string'),
|
||||
|
|
|
@ -112,6 +112,8 @@ elsif ($op eq 'save') {
|
|||
oblique_title => ($cgi->param('oblique_title') ? 1 : 0),
|
||||
font => scalar $cgi->param('font') || 'TR',
|
||||
font_size => scalar $cgi->param('font_size') || 3,
|
||||
scale_width => scalar $cgi->param('scale_width') || 0.8,
|
||||
scale_height => scalar $cgi->param('scale_height') || 0.01,
|
||||
callnum_split => ($cgi->param('callnum_split') ? 1 : 0),
|
||||
text_justify => scalar $cgi->param('text_justify') || 'L',
|
||||
format_string => scalar $cgi->param('format_string') || 'title, author, isbn, issn, itemtype, barcode, itemcallnumber',
|
||||
|
@ -150,6 +152,8 @@ $template->param(
|
|||
guidebox => $layout->get_attr('guidebox'),
|
||||
oblique_title => $layout->get_attr('oblique_title'),
|
||||
font_size => $layout->get_attr('font_size'),
|
||||
scale_width => $layout->get_attr('scale_width'),
|
||||
scale_height => $layout->get_attr('scale_height'),
|
||||
callnum_split => $layout->get_attr('callnum_split'),
|
||||
format_string => $layout->get_attr('format_string'),
|
||||
layout_string => 1, # FIXME: This should not be hard-coded; It should perhaps be yet another syspref... CN
|
||||
|
|
Loading…
Reference in a new issue