From 7082820aee606b5f76704e3853b30b526ac18984 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sat, 14 Oct 2023 21:22:31 +0000 Subject: [PATCH] Bug 10762: (QA follow-up) Perltidy Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- C4/Creators/Layout.pm | 36 ++--- C4/Labels/Label.pm | 104 +++++++++----- .../mysql/atomicupdate/update-BZ_10762.pl | 24 ++-- labels/label-create-pdf.pl | 135 ++++++++++-------- labels/label-edit-layout.pl | 57 ++++---- t/db_dependent/Labels/t_Label.t | 32 ++--- 6 files changed, 216 insertions(+), 172 deletions(-) diff --git a/C4/Creators/Layout.pm b/C4/Creators/Layout.pm index 690cb047d3..a8fd56f5d1 100644 --- a/C4/Creators/Layout.pm +++ b/C4/Creators/Layout.pm @@ -36,7 +36,7 @@ sub _check_params { 'callnum_split', 'text_justify', 'format_string', - 'layout_xml', # FIXME: all layouts should be stored in xml format to greatly simplify handling -chris_n + 'layout_xml', # FIXME: all layouts should be stored in xml format to greatly simplify handling -chris_n 'creator', 'units', 'start_label', @@ -67,23 +67,23 @@ sub new { return -1; } my $type = ref($invocant) || $invocant; - if (grep {$_ eq 'Labels'} @_) { - $self = { - layout_xml => '', - units => 'POINT', - start_label => 1, - barcode_type => 'CODE39', - printing_type => 'BAR', - layout_name => 'DEFAULT', - guidebox => 0, - oblique_title => 1, - font => 'TR', - font_size => 3, - scale_width => 0.8, - scale_height => 0.01, - callnum_split => 0, - text_justify => 'L', - format_string => join(', ', @{ PRESET_FIELDS() }), + if ( grep { $_ eq 'Labels' } @_ ) { + $self = { + layout_xml => '', + units => 'POINT', + start_label => 1, + barcode_type => 'CODE39', + printing_type => 'BAR', + layout_name => 'DEFAULT', + guidebox => 0, + oblique_title => 1, + font => 'TR', + font_size => 3, + scale_width => 0.8, + scale_height => 0.01, + callnum_split => 0, + text_justify => 'L', + format_string => join( ', ', @{ PRESET_FIELDS() } ), @_, }; } diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm index 9fbd20be3f..1d6ea20e8b 100644 --- a/C4/Labels/Label.pm +++ b/C4/Labels/Label.pm @@ -225,32 +225,61 @@ sub _BIB { 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 = $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 $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 = $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; } 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 = $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'})); + 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 = $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; } 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 = $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)); + 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 = $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; } @@ -258,28 +287,29 @@ sub new { my ($invocant, %params) = @_; my $type = ref($invocant) || $invocant; my $self = { - batch_id => $params{'batch_id'}, - item_number => $params{'item_number'}, - llx => $params{'llx'}, - lly => $params{'lly'}, - height => $params{'height'}, - width => $params{'width'}, - top_text_margin => $params{'top_text_margin'}, - left_text_margin => $params{'left_text_margin'}, - barcode_type => $params{'barcode_type'}, - printing_type => $params{'printing_type'}, - guidebox => $params{'guidebox'}, - 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'}, - text_wrap_cols => $params{'text_wrap_cols'}, - barcode => $params{'barcode'}, + batch_id => $params{'batch_id'}, + item_number => $params{'item_number'}, + llx => $params{'llx'}, + lly => $params{'lly'}, + height => $params{'height'}, + width => $params{'width'}, + top_text_margin => $params{'top_text_margin'}, + left_text_margin => $params{'left_text_margin'}, + barcode_type => $params{'barcode_type'}, + printing_type => $params{'printing_type'}, + guidebox => $params{'guidebox'}, + 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'}, + text_wrap_cols => $params{'text_wrap_cols'}, + barcode => $params{'barcode'}, }; + if ($self->{'guidebox'}) { $self->{'guidebox'} = _guide_box($self->{'llx'}, $self->{'lly'}, $self->{'width'}, $self->{'height'}); } diff --git a/installer/data/mysql/atomicupdate/update-BZ_10762.pl b/installer/data/mysql/atomicupdate/update-BZ_10762.pl index 408e3dace5..7494e464c4 100755 --- a/installer/data/mysql/atomicupdate/update-BZ_10762.pl +++ b/installer/data/mysql/atomicupdate/update-BZ_10762.pl @@ -1,23 +1,27 @@ use Modern::Perl; return { - bug_number => "10762", + bug_number => "10762", description => "Add 2 columns in 'creator_layouts' which define the width and height of barcodes", - up => sub { + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; - unless ( column_exists ( 'creator_layouts', 'scale_width' )) { - $dbh->do( q { + 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 { + 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"; }, -} + } diff --git a/labels/label-create-pdf.pl b/labels/label-create-pdf.pl index 3ce90363fc..a5fa56f89b 100755 --- a/labels/label-create-pdf.pl +++ b/labels/label-create-pdf.pl @@ -131,53 +131,59 @@ foreach my $item (@{$items}) { my ($barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor) = 0,0,0,0; if ($layout->get_attr('printing_type') eq 'ALT') { # we process the ALT style printing type here because it is not an atomic printing type my $label_a = C4::Labels::Label->new( - batch_id => $batch_id, - item_number => $item->{'item_number'}, - llx => $llx, - lly => $lly, - width => $template->get_attr('label_width'), - height => $template->get_attr('label_height'), - top_text_margin => $template->get_attr('top_text_margin'), - left_text_margin => $template->get_attr('left_text_margin'), - barcode_type => $layout->get_attr('barcode_type'), - printing_type => 'BIB', - guidebox => $layout->get_attr('guidebox'), - 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'), - text_wrap_cols => $layout->get_text_wrap_cols(label_width => $template->get_attr('label_width'), left_text_margin => $template->get_attr('left_text_margin')), - ); + batch_id => $batch_id, + item_number => $item->{'item_number'}, + llx => $llx, + lly => $lly, + width => $template->get_attr('label_width'), + height => $template->get_attr('label_height'), + top_text_margin => $template->get_attr('top_text_margin'), + left_text_margin => $template->get_attr('left_text_margin'), + barcode_type => $layout->get_attr('barcode_type'), + printing_type => 'BIB', + guidebox => $layout->get_attr('guidebox'), + 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'), + text_wrap_cols => $layout->get_text_wrap_cols( + label_width => $template->get_attr('label_width'), + left_text_margin => $template->get_attr('left_text_margin') + ), + ); $pdf->Add($label_a->draw_guide_box) if $layout->get_attr('guidebox'); my $label_a_text = $label_a->create_label(); _print_text($label_a_text); ($row_count, $col_count, $llx, $lly) = _calc_next_label_pos($row_count, $col_count, $llx, $lly); my $label_b = C4::Labels::Label->new( - batch_id => $batch_id, - item_number => $item->{'item_number'}, - llx => $llx, - lly => $lly, - width => $template->get_attr('label_width'), - height => $template->get_attr('label_height'), - top_text_margin => $template->get_attr('top_text_margin'), - left_text_margin => $template->get_attr('left_text_margin'), - barcode_type => $layout->get_attr('barcode_type'), - printing_type => 'BAR', - guidebox => $layout->get_attr('guidebox'), - 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'), - text_wrap_cols => $layout->get_text_wrap_cols(label_width => $template->get_attr('label_width'), left_text_margin => $template->get_attr('left_text_margin')), - ); + batch_id => $batch_id, + item_number => $item->{'item_number'}, + llx => $llx, + lly => $lly, + width => $template->get_attr('label_width'), + height => $template->get_attr('label_height'), + top_text_margin => $template->get_attr('top_text_margin'), + left_text_margin => $template->get_attr('left_text_margin'), + barcode_type => $layout->get_attr('barcode_type'), + printing_type => 'BAR', + guidebox => $layout->get_attr('guidebox'), + 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'), + text_wrap_cols => $layout->get_text_wrap_cols( + label_width => $template->get_attr('label_width'), + left_text_margin => $template->get_attr('left_text_margin') + ), + ); $pdf->Add($label_b->draw_guide_box) if $layout->get_attr('guidebox'); my $label_b_text = $label_b->create_label(); ($row_count, $col_count, $llx, $lly) = _calc_next_label_pos($row_count, $col_count, $llx, $lly); @@ -186,27 +192,30 @@ foreach my $item (@{$items}) { else { } my $label = C4::Labels::Label->new( - batch_id => $batch_id, - item_number => $item->{'item_number'}, - llx => $llx, - lly => $lly, - width => $template->get_attr('label_width'), - height => $template->get_attr('label_height'), - top_text_margin => $template->get_attr('top_text_margin'), - left_text_margin => $template->get_attr('left_text_margin'), - barcode_type => $layout->get_attr('barcode_type'), - printing_type => $layout->get_attr('printing_type'), - guidebox => $layout->get_attr('guidebox'), - 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'), - text_wrap_cols => $layout->get_text_wrap_cols(label_width => $template->get_attr('label_width'), left_text_margin => $template->get_attr('left_text_margin')), - ); + batch_id => $batch_id, + item_number => $item->{'item_number'}, + llx => $llx, + lly => $lly, + width => $template->get_attr('label_width'), + height => $template->get_attr('label_height'), + top_text_margin => $template->get_attr('top_text_margin'), + left_text_margin => $template->get_attr('left_text_margin'), + barcode_type => $layout->get_attr('barcode_type'), + printing_type => $layout->get_attr('printing_type'), + guidebox => $layout->get_attr('guidebox'), + 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'), + text_wrap_cols => $layout->get_text_wrap_cols( + label_width => $template->get_attr('label_width'), + left_text_margin => $template->get_attr('left_text_margin') + ), + ); $pdf->Add($label->draw_guide_box) if $layout->get_attr('guidebox'); $label->{'barcode'} = $item->{'item_number'} if ($from and $to); my $label_text = $label->create_label(); diff --git a/labels/label-edit-layout.pl b/labels/label-edit-layout.pl index 7d6ef2d219..56c7d4a8ee 100755 --- a/labels/label-edit-layout.pl +++ b/labels/label-edit-layout.pl @@ -105,18 +105,19 @@ elsif ($op eq 'save') { $cgi->param('format_string', $format_string); } my @params = ( - barcode_type => scalar $cgi->param('barcode_type') || 'CODE39', - printing_type => scalar $cgi->param('printing_type') || 'BAR', - layout_name => scalar $cgi->param('layout_name') || 'DEFAULT', - guidebox => ($cgi->param('guidebox') ? 1 : 0), - 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', + barcode_type => scalar $cgi->param('barcode_type') || 'CODE39', + printing_type => scalar $cgi->param('printing_type') || 'BAR', + layout_name => scalar $cgi->param('layout_name') || 'DEFAULT', + guidebox => ( $cgi->param('guidebox') ? 1 : 0 ), + 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', ); if ($layout_id) { # if a label_id was passed in, this is an update to an existing layout $layout = C4::Labels::Layout->retrieve(layout_id => $layout_id); @@ -141,21 +142,21 @@ my $text_justification_types = _set_selected(get_text_justification_types(), $la my ($select_text_fields, $select_text_fields_cnt) = _select_format_string($layout->get_attr('format_string')); $template->param( - barcode_types => $barcode_types, - label_types => $label_types, - font_types => $font_types, - text_justification_types => $text_justification_types, - fields => $select_text_fields, - field_count => $select_text_fields_cnt, - layout_id => $layout->get_attr('layout_id') > -1 ? $layout->get_attr('layout_id') : '', - layout_name => $layout->get_attr('layout_name'), - 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 + barcode_types => $barcode_types, + label_types => $label_types, + font_types => $font_types, + text_justification_types => $text_justification_types, + fields => $select_text_fields, + field_count => $select_text_fields_cnt, + layout_id => $layout->get_attr('layout_id') > -1 ? $layout->get_attr('layout_id') : '', + layout_name => $layout->get_attr('layout_name'), + 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 ); output_html_with_http_headers $cgi, $cookie, $template->output; diff --git a/t/db_dependent/Labels/t_Label.t b/t/db_dependent/Labels/t_Label.t index a923e95e10..32bde70266 100755 --- a/t/db_dependent/Labels/t_Label.t +++ b/t/db_dependent/Labels/t_Label.t @@ -54,13 +54,11 @@ my $branch_1 = $builder->build( { source => 'Branch' } )->{branchcode}; my $category_1 = $builder->build( { source => 'Category' } )->{categorycode}; # Add an item type -my $itemtype = - $builder->build( { source => 'Itemtype', value => { notforloan => undef } } ) - ->{itemtype}; +my $itemtype = $builder->build( { source => 'Itemtype', value => { notforloan => undef } } )->{itemtype}; -t::lib::Mocks::mock_userenv({ branchcode => $branch_1 }); +t::lib::Mocks::mock_userenv( { branchcode => $branch_1 } ); -my $bibnum = $builder->build_sample_biblio({ frameworkcode => $frameworkcode })->biblionumber; +my $bibnum = $builder->build_sample_biblio( { frameworkcode => $frameworkcode } )->biblionumber; # Create a helper item instance for testing my $item = $builder->build_sample_item( @@ -124,22 +122,24 @@ my $label_info = { label_width => $dummy_template_values->{'label_width'}, left_text_margin => $dummy_template_values->{'left_text_margin'} ), - scale_width => $dummy_template_values->{barcode_width}, + scale_width => $dummy_template_values->{barcode_width}, scale_height => $dummy_template_values->{barcode_height}, }; -my $format_string = '100a 245a'; -my $barcode_width = $label_info->{scale_width} * $label_info->{width}; +my $format_string = '100a 245a'; +my $barcode_width = $label_info->{scale_width} * $label_info->{width}; my $barcode_height = $label_info->{scale_height} * $label_info->{height}; -my $label = C4::Labels::Label->new(%$label_info, format_string => $format_string); -my $label_text = $label->create_label(); +my $label = C4::Labels::Label->new( %$label_info, format_string => $format_string ); +my $label_text = $label->create_label(); ok( defined $label_text, 'Label Text Value defined.' ); my $label_csv_data = $label->csv_data(); -is_deeply( $label_csv_data, - [ sprintf( "%s %s", $item->biblio->author, $item->biblio->title ) ] ); +is_deeply( + $label_csv_data, + [ sprintf( "%s %s", $item->biblio->author, $item->biblio->title ) ] +); -$format_string = '100a 245a,enumchron copynumber'; -$label = C4::Labels::Label->new(%$label_info, format_string => $format_string); +$format_string = '100a 245a,enumchron copynumber'; +$label = C4::Labels::Label->new( %$label_info, format_string => $format_string ); $label_csv_data = $label->csv_data(); is_deeply( $label_csv_data, @@ -148,8 +148,8 @@ is_deeply( sprintf( "%s %s", $item->enumchron, $item->copynumber ) ] ); -is($barcode_width, '2.104',); -is($barcode_height, '0.01',); +is( $barcode_width, '2.104', ); +is( $barcode_height, '0.01', ); $schema->storage->txn_rollback(); -- 2.39.5