Bugzilla – Attachment 122777 Details for
Bug 26340
When printing labels from a barcode range, keep zero padding
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26340: Code simplification
Bug-26340-Code-simplification.patch (text/plain), 2.96 KB, created by
Jonathan Druart
on 2021-07-12 12:55:09 UTC
(
hide
)
Description:
Bug 26340: Code simplification
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-07-12 12:55:09 UTC
Size:
2.96 KB
patch
obsolete
>From 2459bec154061c581f158c2c57133f0cf0023935 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 12 Jul 2021 14:53:38 +0200 >Subject: [PATCH] Bug 26340: Code simplification > >And rename $range with $barcode_length >--- > labels/label-create-pdf.pl | 17 ++++------------- > labels/label-print.pl | 6 +++--- > 2 files changed, 7 insertions(+), 16 deletions(-) > >diff --git a/labels/label-create-pdf.pl b/labels/label-create-pdf.pl >index ecb16a5a5bb..b76a013cdfb 100755 >--- a/labels/label-create-pdf.pl >+++ b/labels/label-create-pdf.pl >@@ -45,7 +45,7 @@ my $start_label = $cgi->param('start_label') || 1; > @item_numbers = $cgi->multi_param('item_number') if $cgi->param('item_number'); > my $from = $cgi->param('from') || undef; > my $to = $cgi->param('to') || undef; >-my $range = $cgi->param('range') || undef; >+my $barcode_length = $cgi->param('barcode_length'); > > my $items = undef; > >@@ -117,18 +117,9 @@ elsif (@item_numbers) { > } @item_numbers; > } > elsif ($from and $to) { >- for (my $i = $from; $i <= $to; $i++) { >- my $compare_range = $range - length($i); >- if ($compare_range == 0){ >- push @{$items}, {'item_number' => $i}; >- } else { >- my $a = ''; >- for (my $j = 1; $j <= $compare_range; $j++){ >- $a .= '0'; >- } >- $a .= $i; >- push @{$items}, {'item_number' => $a}; >- } >+ for my $i ( $from .. $to ) { >+ my $padding = '0' x ( $barcode_length - length($i) ); >+ push @$items, { item_number => $padding . $i }; > } > } > else { >diff --git a/labels/label-print.pl b/labels/label-print.pl >index 1347390b8ec..0d1e0bba197 100755 >--- a/labels/label-print.pl >+++ b/labels/label-print.pl >@@ -55,7 +55,7 @@ my $txt_from = $cgi->param('from') || undef; > my $txt_to = $cgi->param('to') || undef; > my $from = int($txt_from) || undef; > my $to = int($txt_to) || undef; >-my $range = length($txt_from) || undef; >+my $barcode_length = length($txt_from) || undef; > > my $layouts = undef; > my $templates = undef; >@@ -127,7 +127,7 @@ if ($op eq 'export') { > push (@batches, {create_script => 'label-create-pdf.pl', > from => $from, > to => $to, >- range => $range, >+ barcode_length => $barcode_length, > template_id => $template_id, > layout_id => $layout_id, > start_label => $start_label, >@@ -161,7 +161,7 @@ elsif ($op eq 'none') { > referer => $referer, > from => $from, > to => $to, >- range => $range, >+ barcode_length => $barcode_length, > txt_from => $txt_from, > txt_to => $txt_to > ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26340
:
109441
|
109442
|
111190
|
111653
|
111654
|
121496
|
121923
|
122305
|
122575
|
122576
|
122777
|
122779