5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% IF batch_id %]Edit label batch ([% batch_id | html %])[% ELSE %]New label batch[% END %]› Batches › Label creator › Tools › Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
10 <body id="labels_label-edit-batch" class="tools labels" onload="dofocus();">
11 [% WRAPPER 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
15 [% WRAPPER 'sub-header.inc' %]
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
19 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
22 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
25 <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a>
28 <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Batches</a>
33 <a href="#" aria-current="page">
34 Edit [% description | html %]
40 <a href="#" aria-current="page">
41 Edit label batch [% batch_id | html %]
47 <a href="#" aria-current="page">
56 <div class="main container-fluid">
58 <div class="col-sm-10 col-sm-push-2">
61 [% INCLUDE 'labels-toolbar.inc' %]
64 <h1>Edit [% description | html %]</h1>
66 <h1>Edit label batch [% batch_id | html %]</h1>
68 <h1>New label batch</h1>
72 [% BLOCK xlate_errtype %]
74 [% CASE 'ITEM_NOT_REMOVED' %]
75 <span>Item(s) not removed from batch [% batch_id | html %].</span>
76 [% CASE 'BATCH_NOT_DELETED' %]
77 <span>Batch [% batch_id | html %] was not deleted.</span>
78 [% CASE 'ITEM_NOT_ADDED' %]
79 <span>Item(s) not added to batch [% batch_id | html %].</span>
80 [% CASE 'BRANCH_NOT_SET' %]
81 <span>Library is not set, please set your library before adding items to a batch.</span>
82 [% CASE 'BATCH_NOT_DEDUP' %]
83 <span>Batch [% batch_id | html %] not fully de-duplicated.</span>
85 <span>Unknown error type [% errtype | html %].</span>
88 <div class="dialog alert">
89 <strong>WARNING:</strong> An error was encountered: [% PROCESS xlate_errtype %] Please have your system administrator check the error log for details.
91 [% ELSIF ( duplicate_message ) %]
92 <div class="dialog message">
93 <strong>Duplicate item(s) removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
97 <div id="manage-label-batches">
98 <form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
100 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
101 <ol><li id="description">
102 <input type="hidden" name="op" value="add" />
103 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
104 <label for="description">Batch description: </label>
105 <input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
108 <input type="radio" name="number_type" id="barcode_enter" value="barcode" checked />
109 <label for="barcode_enter">Enter by barcode:</label>
112 <input type="radio" name="number_type" id="itemnum_enter" value="itemnumber" />
113 <label for="itemnum_enter">Enter by itemnumber:</label>
116 <label for="number_list">
117 Add by barcode(s) or itemnumbers(s):
119 <textarea rows="5" id="number_list" name="number_list" tabindex="1" class="focus"></textarea>
122 <br /> Leave empty to add via item search (itemnumber)
128 <div id="batch-manage" class="btn-toolbar">
129 <a class="btn btn-default" id="additems" href="#"><i class="fa fa-plus"></i> Add item(s)</a>[% IF ( table_loop ) %]
130 <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
131 <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected items</a>
132 <a class="btn btn-default" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
133 <a class="btn btn-default" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
134 <a class="btn btn-default" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected items</a>
135 <a class="btn btn-default" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export full batch</a>[% END %]
137 [% IF ( table_loop ) %]
139 <h2>Items in batch number [% batch_id | html %]</h2>
141 [% FOREACH table_loo IN table_loop %]
142 [% IF ( table_loo.header_fields ) %]
145 [% FOREACH header_field IN table_loo.header_fields %]
146 [% SWITCH header_field.field_label -%]
147 [% CASE "Label number" -%]
148 <th>Label number</th>
149 [% CASE "Summary" -%]
150 <th class="anti-the">Summary</th>
151 [% CASE "Item type" %]
153 [% CASE "Call number" %]
160 <th>[% header_field.field_label | html %]</th>
168 [% FOREACH text_field IN table_loo.text_fields %]
169 [% IF ( text_field.select_field ) %]
171 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id |url %]&label_id=[% text_field.field_value |url %]"><i class="fa fa-trash"></i> Delete</a>
172 <a class="btn btn-default btn-xs export" href="#" data-batch-id="[% batch_id | html %]" data-label-id="[% text_field.field_value | html %]"><i class="fa fa-share-square-o"></i> Export</a>
174 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]"></td>
177 [% IF ( text_field.field_name == '_item_type_tbl' ) %]
178 [% ItemTypes.GetDescription( text_field.field_value ) | html %]
180 [% text_field.field_value | $raw %]
192 <div class="dialog message">
193 <h4>There are no items in this batch yet</h4>
194 <p>Add items by using the text area above or leave empty to add via item search.</p>
199 </div> <!-- /.col-sm-10.col-sm-push-2 -->
201 <div class="col-sm-2 col-sm-pull-10">
203 [% INCLUDE 'tools-menu.inc' %]
205 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
206 </div> <!-- /.row -->
208 [% MACRO jsinclude BLOCK %]
209 [% Asset.js("js/tools-menu.js") | $raw %]
210 [% INCLUDE 'greybox.inc' %]
211 [% INCLUDE 'datatables.inc' %]
213 function DeleteConfirm() {
214 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
215 var answer = confirm(msg);
217 window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id | html %]";
220 return; // abort delete
223 function dofocus() { // named function req'd for body onload event by some FF and IE7 security models
224 $(".focus:last").select();
226 function verifyBarcodes(barcodes) {
227 if (barcodes.value == '') {
228 alert(_("Please add barcodes using either the direct entry text area or the item search."));
229 return false; // not ok
237 item_num = new Array;
238 if(document.items.action.length > 0) {
239 for (var i=0; i < document.items.action.length; i++) {
240 if (document.items.action[i].checked) {
241 items.push("label_id=" + document.items.action[i].value);
245 getstr = items.join("&");
246 item_msg = item_num.join(", ");
247 var msg = _("Are you sure you want to remove label number(s): %s from this batch?").format(item_msg);
248 } else if (document.items.action.checked) {
249 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"));
250 return; // no deletion for single item batch
252 alert(_("Please select at least one label to delete."));
253 return; // no item selected
255 var answer = confirm(msg);
257 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
259 return; // abort delete
263 var number_list = document.getElementById("number_list");
264 if (number_list.value == '') {
265 window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=[% batch_id | html %]&type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes');
267 document.forms["add_by_number"].submit();
271 function add_item(item_number) {
272 $("#itemnum_enter").prop("checked",true);
273 $("#number_list").val($("#number_list").val()+item_number+"\r\n");
276 function DeDuplicate() {
277 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
280 function Xport(mode) {
281 if (mode == 'label') {
283 if(document.items.action.length > 0) {
284 for (var i=0; i < document.items.action.length; i++) {
285 if (document.items.action[i].checked) {
286 labels.push("label_id=" + document.items.action[i].value);
289 if (labels.length < 1) {
290 alert(_("Please select at least one label to export."));
291 return; // no batch selected
293 getstr = labels.join("&");
295 else if (document.items.action.checked) {
296 getstr = document.items.action.value;
298 alert(_("Please select at least one label to export."));
299 return; // no batch selected
301 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
302 } else if (mode == 'batch') {
303 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]", 400, 800);
305 // some pass-thru error trapping just in case...
309 function selected_layout() {
310 if (document.items.action.length) {
311 for (i=0;i<document.items.action.length;i++){
312 if (document.items.action[i].checked==true){
313 return(document.items.action[i].value);
317 if (document.items.action.checked){
318 return(document.items.action.value);
321 alert(_("Please select at least one item."));
325 $(document).ready(function() {
327 $("#description").show();
329 $("#description").hide();
331 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
334 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
335 { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
337 "aaSorting": [[ 0, "asc" ]],
338 "sPaginationType": "full"
340 $("#additems").click(function(){
344 $("#removeitems").click(function(){
348 $("#deletebatch").click(function(){
352 $("#deduplicate").click(function(){
356 $("#exportitems").click(function(){
360 $("#exportbatch").click(function(){
364 $(".delete").on("click", function(){
365 return confirmDelete( _("Are you sure you want to delete this?") );
367 $(".export").on("click", function(e){
369 var label_id = $(this).data("label-id");
370 var batch_id = $(this).data("batch-id");
371 GB_showCenter(_("Export labels"),"/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id, 400, 800);
373 $("#savedesc").click(function(event){
374 event.preventDefault(); // prevent form submission
375 var newdescription = $('input[name="description"]').val();
376 var batch_id = $(this).data('batch_id');
378 'newdescription': newdescription,
379 'batch_id': batch_id,
380 'card_element': "batch",
385 url: '/cgi-bin/koha/svc/creator_batches',
391 .done(function(data){
392 if (data.status == 'success') {
393 $("input[name='description']").text(data.newdesc);
394 $("#change-status").text(_("Saved"));
396 $("#change-status").text(_("Unable to save description"));
404 [% INCLUDE 'intranet-bottom.inc' %]