Lines 1-177
Link Here
|
1 |
[% USE Asset %] |
1 |
[% USE Asset %] |
2 |
[% USE ItemTypes %] |
2 |
[% USE ItemTypes %] |
|
|
3 |
[% SET footerjs = 1 %] |
3 |
[% INCLUDE 'doc-head-open.inc' %] |
4 |
[% INCLUDE 'doc-head-open.inc' %] |
4 |
<title>Koha › Tools › Label creator › Batches › [% IF batch_id %]Edit ([% batch_id %])[% ELSE %]New[% END %]</title> |
5 |
<title>Koha › Tools › Label creator › Batches › [% IF batch_id %]Edit ([% batch_id %])[% ELSE %]New[% END %]</title> |
5 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% INCLUDE 'greybox.inc' %] |
|
|
7 |
[% Asset.css("css/datatables.css") %] |
7 |
[% Asset.css("css/datatables.css") %] |
8 |
[% INCLUDE 'datatables.inc' %] |
|
|
9 |
<script type="text/javascript"> |
10 |
//<![CDATA[ |
11 |
function DeleteConfirm() { |
12 |
var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id %]"); |
13 |
var answer = confirm(msg); |
14 |
if (answer) { |
15 |
window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id %]"; |
16 |
} |
17 |
else { |
18 |
return; // abort delete |
19 |
} |
20 |
}; |
21 |
function dofocus() { // named function req'd for body onload event by some FF and IE7 security models |
22 |
$(".focus:last").select(); |
23 |
} |
24 |
function verifyBarcodes(barcodes) { |
25 |
if (barcodes.value == '') { |
26 |
alert(_("Please add barcodes using either the direct entry text area or the item search.")); |
27 |
return false; // not ok |
28 |
} |
29 |
else { |
30 |
return true; // ok |
31 |
}; |
32 |
} |
33 |
function Remove() { |
34 |
items = new Array; |
35 |
item_num = new Array; |
36 |
if(document.items.action.length > 0) { |
37 |
for (var i=0; i < document.items.action.length; i++) { |
38 |
if (document.items.action[i].checked) { |
39 |
items.push("label_id=" + document.items.action[i].value); |
40 |
item_num.push(i+1); |
41 |
} |
42 |
} |
43 |
getstr = items.join("&"); |
44 |
item_msg = item_num.join(", "); |
45 |
var msg = _("Are you sure you want to remove label number(s): %s from this batch?").format(item_msg); |
46 |
} else if (document.items.action.checked) { |
47 |
alert(_("Deletion of label from a batch with only one label will delete the batch.") + "\n\n" + _("If this is what you want, select the 'Delete batch' option from the toolbar")); |
48 |
return; // no deletion for single item batch |
49 |
} |
50 |
else { |
51 |
alert(_("Please select at least one label to delete.")); |
52 |
return; // no item selected |
53 |
} |
54 |
var answer = confirm(msg); |
55 |
if (answer) { |
56 |
window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id %]&" + getstr; |
57 |
} |
58 |
else { |
59 |
return; // abort delete |
60 |
} |
61 |
}; |
62 |
function Add() { |
63 |
var number_list = document.getElementById("number_list"); |
64 |
if (number_list.value == '') { |
65 |
window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=[% batch_id %]&type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes'); |
66 |
} |
67 |
else { |
68 |
document.forms["add_by_number"].submit(); |
69 |
} |
70 |
}; |
71 |
|
72 |
function add_item(item_number) { |
73 |
$("#itemnum_enter").prop("checked",true); |
74 |
$("#number_list").val($("#number_list").val()+item_number+"\r\n"); |
75 |
}; |
76 |
|
77 |
function DeDuplicate() { |
78 |
window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]"; |
79 |
}; |
80 |
function Xport(mode) { |
81 |
if (mode == 'label') { |
82 |
labels= new Array; |
83 |
if(document.items.action.length > 0) { |
84 |
for (var i=0; i < document.items.action.length; i++) { |
85 |
if (document.items.action[i].checked) { |
86 |
labels.push("label_id=" + document.items.action[i].value); |
87 |
} |
88 |
} |
89 |
if (labels.length < 1) { |
90 |
alert(_("Please select at least one label to export.")); |
91 |
return; // no batch selected |
92 |
} |
93 |
getstr = labels.join("&"); |
94 |
} |
95 |
else if (document.items.action.checked) { |
96 |
getstr = document.items.action.value; |
97 |
} |
98 |
else { |
99 |
alert(_("Please select at least one label to export.")); |
100 |
return; // no batch selected |
101 |
} |
102 |
return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]&" + getstr, 400, 800); |
103 |
} |
104 |
else if (mode == 'batch') { |
105 |
return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]", 400, 800); |
106 |
} |
107 |
else { |
108 |
// some pass-thru error trapping just in case... |
109 |
} |
110 |
}; |
111 |
function selected_layout() { |
112 |
if (document.items.action.length) { |
113 |
for (i=0;i<document.items.action.length;i++){ |
114 |
if (document.items.action[i].checked==true){ |
115 |
return(document.items.action[i].value); |
116 |
} |
117 |
}; |
118 |
} |
119 |
else { |
120 |
if (document.items.action.checked){ |
121 |
return(document.items.action.value); |
122 |
} |
123 |
}; |
124 |
alert(_("Please select at least one item.")); |
125 |
return (-1); |
126 |
}; |
127 |
|
128 |
$(document).ready(function() { |
129 |
$("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, { |
130 |
"autoWidth": false, |
131 |
"aoColumnDefs": [ |
132 |
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] }, |
133 |
{ "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, |
134 |
], |
135 |
"aaSorting": [[ 0, "asc" ]], |
136 |
"sPaginationType": "four_button" |
137 |
})); |
138 |
$("#additems").click(function(){ |
139 |
Add(); |
140 |
return false; |
141 |
}); |
142 |
$("#removeitems").click(function(){ |
143 |
Remove(); |
144 |
return false; |
145 |
}); |
146 |
$("#deletebatch").click(function(){ |
147 |
DeleteConfirm(); |
148 |
return false; |
149 |
}); |
150 |
$("#deduplicate").click(function(){ |
151 |
DeDuplicate(); |
152 |
return false; |
153 |
}); |
154 |
$("#exportitems").click(function(){ |
155 |
Xport('label'); |
156 |
return false; |
157 |
}); |
158 |
$("#exportbatch").click(function(){ |
159 |
Xport('batch'); |
160 |
return false; |
161 |
}); |
162 |
$(".delete").on("click", function(){ |
163 |
return confirmDelete( _("Are you sure you want to delete this?") ); |
164 |
}); |
165 |
$(".export").on("click", function(e){ |
166 |
e.preventDefault(); |
167 |
var label_id = $(this).data("label-id"); |
168 |
var batch_id = $(this).data("batch-id"); |
169 |
GB_showCenter(_("Export labels"),"/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id, 400, 800); |
170 |
}); |
171 |
}); |
172 |
//]]> |
173 |
</script> |
174 |
</head> |
8 |
</head> |
|
|
9 |
|
175 |
<body id="labels_label-edit-batch" class="tools labels" onload="dofocus();"> |
10 |
<body id="labels_label-edit-batch" class="tools labels" onload="dofocus();"> |
176 |
[% INCLUDE 'header.inc' %] |
11 |
[% INCLUDE 'header.inc' %] |
177 |
[% INCLUDE 'cat-search.inc' %] |
12 |
[% INCLUDE 'cat-search.inc' %] |
Lines 186-195
Link Here
|
186 |
New |
21 |
New |
187 |
[% END %] |
22 |
[% END %] |
188 |
</div> |
23 |
</div> |
189 |
<div id="doc3" class="yui-t2"> |
24 |
|
190 |
<div id="bd"> |
25 |
<div class="main container-fluid"> |
191 |
<div id="yui-main"> |
26 |
<div class="row"> |
192 |
<div class="yui-b"> |
27 |
<div class="col-sm-10 col-sm-push-2"> |
|
|
28 |
<main> |
29 |
|
193 |
[% INCLUDE 'labels-toolbar.inc' %] |
30 |
[% INCLUDE 'labels-toolbar.inc' %] |
194 |
[% IF ( err ) %] |
31 |
[% IF ( err ) %] |
195 |
[% BLOCK xlate_errtype %] |
32 |
[% BLOCK xlate_errtype %] |
Lines 311-320
Link Here
|
311 |
</div> |
148 |
</div> |
312 |
[% END %] |
149 |
[% END %] |
313 |
</div> |
150 |
</div> |
314 |
</div> |
151 |
</main> |
315 |
</div> |
152 |
</div> <!-- /.col-sm-10.col-sm-push-2 --> |
316 |
<div class="yui-b"> |
153 |
|
317 |
[% INCLUDE 'tools-menu.inc' %] |
154 |
<div class="col-sm-2 col-sm-pull-10"> |
318 |
</div> |
155 |
<aside> |
319 |
</div> |
156 |
[% INCLUDE 'tools-menu.inc' %] |
320 |
[% INCLUDE 'intranet-bottom.inc' %] |
157 |
</aside> |
|
|
158 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
159 |
</div> <!-- /.row --> |
160 |
|
161 |
[% MACRO jsinclude BLOCK %] |
162 |
[% Asset.js("js/tools-menu.js") %] |
163 |
[% INCLUDE 'greybox.inc' %] |
164 |
[% INCLUDE 'datatables.inc' %] |
165 |
<script> |
166 |
function DeleteConfirm() { |
167 |
var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id %]"); |
168 |
var answer = confirm(msg); |
169 |
if (answer) { |
170 |
window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id %]"; |
171 |
} |
172 |
else { |
173 |
return; // abort delete |
174 |
} |
175 |
} |
176 |
function dofocus() { // named function req'd for body onload event by some FF and IE7 security models |
177 |
$(".focus:last").select(); |
178 |
} |
179 |
function verifyBarcodes(barcodes) { |
180 |
if (barcodes.value == '') { |
181 |
alert(_("Please add barcodes using either the direct entry text area or the item search.")); |
182 |
return false; // not ok |
183 |
} |
184 |
else { |
185 |
return true; // ok |
186 |
} |
187 |
} |
188 |
function Remove() { |
189 |
items = new Array; |
190 |
item_num = new Array; |
191 |
if(document.items.action.length > 0) { |
192 |
for (var i=0; i < document.items.action.length; i++) { |
193 |
if (document.items.action[i].checked) { |
194 |
items.push("label_id=" + document.items.action[i].value); |
195 |
item_num.push(i+1); |
196 |
} |
197 |
} |
198 |
getstr = items.join("&"); |
199 |
item_msg = item_num.join(", "); |
200 |
var msg = _("Are you sure you want to remove label number(s): %s from this batch?").format(item_msg); |
201 |
} else if (document.items.action.checked) { |
202 |
alert(_("Deletion of label from a batch with only one label will delete the batch.") + "\n\n" + _("If this is what you want, select the 'Delete batch' option from the toolbar")); |
203 |
return; // no deletion for single item batch |
204 |
} else { |
205 |
alert(_("Please select at least one label to delete.")); |
206 |
return; // no item selected |
207 |
} |
208 |
var answer = confirm(msg); |
209 |
if (answer) { |
210 |
window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id %]&" + getstr; |
211 |
} else { |
212 |
return; // abort delete |
213 |
} |
214 |
} |
215 |
function Add() { |
216 |
var number_list = document.getElementById("number_list"); |
217 |
if (number_list.value == '') { |
218 |
window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=[% batch_id %]&type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes'); |
219 |
} else { |
220 |
document.forms["add_by_number"].submit(); |
221 |
} |
222 |
} |
223 |
|
224 |
function add_item(item_number) { |
225 |
$("#itemnum_enter").prop("checked",true); |
226 |
$("#number_list").val($("#number_list").val()+item_number+"\r\n"); |
227 |
} |
228 |
|
229 |
function DeDuplicate() { |
230 |
window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id %]"; |
231 |
} |
232 |
|
233 |
function Xport(mode) { |
234 |
if (mode == 'label') { |
235 |
labels= new Array; |
236 |
if(document.items.action.length > 0) { |
237 |
for (var i=0; i < document.items.action.length; i++) { |
238 |
if (document.items.action[i].checked) { |
239 |
labels.push("label_id=" + document.items.action[i].value); |
240 |
} |
241 |
} |
242 |
if (labels.length < 1) { |
243 |
alert(_("Please select at least one label to export.")); |
244 |
return; // no batch selected |
245 |
} |
246 |
getstr = labels.join("&"); |
247 |
} |
248 |
else if (document.items.action.checked) { |
249 |
getstr = document.items.action.value; |
250 |
} else { |
251 |
alert(_("Please select at least one label to export.")); |
252 |
return; // no batch selected |
253 |
} |
254 |
return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]&" + getstr, 400, 800); |
255 |
} else if (mode == 'batch') { |
256 |
return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]", 400, 800); |
257 |
} else { |
258 |
// some pass-thru error trapping just in case... |
259 |
} |
260 |
} |
261 |
|
262 |
function selected_layout() { |
263 |
if (document.items.action.length) { |
264 |
for (i=0;i<document.items.action.length;i++){ |
265 |
if (document.items.action[i].checked==true){ |
266 |
return(document.items.action[i].value); |
267 |
} |
268 |
} |
269 |
} else { |
270 |
if (document.items.action.checked){ |
271 |
return(document.items.action.value); |
272 |
} |
273 |
} |
274 |
alert(_("Please select at least one item.")); |
275 |
return (-1); |
276 |
} |
277 |
|
278 |
$(document).ready(function() { |
279 |
$("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, { |
280 |
"autoWidth": false, |
281 |
"aoColumnDefs": [ |
282 |
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] }, |
283 |
{ "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, |
284 |
], |
285 |
"aaSorting": [[ 0, "asc" ]], |
286 |
"sPaginationType": "four_button" |
287 |
})); |
288 |
$("#additems").click(function(){ |
289 |
Add(); |
290 |
return false; |
291 |
}); |
292 |
$("#removeitems").click(function(){ |
293 |
Remove(); |
294 |
return false; |
295 |
}); |
296 |
$("#deletebatch").click(function(){ |
297 |
DeleteConfirm(); |
298 |
return false; |
299 |
}); |
300 |
$("#deduplicate").click(function(){ |
301 |
DeDuplicate(); |
302 |
return false; |
303 |
}); |
304 |
$("#exportitems").click(function(){ |
305 |
Xport('label'); |
306 |
return false; |
307 |
}); |
308 |
$("#exportbatch").click(function(){ |
309 |
Xport('batch'); |
310 |
return false; |
311 |
}); |
312 |
$(".delete").on("click", function(){ |
313 |
return confirmDelete( _("Are you sure you want to delete this?") ); |
314 |
}); |
315 |
$(".export").on("click", function(e){ |
316 |
e.preventDefault(); |
317 |
var label_id = $(this).data("label-id"); |
318 |
var batch_id = $(this).data("batch-id"); |
319 |
GB_showCenter(_("Export labels"),"/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id, 400, 800); |
320 |
}); |
321 |
}); |
322 |
</script> |
323 |
[% END %] |
324 |
|
325 |
[% INCLUDE 'intranet-bottom.inc' %] |