Koha/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-range.tt
Ivan Dziuba a75bd01883 Bug 26340: When printing labels from a barcode range, keep zero padding
TEST PLAN:

1. Go  Tools > Label creator
2. Click +New -> Barcode range
3. Print barcode range with zero(s) in the start (Ex. from 00011881 to 00012000 )
4. Select a template to be applied:: Code à barre 48467
Select a layout to be applied: Code à barres
5. Export
6. Open PDF

The prefix is not displayed. We should see 00011881 on the labels, but we see 11881, 11882, ... without zeros in the start of labels.
This patch fix it.

Signed-off-by: hakam <hakam@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-12 15:47:33 +02:00

144 lines
5.4 KiB
Text

[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Print barcode range &rsaquo; Label creator &rsaquo; Tools &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'greybox.inc' %]
</head>
<body id="labels_label-home" class="tools labels">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
</li>
<li>
<a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a>
</li>
<li>
<a href="#" aria-current="page">
Print barcode range
</a>
</li>
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% INCLUDE 'labels-toolbar.inc' %]
<h1>Print barcode range</h1>
<form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
<input type="hidden" name="op" value="add" />
<fieldset class="rows">
<ol>
<li>
<label for="from-input">From:</label>
<input type="text" inputmode="numeric" pattern="[0-9]*" name="from" id="from-input" value="0" style="text-align: right;"/>
</li>
<li>
<label for="to-input">To:</label>
<input type="text" inputmode="numeric" pattern="[0-9]*" name="to" id="to-input" value="0" style="text-align: right;"/>
</li>
</ol>
</fieldset>
<fieldset class="action">
<button type="button" class="btn btn-default" id="print">Print range</button>
</fieldset>
</form>
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'tools-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
</div> <!-- /.main.container-fluid -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/tools-menu.js") | $raw %]
<script>
function Xport() {
var str = "";
str += "from=" + document.getElementById("from-input").value + "&";
str += "to=" + document.getElementById("to-input").value;
return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?" + str, 400, 800);
}
function checkTwoValue(_from, _to, _id){
var result = _from.length == _to.length;
if (_from[0] == "0" || _to[0] == "0") {
switch (_id){
case 'from-input':
var to_inp = $("#to-input")
if (to_inp.hasClass('error')){
to_inp.removeClass('error').addClass('valid');
$("to-input-error").remove();
}
if ($('#to-input-error').length){
$("#to-input-error").remove();
}
return result;
case 'to-input':
var from_inp = $("#from-input")
if (from_inp.hasClass('error')){
from_inp.removeClass('error').addClass('valid');
}
if ($('#from-input-error').length){
$("#from-input-error").remove();
}
return result;
}
}
return true;
}
$(document).ready(function () {
$.validator.addMethod("gt", function(value, element, params) {
return parseInt(value) >= parseInt($(params).val());
}, _("Must be greater or equal to the from value."));
$.validator.addMethod("eq", function(value, element, params) {
return checkTwoValue($("#from-input").val(), $("#to-input").val(), $(element).attr('id'));
}, _("From and to values must have the same length."));
$("form[name=add_by_number]").validate({
rules: {
from: {
required: true,
eq: "#from-input",
eq: "#to-input",
},
to: {
required: true,
gt: "#from-input",
eq: "#from-input",
eq: "#to-input",
}
}
});
$("#print").on("click", function () {
if ( $("form[name=add_by_number]").valid() ) {
return Xport();
}
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]