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 |
|