View | Details | Raw Unified | Return to bug 26340
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-range.tt (-11 / +14 lines)
Lines 54-61 Link Here
54
    <script>
54
    <script>
55
        function Xport() {
55
        function Xport() {
56
            var str = "";
56
            var str = "";
57
            str += "from=" + parseInt(document.getElementById("from-input").value) + "&";
57
            str += "from=" + document.getElementById("from-input").value + "&";
58
            str += "to=" + parseInt(document.getElementById("to-input").value);
58
            str += "to=" + document.getElementById("to-input").value;
59
            return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?" + str, 400, 800);
59
            return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?" + str, 400, 800);
60
        }
60
        }
61
61
Lines 64-83 Link Here
64
                return parseInt(value) > parseInt($(params).val());
64
                return parseInt(value) > parseInt($(params).val());
65
            }, _("Must be greater than from value."));
65
            }, _("Must be greater than from value."));
66
66
67
            $.validator.addMethod("eq", function(value, element, params) {
68
                return value.length == $(params).val().length;
69
            }, _("Length from and to values must be same."));
70
71
67
            $("form[name=add_by_number]").validate({
72
            $("form[name=add_by_number]").validate({
68
                rules: {
73
                rules: {
69
                    from: {
74
                    from: {
70
                        required: true,
75
                    required: true,
71
                        number: true,
72
                        min: 1
73
                    },
76
                    },
74
                    to: {
77
                to: {
75
                        required: true,
78
                    required: true,
76
                        number: true,
79
                    gt: "#from-input",
77
                        gt: "#from-input"
80
                    eq: "#from-input",
78
                    }
79
                }
81
                }
80
            });
82
            }
83
        });
81
84
82
            $("#print").on("click", function () {
85
            $("#print").on("click", function () {
83
                if ( $("form[name=add_by_number]").valid() ) {
86
                if ( $("form[name=add_by_number]").valid() ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-print.tt (-3 / +4 lines)
Lines 45-51 Link Here
45
                            [% ELSIF (batche.from && batche.to) %]
45
                            [% ELSIF (batche.from && batche.to) %]
46
                            <legend>Barcodes from [% batche.from | html %] to [% batche.to | html %]</legend>
46
                            <legend>Barcodes from [% batche.from | html %] to [% batche.to | html %]</legend>
47
                            <p>
47
                            <p>
48
                                <a class="document pdf" href="/cgi-bin/koha/labels/label-create-pdf.pl?batch_id=0&amp;template_id=[% batche.template_id | html %]&amp;layout_id=[% batche.layout_id | html %]&amp;start_label=[% batche.start_label | html %]&amp;from=[% batche.from | html %]&amp;to=[% batche.to | html %]">Download as PDF</a>
48
                                <a class="document pdf" href="/cgi-bin/koha/labels/label-create-pdf.pl?batch_id=0&amp;template_id=[% batche.template_id | html %]&amp;layout_id=[% batche.layout_id | html %]&amp;start_label=[% batche.start_label | html %]&amp;from=[% batche.from | html %]&amp;to=[% batche.to | html %]&amp;range=[% batche.range | html %]">Download as PDF</a>
49
                            </p>
49
                            </p>
50
                            [% END %]
50
                            [% END %]
51
                        </fieldset>
51
                        </fieldset>
Lines 76-83 Link Here
76
                [% FOREACH item_number IN item_numbers %]
76
                [% FOREACH item_number IN item_numbers %]
77
                    <input type="hidden" name="item_number" value="[% item_number.item_number | html %]" />
77
                    <input type="hidden" name="item_number" value="[% item_number.item_number | html %]" />
78
                [% END %]
78
                [% END %]
79
                    <input type="hidden" name="from" value="[% from | html %]" />
79
                    <input type="hidden" name="from" value="[% txt_from | html %]" />
80
                    <input type="hidden" name="to" value="[% to | html %]" />
80
                    <input type="hidden" name="to" value="[% txt_to | html %]" />
81
                    <input type="hidden" name="to" value="[% range | html %]" />
81
                <fieldset class="rows">
82
                <fieldset class="rows">
82
                    <ol>
83
                    <ol>
83
                        <li>
84
                        <li>
(-)a/labels/label-create-pdf.pl (-1 / +13 lines)
Lines 49-54 my $start_label = $cgi->param('start_label') || 1; Link Here
49
my $from = $cgi->param('from') || undef;
49
my $from = $cgi->param('from') || undef;
50
my $to = $cgi->param('to') || undef;
50
my $to = $cgi->param('to') || undef;
51
51
52
my $range = $cgi->param('range') || undef;
53
52
my $items = undef;
54
my $items = undef;
53
55
54
my $pdf_file = (@label_ids || @item_numbers ? "label_single_" . scalar(@label_ids || @item_numbers) : "label_batch_$batch_id");
56
my $pdf_file = (@label_ids || @item_numbers ? "label_single_" . scalar(@label_ids || @item_numbers) : "label_batch_$batch_id");
Lines 120-126 elsif (@item_numbers) { Link Here
120
}
122
}
121
elsif ($from and $to) {
123
elsif ($from and $to) {
122
    for (my $i = $from; $i <= $to; $i++) {
124
    for (my $i = $from; $i <= $to; $i++) {
123
        push @{$items}, {'item_number' => $i};
125
        my $compare_range = $range - length($i);
126
        if ($compare_range == 0){
127
            push @{$items}, {'item_number' => $i};
128
        } else {
129
            my $a = '';
130
            for (my $j = 1; $j <= $compare_range; $j++){
131
                $a .= '0';
132
            }
133
            $a .= $i;
134
            push @{$items}, {'item_number' => $a};
135
        }      
124
    }
136
    }
125
}
137
}
126
else {
138
else {
(-)a/labels/label-print.pl (-8 / +17 lines)
Lines 53-60 my @item_numbers; Link Here
53
my $output_format = $cgi->param('output_format') || 'pdf';
53
my $output_format = $cgi->param('output_format') || 'pdf';
54
my $referer = $cgi->param('referer') || undef;
54
my $referer = $cgi->param('referer') || undef;
55
55
56
my $from = $cgi->param('from') || undef;
56
my $txt_from = $cgi->param('from') || undef;
57
my $to = $cgi->param('to') || undef;
57
my $txt_to = $cgi->param('to') || undef;
58
my $from = int($txt_from) || undef;
59
my $to = int($txt_to) || undef;
60
my $range = length($txt_from) || undef;
58
61
59
my $layouts = undef;
62
my $layouts = undef;
60
my $templates = undef;
63
my $templates = undef;
Lines 75-80 if ($op eq 'export') { Link Here
75
                         start_label     => $start_label,
78
                         start_label     => $start_label,
76
                         label_ids       => $label_id_param,
79
                         label_ids       => $label_id_param,
77
                         label_count     => scalar(@label_ids),
80
                         label_count     => scalar(@label_ids),
81
                         range           => $range
78
                        });
82
                        });
79
        $template->param(
83
        $template->param(
80
                        batches     => \@batches,
84
                        batches     => \@batches,
Lines 85-95 if ($op eq 'export') { Link Here
85
        my $item_number_param = '&amp;item_number=';
89
        my $item_number_param = '&amp;item_number=';
86
        $item_number_param .= join ('&amp;item_number=',@item_numbers);
90
        $item_number_param .= join ('&amp;item_number=',@item_numbers);
87
        push (@batches, {create_script   => ($output_format eq 'pdf' ? 'label-create-pdf.pl' : 'label-create-csv.pl'),
91
        push (@batches, {create_script   => ($output_format eq 'pdf' ? 'label-create-pdf.pl' : 'label-create-csv.pl'),
88
                         template_id     => $template_id,
92
                        template_id     => $template_id,
89
                         layout_id       => $layout_id,
93
                        layout_id       => $layout_id,
90
                         start_label     => $start_label,
94
                        start_label     => $start_label,
91
                         item_numbers    => $item_number_param,
95
                        item_numbers    => $item_number_param,
92
                         label_count     => scalar(@item_numbers),
96
                        label_count     => scalar(@item_numbers),
97
                        range           => $range
93
                        });
98
                        });
94
        $template->param(
99
        $template->param(
95
                        batches     => \@batches,
100
                        batches     => \@batches,
Lines 103-108 if ($op eq 'export') { Link Here
103
                            template_id     => $template_id,
108
                            template_id     => $template_id,
104
                            layout_id       => $layout_id,
109
                            layout_id       => $layout_id,
105
                            start_label     => $start_label,
110
                            start_label     => $start_label,
111
                            range           => $range
106
                            });
112
                            });
107
        }
113
        }
108
        $template->param(
114
        $template->param(
Lines 129-134 if ($op eq 'export') { Link Here
129
                 template_id     => $template_id,
135
                 template_id     => $template_id,
130
                 layout_id       => $layout_id,
136
                 layout_id       => $layout_id,
131
                 start_label     => $start_label,
137
                 start_label     => $start_label,
138
                 range           => $range
132
                 });
139
                 });
133
       $template->param(
140
       $template->param(
134
                        batches     => \@batches,
141
                        batches     => \@batches,
Lines 157-162 elsif ($op eq 'none') { Link Here
157
                    label_count                 => $label_count,
164
                    label_count                 => $label_count,
158
                    item_count                  => $item_count,
165
                    item_count                  => $item_count,
159
                    referer                     => $referer,
166
                    referer                     => $referer,
167
                    range                       => $range,
168
                    txt_from                    => $txt_from,
169
                    txt_to                      => $txt_to,
160
                    from                        => $from,
170
                    from                        => $from,
161
                    to                          => $to
171
                    to                          => $to
162
                    );
172
                    );
163
- 

Return to bug 26340