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 48-53 my $start_label = $cgi->param('start_label') || 1; Link Here
48
my $from = $cgi->param('from') || undef;
48
my $from = $cgi->param('from') || undef;
49
my $to = $cgi->param('to') || undef;
49
my $to = $cgi->param('to') || undef;
50
50
51
my $range = $cgi->param('range') || undef;
52
51
my $items = undef;
53
my $items = undef;
52
54
53
my $pdf_file = (@label_ids || @item_numbers ? "label_single_" . scalar(@label_ids || @item_numbers) : "label_batch_$batch_id");
55
my $pdf_file = (@label_ids || @item_numbers ? "label_single_" . scalar(@label_ids || @item_numbers) : "label_batch_$batch_id");
Lines 119-125 elsif (@item_numbers) { Link Here
119
}
121
}
120
elsif ($from and $to) {
122
elsif ($from and $to) {
121
    for (my $i = $from; $i <= $to; $i++) {
123
    for (my $i = $from; $i <= $to; $i++) {
122
        push @{$items}, {'item_number' => $i};
124
        my $compare_range = $range - length($i);
125
        if ($compare_range == 0){
126
            push @{$items}, {'item_number' => $i};
127
        } else {
128
            my $a = '';
129
            for (my $j = 1; $j <= $compare_range; $j++){
130
                $a .= '0';
131
            }
132
            $a .= $i;
133
            push @{$items}, {'item_number' => $a};
134
        }
123
    }
135
    }
124
}
136
}
125
else {
137
else {
(-)a/labels/label-print.pl (-8 / +17 lines)
Lines 52-59 my @item_numbers; Link Here
52
my $output_format = $cgi->param('output_format') || 'pdf';
52
my $output_format = $cgi->param('output_format') || 'pdf';
53
my $referer = $cgi->param('referer') || undef;
53
my $referer = $cgi->param('referer') || undef;
54
54
55
my $from = $cgi->param('from') || undef;
55
my $txt_from = $cgi->param('from') || undef;
56
my $to = $cgi->param('to') || undef;
56
my $txt_to = $cgi->param('to') || undef;
57
my $from = int($txt_from) || undef;
58
my $to = int($txt_to) || undef;
59
my $range = length($txt_from) || undef;
57
60
58
my $layouts = undef;
61
my $layouts = undef;
59
my $templates = undef;
62
my $templates = undef;
Lines 74-79 if ($op eq 'export') { Link Here
74
                         start_label     => $start_label,
77
                         start_label     => $start_label,
75
                         label_ids       => $label_id_param,
78
                         label_ids       => $label_id_param,
76
                         label_count     => scalar(@label_ids),
79
                         label_count     => scalar(@label_ids),
80
                         range           => $range
77
                        });
81
                        });
78
        $template->param(
82
        $template->param(
79
                        batches     => \@batches,
83
                        batches     => \@batches,
Lines 84-94 if ($op eq 'export') { Link Here
84
        my $item_number_param = '&amp;item_number=';
88
        my $item_number_param = '&amp;item_number=';
85
        $item_number_param .= join ('&amp;item_number=',@item_numbers);
89
        $item_number_param .= join ('&amp;item_number=',@item_numbers);
86
        push (@batches, {create_script   => ($output_format eq 'pdf' ? 'label-create-pdf.pl' : 'label-create-csv.pl'),
90
        push (@batches, {create_script   => ($output_format eq 'pdf' ? 'label-create-pdf.pl' : 'label-create-csv.pl'),
87
                         template_id     => $template_id,
91
                        template_id     => $template_id,
88
                         layout_id       => $layout_id,
92
                        layout_id       => $layout_id,
89
                         start_label     => $start_label,
93
                        start_label     => $start_label,
90
                         item_numbers    => $item_number_param,
94
                        item_numbers    => $item_number_param,
91
                         label_count     => scalar(@item_numbers),
95
                        label_count     => scalar(@item_numbers),
96
                        range           => $range
92
                        });
97
                        });
93
        $template->param(
98
        $template->param(
94
                        batches     => \@batches,
99
                        batches     => \@batches,
Lines 102-107 if ($op eq 'export') { Link Here
102
                            template_id     => $template_id,
107
                            template_id     => $template_id,
103
                            layout_id       => $layout_id,
108
                            layout_id       => $layout_id,
104
                            start_label     => $start_label,
109
                            start_label     => $start_label,
110
                            range           => $range
105
                            });
111
                            });
106
        }
112
        }
107
        $template->param(
113
        $template->param(
Lines 128-133 if ($op eq 'export') { Link Here
128
                 template_id     => $template_id,
134
                 template_id     => $template_id,
129
                 layout_id       => $layout_id,
135
                 layout_id       => $layout_id,
130
                 start_label     => $start_label,
136
                 start_label     => $start_label,
137
                 range           => $range
131
                 });
138
                 });
132
       $template->param(
139
       $template->param(
133
                        batches     => \@batches,
140
                        batches     => \@batches,
Lines 156-161 elsif ($op eq 'none') { Link Here
156
                    label_count                 => $label_count,
163
                    label_count                 => $label_count,
157
                    item_count                  => $item_count,
164
                    item_count                  => $item_count,
158
                    referer                     => $referer,
165
                    referer                     => $referer,
166
                    range                       => $range,
167
                    txt_from                    => $txt_from,
168
                    txt_to                      => $txt_to,
159
                    from                        => $from,
169
                    from                        => $from,
160
                    to                          => $to
170
                    to                          => $to
161
                    );
171
                    );
162
- 

Return to bug 26340