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 (-6 / +46 lines)
Lines 67-93 Link Here
67
    <script>
67
    <script>
68
        function Xport() {
68
        function Xport() {
69
            var str = "";
69
            var str = "";
70
            str += "from=" + parseInt(document.getElementById("from-input").value) + "&";
70
            str += "from=" + document.getElementById("from-input").value + "&";
71
            str += "to=" + parseInt(document.getElementById("to-input").value);
71
            str += "to=" + document.getElementById("to-input").value;
72
            return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?" + str, 400, 800);
72
            return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?" + str, 400, 800);
73
        }
73
        }
74
74
75
        function checkTwoValue(_from, _to, _id){
76
            var result = _from.length == _to.length;
77
            if (_from[0] == "0" || _to[0] == "0") {
78
                switch (_id){
79
                    case 'from-input':
80
                        var to_inp = $("#to-input")
81
                        if (to_inp.hasClass('error')){
82
                            to_inp.removeClass('error').addClass('valid');
83
                            $("to-input-error").remove();
84
                        }
85
                        if ($('#to-input-error').length){
86
                            $("#to-input-error").remove();
87
                        }
88
                        return result;
89
                    case 'to-input':
90
                        var from_inp = $("#from-input")
91
                        if (from_inp.hasClass('error')){
92
                            from_inp.removeClass('error').addClass('valid');
93
                        }
94
                        if ($('#from-input-error').length){
95
                            $("#from-input-error").remove();
96
                        }
97
                        return result;
98
                    }
99
                }
100
                return true;
101
            }
102
75
        $(document).ready(function () {
103
        $(document).ready(function () {
76
            $.validator.addMethod("gt", function(value, element, params) {
104
            $.validator.addMethod("gt", function(value, element, params) {
77
                return parseInt(value) >= parseInt($(params).val());
105
                return parseInt(value) >= parseInt($(params).val());
78
            }, _("Must be greater or equal to the from value."));
106
            }, _("Must be greater or equal to the from value."));
79
107
108
            $.validator.addMethod("eq", function(value, element, params) {
109
                return checkTwoValue($("#from-input").val(), $("#to-input").val(), $(element).attr('id'));
110
            }, _("From and to values must have the same length."));
111
80
            $("form[name=add_by_number]").validate({
112
            $("form[name=add_by_number]").validate({
81
                rules: {
113
                rules: {
82
                    from: {
114
                    from: {
83
                        required: true,
115
                        required: true,
84
                        number: true,
116
                        eq: "#from-input",
85
                        min: 1
117
                        eq: "#to-input",
86
                    },
118
                    },
87
                    to: {
119
                    to: {
88
                        required: true,
120
                        required: true,
89
                        number: true,
121
                        gt: "#from-input",
90
                        gt: "#from-input"
122
                        eq: "#from-input",
123
                        eq: "#to-input",
91
                    }
124
                    }
92
                }
125
                }
93
            });
126
            });
Lines 98-103 Link Here
98
                }
131
                }
99
            });
132
            });
100
        });
133
        });
134
135
136
137
138
139
140
101
    </script>
141
    </script>
102
[% END %]
142
[% END %]
103
143
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-print.tt (-4 / +5 lines)
Lines 21-27 Link Here
21
                        <fieldset>
21
                        <fieldset>
22
                            [% IF ( batche.label_ids ) %]
22
                            [% IF ( batche.label_ids ) %]
23
                                <legend>[% IF ( batche.label_count == 1 ) %][% batche.label_count | html %] single label[% ELSE %][% batche.label_count | html %] single labels[% END %]</legend>
23
                                <legend>[% IF ( batche.label_count == 1 ) %][% batche.label_count | html %] single label[% ELSE %][% batche.label_count | html %] single labels[% END %]</legend>
24
                                    <p><a class="document pdf" href="/cgi-bin/koha/labels/[% batche.create_script | html %]?batch_id=[% batche.batch_id | html %]&amp;template_id=[% batche.template_id | html %]&amp;layout_id=[% batche.layout_id | html %]&amp;start_label=[% batche.start_label | html %][% batche.label_ids | html %]">Download as PDF</a></p>
24
                                <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>
25
25
26
                                    <p><a class="document csv" href="/cgi-bin/koha/labels/label-create-csv.pl?batch_id=[% batche.batch_id | html %]&amp;template_id=[% batche.template_id | html %]&amp;layout_id=[% batche.layout_id | html %][% batche.label_ids | html %]">Download as CSV</a></p>
26
                                    <p><a class="document csv" href="/cgi-bin/koha/labels/label-create-csv.pl?batch_id=[% batche.batch_id | html %]&amp;template_id=[% batche.template_id | html %]&amp;layout_id=[% batche.layout_id | html %][% batche.label_ids | html %]">Download as CSV</a></p>
27
27
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="text" name="from" value="[% txt_from | html %]" />
80
                    <input type="hidden" name="to" value="[% to | html %]" />
80
                <input type="text" name="to" value="[% txt_to | html %]" />
81
                <input type="text" name="range" 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 / +14 lines)
Lines 45-50 my $start_label = $cgi->param('start_label') || 1; Link Here
45
@item_numbers  = $cgi->multi_param('item_number') if $cgi->param('item_number');
45
@item_numbers  = $cgi->multi_param('item_number') if $cgi->param('item_number');
46
my $from = $cgi->param('from') || undef;
46
my $from = $cgi->param('from') || undef;
47
my $to = $cgi->param('to') || undef;
47
my $to = $cgi->param('to') || undef;
48
my $range = $cgi->param('range') || undef;
49
50
warn ("range_pdf = " . Data::Dumper::Dumper($range));
48
51
49
my $items = undef;
52
my $items = undef;
50
53
Lines 117-123 elsif (@item_numbers) { Link Here
117
}
120
}
118
elsif ($from and $to) {
121
elsif ($from and $to) {
119
    for (my $i = $from; $i <= $to; $i++) {
122
    for (my $i = $from; $i <= $to; $i++) {
120
        push @{$items}, {'item_number' => $i};
123
        my $compare_range = $range - length($i);
124
        if ($compare_range == 0){
125
            push @{$items}, {'item_number' => $i};
126
        } else {
127
            my $a = '';
128
            for (my $j = 1; $j <= $compare_range; $j++){
129
                $a .= '0';
130
            }
131
            $a .= $i;
132
            push @{$items}, {'item_number' => $a};
133
        }
121
    }
134
    }
122
}
135
}
123
else {
136
else {
(-)a/labels/label-print.pl (-4 / +12 lines)
Lines 51-58 my @item_numbers; Link Here
51
my $output_format = $cgi->param('output_format') || 'pdf';
51
my $output_format = $cgi->param('output_format') || 'pdf';
52
my $referer = $cgi->param('referer') || undef;
52
my $referer = $cgi->param('referer') || undef;
53
53
54
my $from = $cgi->param('from') || undef;
54
my $txt_from = $cgi->param('from') || undef;
55
my $to = $cgi->param('to') || undef;
55
my $txt_to = $cgi->param('to') || undef;
56
my $from = int($txt_from) || undef;
57
my $to = int($txt_to) || undef;
58
my $range = length($txt_from) || undef;
59
60
warn ("range = " . Data::Dumper::Dumper($range));
56
61
57
my $layouts = undef;
62
my $layouts = undef;
58
my $templates = undef;
63
my $templates = undef;
Lines 124-129 if ($op eq 'export') { Link Here
124
        push (@batches, {create_script   => 'label-create-pdf.pl',
129
        push (@batches, {create_script   => 'label-create-pdf.pl',
125
                 from            => $from,
130
                 from            => $from,
126
                 to              => $to,
131
                 to              => $to,
132
                 range           => $range,
127
                 template_id     => $template_id,
133
                 template_id     => $template_id,
128
                 layout_id       => $layout_id,
134
                 layout_id       => $layout_id,
129
                 start_label     => $start_label,
135
                 start_label     => $start_label,
Lines 156-162 elsif ($op eq 'none') { Link Here
156
                    item_count                  => $item_count,
162
                    item_count                  => $item_count,
157
                    referer                     => $referer,
163
                    referer                     => $referer,
158
                    from                        => $from,
164
                    from                        => $from,
159
                    to                          => $to
165
                    to                          => $to,
166
                    range                       => $range,
167
                    txt_from                    => $txt_from,
168
                    txt_to                      => $txt_to
160
                    );
169
                    );
161
}
170
}
162
output_html_with_http_headers $cgi, $cookie, $template->output;
171
output_html_with_http_headers $cgi, $cookie, $template->output;
163
- 

Return to bug 26340