Lines 1-130
Link Here
|
|
|
1 |
[% USE AuthorisedValues %] |
1 |
[% USE Branches %] |
2 |
[% USE Branches %] |
2 |
|
3 |
[% SET footerjs = 1 %] |
3 |
[% INCLUDE 'doc-head-open.inc' %] |
4 |
[% INCLUDE 'doc-head-open.inc' %] |
4 |
[% USE AuthorisedValues %] |
|
|
5 |
<title>Koha › Serials › Claims</title> |
5 |
<title>Koha › Serials › Claims</title> |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
7 |
[% INCLUDE 'calendar.inc' %] |
|
|
8 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
7 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
9 |
[% INCLUDE 'datatables.inc' %] |
|
|
10 |
<script type="text/javascript"> |
11 |
//<![CDATA[ |
12 |
var sTable; |
13 |
$(document).ready(function() { |
14 |
sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, { |
15 |
"sDom": 't', |
16 |
"aoColumnDefs": [ |
17 |
{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, |
18 |
{ 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }, |
19 |
{ 'sType': "title-string", 'aTargets' : [ 'title-string'] } |
20 |
], |
21 |
"bPaginate": false |
22 |
})); |
23 |
sTable.fnAddFilters("filter", "200"); |
24 |
$('#supplierid').change(function() { |
25 |
$('#claims').submit(); |
26 |
}); |
27 |
|
28 |
// Checkboxes : Select All / None |
29 |
$("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>"); |
30 |
|
31 |
$("#CheckAll").click(function() { |
32 |
$("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked')); |
33 |
}); |
34 |
|
35 |
// Generates a dynamic link for exporting the selections data as CSV |
36 |
$("#ExportSelected").click(function() { |
37 |
// We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error. |
38 |
var selected = $("input[name=serialid]:checked"); |
39 |
|
40 |
if (selected.length == 0) { |
41 |
alert(_("Please select at least one item to export.")); |
42 |
return false; |
43 |
} |
44 |
|
45 |
// Building the url from currently checked boxes |
46 |
var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&op=claims'; |
47 |
for (var i = 0; i < selected.length; i++) { |
48 |
url += '&serialid=' + selected[i].value; |
49 |
} |
50 |
url += '&csv_profile=' + $("#csv_profile_for_export option:selected").val(); |
51 |
// And redirecting to the CSV page |
52 |
location.href = url; |
53 |
return false; |
54 |
}); |
55 |
$("#filterByDate").on("click",function(e){ |
56 |
e.preventDefault(); |
57 |
filterByDate(); |
58 |
}); |
59 |
$("#clearfilter").on("click",function(e){ |
60 |
e.preventDefault(); |
61 |
$("#from,#to").val(""); |
62 |
$("table#claimst tbody tr").show(); |
63 |
}); |
64 |
$("#claims_form").on("submit",function(){ |
65 |
return checkForm(); |
66 |
}); |
67 |
$("#filter_claims_form").on("submit",function(){ |
68 |
return false; |
69 |
}); |
70 |
}); |
71 |
|
72 |
// Checks if the form can be sent (at least one checkbox must be checked) |
73 |
function checkForm() { |
74 |
if ($("input:checked").length == 0) { |
75 |
alert(_("Please select at least one issue.")); |
76 |
return false; |
77 |
} |
78 |
} |
79 |
|
80 |
// Filter by date |
81 |
function filterByDate() { |
82 |
var beginDate = Date_from_syspref($("#from").val()).getTime(); |
83 |
var endDate = Date_from_syspref($("#to").val()).getTime(); |
84 |
|
85 |
// Checks if the beginning date is valid |
86 |
if (!parseInt(beginDate)) { |
87 |
alert(_("The beginning date is missing or invalid.")); |
88 |
return false; |
89 |
} |
90 |
|
91 |
// Checks if the ending date is valid |
92 |
if (!parseInt(endDate)) { |
93 |
alert(_("The ending date is missing or invalid.")); |
94 |
return false; |
95 |
} |
96 |
|
97 |
// Checks if beginning date is before ending date |
98 |
if (beginDate > endDate) { |
99 |
// If not, we swap them |
100 |
var tmpDate = endDate; |
101 |
endDate = beginDate; |
102 |
beginDate = tmpDate; |
103 |
} |
104 |
|
105 |
// We hide everything |
106 |
$("table#claimst tbody tr").hide(); |
107 |
|
108 |
// For each date in the table |
109 |
$(".planneddate").each(function() { |
110 |
|
111 |
// We make a JS Date Object, according to the locale |
112 |
var pdate = Date_from_syspref($(this).text()).getTime(); |
113 |
|
114 |
// And checks if the date is between the beginning and ending dates |
115 |
if (pdate > beginDate && |
116 |
pdate < endDate) { |
117 |
// If so, we can show the row |
118 |
$(this).parent().show(); |
119 |
} |
120 |
|
121 |
}); |
122 |
} |
123 |
|
124 |
|
125 |
//]]> |
126 |
</script> |
127 |
</head> |
8 |
</head> |
|
|
9 |
|
128 |
<body id="ser_claims" class="ser"> |
10 |
<body id="ser_claims" class="ser"> |
129 |
[% INCLUDE 'header.inc' %] |
11 |
[% INCLUDE 'header.inc' %] |
130 |
[% INCLUDE 'serials-search.inc' %] |
12 |
[% INCLUDE 'serials-search.inc' %] |
Lines 321-324
Link Here
|
321 |
[% INCLUDE 'serials-menu.inc' %] |
203 |
[% INCLUDE 'serials-menu.inc' %] |
322 |
</div> |
204 |
</div> |
323 |
</div> |
205 |
</div> |
|
|
206 |
|
207 |
[% MACRO jsinclude BLOCK %] |
208 |
[% INCLUDE 'calendar.inc' %] |
209 |
[% INCLUDE 'datatables.inc' %] |
210 |
<script type="text/javascript"> |
211 |
var sTable; |
212 |
$(document).ready(function() { |
213 |
sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, { |
214 |
"sDom": 't', |
215 |
"aoColumnDefs": [ |
216 |
{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, |
217 |
{ 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }, |
218 |
{ 'sType': "title-string", 'aTargets' : [ 'title-string'] } |
219 |
], |
220 |
"bPaginate": false |
221 |
})); |
222 |
sTable.fnAddFilters("filter", "200"); |
223 |
$('#supplierid').change(function() { |
224 |
$('#claims').submit(); |
225 |
}); |
226 |
|
227 |
// Checkboxes : Select All / None |
228 |
$("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>"); |
229 |
|
230 |
$("#CheckAll").click(function() { |
231 |
$("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked')); |
232 |
}); |
233 |
|
234 |
// Generates a dynamic link for exporting the selections data as CSV |
235 |
$("#ExportSelected").click(function() { |
236 |
// We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error. |
237 |
var selected = $("input[name=serialid]:checked"); |
238 |
|
239 |
if (selected.length == 0) { |
240 |
alert(_("Please select at least one item to export.")); |
241 |
return false; |
242 |
} |
243 |
|
244 |
// Building the url from currently checked boxes |
245 |
var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&op=claims'; |
246 |
for (var i = 0; i < selected.length; i++) { |
247 |
url += '&serialid=' + selected[i].value; |
248 |
} |
249 |
url += '&csv_profile=' + $("#csv_profile_for_export option:selected").val(); |
250 |
// And redirecting to the CSV page |
251 |
location.href = url; |
252 |
return false; |
253 |
}); |
254 |
$("#filterByDate").on("click",function(e){ |
255 |
e.preventDefault(); |
256 |
filterByDate(); |
257 |
}); |
258 |
$("#clearfilter").on("click",function(e){ |
259 |
e.preventDefault(); |
260 |
$("#from,#to").val(""); |
261 |
$("table#claimst tbody tr").show(); |
262 |
}); |
263 |
$("#claims_form").on("submit",function(){ |
264 |
return checkForm(); |
265 |
}); |
266 |
$("#filter_claims_form").on("submit",function(){ |
267 |
return false; |
268 |
}); |
269 |
}); |
270 |
|
271 |
// Checks if the form can be sent (at least one checkbox must be checked) |
272 |
function checkForm() { |
273 |
if ($("input:checked").length == 0) { |
274 |
alert(_("Please select at least one issue.")); |
275 |
return false; |
276 |
} |
277 |
} |
278 |
|
279 |
// Filter by date |
280 |
function filterByDate() { |
281 |
var beginDate = Date_from_syspref($("#from").val()).getTime(); |
282 |
var endDate = Date_from_syspref($("#to").val()).getTime(); |
283 |
|
284 |
// Checks if the beginning date is valid |
285 |
if (!parseInt(beginDate)) { |
286 |
alert(_("The beginning date is missing or invalid.")); |
287 |
return false; |
288 |
} |
289 |
|
290 |
// Checks if the ending date is valid |
291 |
if (!parseInt(endDate)) { |
292 |
alert(_("The ending date is missing or invalid.")); |
293 |
return false; |
294 |
} |
295 |
|
296 |
// Checks if beginning date is before ending date |
297 |
if (beginDate > endDate) { |
298 |
// If not, we swap them |
299 |
var tmpDate = endDate; |
300 |
endDate = beginDate; |
301 |
beginDate = tmpDate; |
302 |
} |
303 |
|
304 |
// We hide everything |
305 |
$("table#claimst tbody tr").hide(); |
306 |
|
307 |
// For each date in the table |
308 |
$(".planneddate").each(function() { |
309 |
|
310 |
// We make a JS Date Object, according to the locale |
311 |
var pdate = Date_from_syspref($(this).text()).getTime(); |
312 |
|
313 |
// And checks if the date is between the beginning and ending dates |
314 |
if (pdate > beginDate && |
315 |
pdate < endDate) { |
316 |
// If so, we can show the row |
317 |
$(this).parent().show(); |
318 |
} |
319 |
}); |
320 |
} |
321 |
</script> |
322 |
[% END %] |
323 |
|
324 |
[% INCLUDE 'intranet-bottom.inc' %] |
324 |
[% INCLUDE 'intranet-bottom.inc' %] |