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 › Cataloging › 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 [% WRAPPER breadcrumbs %]
17 [% WRAPPER breadcrumb_item %]
18 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
20 [% WRAPPER breadcrumb_item %]
21 <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a>
23 [% WRAPPER breadcrumb_item %]
24 <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Batches</a>
26 [% WRAPPER breadcrumb_item bc_active= 1 %]
28 <span>Edit [% description | html %]</span>
30 <span>Edit label batch [% batch_id | html %]</span>
32 <span>New label batch</span>
35 [% END #/ WRAPPER breadcrumbs %]
36 [% END #/ WRAPPER sub-header.inc %]
38 <div class="main container-fluid">
40 <div class="col-sm-10 col-sm-push-2">
43 [% INCLUDE 'labels-toolbar.inc' %]
46 <h1>Edit [% description | html %]</h1>
48 <h1>Edit label batch [% batch_id | html %]</h1>
50 <h1>New label batch</h1>
54 [% BLOCK xlate_errtype %]
56 [% CASE 'ITEM_NOT_REMOVED' %]
57 <span>Item(s) not removed from batch [% batch_id | html %].</span>
58 [% CASE 'BATCH_NOT_DELETED' %]
59 <span>Batch [% batch_id | html %] was not deleted.</span>
60 [% CASE 'ITEM_NOT_ADDED' %]
61 <span>Item(s) not added to batch [% batch_id | html %].</span>
62 [% CASE 'BRANCH_NOT_SET' %]
63 <span>Library is not set, please set your library before adding items to a batch.</span>
64 [% CASE 'BATCH_NOT_DEDUP' %]
65 <span>Batch [% batch_id | html %] not fully de-duplicated.</span>
67 <span>Unknown error type [% errtype | html %].</span>
70 <div class="dialog alert">
71 <strong>WARNING:</strong> An error was encountered: [% PROCESS xlate_errtype %] Please have your system administrator check the error log for details.
73 [% ELSIF ( duplicate_message ) %]
74 <div class="dialog message">
75 <strong>Duplicate item(s) removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
79 <div id="manage-label-batches">
80 <form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
82 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
83 <ol><li id="description">
84 <input type="hidden" name="op" value="add" />
85 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
86 <label for="description">Batch description: </label>
87 <input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
90 <input type="radio" name="number_type" id="barcode_enter" value="barcode" checked />
91 <label for="barcode_enter">Enter by barcode:</label>
94 <input type="radio" name="number_type" id="itemnum_enter" value="itemnumber" />
95 <label for="itemnum_enter">Enter by itemnumber:</label>
98 <label for="number_list">
99 Add by barcode(s) or itemnumbers(s):
101 <textarea rows="5" id="number_list" name="number_list" tabindex="1" class="focus"></textarea>
104 <br /> Leave empty to add via item search (itemnumber)
110 <div id="batch-manage" class="btn-toolbar">
111 <a class="btn btn-default" id="additems" href="#"><i class="fa fa-plus"></i> Add item(s)</a>[% IF ( table_loop ) %]
112 <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
113 <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash-can"></i> Remove selected items</a>
114 <a class="btn btn-default" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
115 <a class="btn btn-default" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
116 <a class="btn btn-default" id="exportitems" href="#"><i class="fa-solid fa-share-from-square"></i> Export selected items</a>
117 <a class="btn btn-default" id="exportbatch" href="#"><i class="fa-solid fa-share-from-square"></i> Export full batch</a>[% END %]
119 [% IF ( table_loop ) %]
121 <h2>Items in batch number [% batch_id | html %]</h2>
123 <div class="page-section">
125 [% FOREACH table_loo IN table_loop %]
126 [% IF ( table_loo.header_fields ) %]
129 [% FOREACH header_field IN table_loo.header_fields %]
130 [% SWITCH header_field.field_label -%]
131 [% CASE "Label number" -%]
132 <th>Label number</th>
133 [% CASE "Summary" -%]
134 <th class="anti-the">Summary</th>
135 [% CASE "Item type" %]
137 [% CASE "Call number" %]
144 <th>[% header_field.field_label | html %]</th>
152 [% FOREACH text_field IN table_loo.text_fields %]
153 [% IF ( text_field.select_field ) %]
155 <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-can"></i> Delete</a>
156 <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-solid fa-share-from-square"></i> Export</a>
158 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]"></td>
161 [% IF ( text_field.field_name == '_item_type_tbl' ) %]
162 [% ItemTypes.GetDescription( text_field.field_value ) | html %]
164 [% text_field.field_value | $raw %]
174 </div> <!-- /.page-section -->
177 <div class="dialog message">
178 <h4>There are no items in this batch yet</h4>
179 <p>Add items by using the text area above or leave empty to add via item search.</p>
184 </div> <!-- /.col-sm-10.col-sm-push-2 -->
186 <div class="col-sm-2 col-sm-pull-10">
188 [% INCLUDE 'cat-menu.inc' %]
190 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
191 </div> <!-- /.row -->
193 [% MACRO jsinclude BLOCK %]
194 [% INCLUDE 'greybox.inc' %]
195 [% INCLUDE 'datatables.inc' %]
197 function DeleteConfirm() {
198 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
199 var answer = confirm(msg);
201 window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id | html %]";
204 return; // abort delete
207 function dofocus() { // named function req'd for body onload event by some FF and IE7 security models
208 $(".focus:last").select();
210 function verifyBarcodes(barcodes) {
211 if (barcodes.value == '') {
212 alert(_("Please add barcodes using either the direct entry text area or the item search."));
213 return false; // not ok
221 item_num = new Array;
222 if(document.items.action.length > 0) {
223 for (var i=0; i < document.items.action.length; i++) {
224 if (document.items.action[i].checked) {
225 items.push("label_id=" + document.items.action[i].value);
229 getstr = items.join("&");
230 item_msg = item_num.join(", ");
231 var msg = _("Are you sure you want to remove label number(s): %s from this batch?").format(item_msg);
232 } else if (document.items.action.checked) {
233 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"));
234 return; // no deletion for single item batch
236 alert(_("Please select at least one label to delete."));
237 return; // no item selected
239 var answer = confirm(msg);
241 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
243 return; // abort delete
247 var number_list = document.getElementById("number_list");
248 if (number_list.value == '') {
249 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');
251 document.forms["add_by_number"].submit();
255 function add_item(item_number) {
256 $("#itemnum_enter").prop("checked",true);
257 $("#number_list").val($("#number_list").val()+item_number+"\r\n");
260 function DeDuplicate() {
261 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
264 function Xport(mode) {
265 if (mode == 'label') {
267 if(document.items.action.length > 0) {
268 for (var i=0; i < document.items.action.length; i++) {
269 if (document.items.action[i].checked) {
270 labels.push("label_id=" + document.items.action[i].value);
273 if (labels.length < 1) {
274 alert(_("Please select at least one label to export."));
275 return; // no batch selected
277 getstr = labels.join("&");
279 else if (document.items.action.checked) {
280 getstr = document.items.action.value;
282 alert(_("Please select at least one label to export."));
283 return; // no batch selected
285 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
286 } else if (mode == 'batch') {
287 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]", 400, 800);
289 // some pass-thru error trapping just in case...
293 function selected_layout() {
294 if (document.items.action.length) {
295 for (i=0;i<document.items.action.length;i++){
296 if (document.items.action[i].checked==true){
297 return(document.items.action[i].value);
301 if (document.items.action.checked){
302 return(document.items.action.value);
305 alert(_("Please select at least one item."));
309 $(document).ready(function() {
310 $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').addClass("current");
312 $("#description").show();
314 $("#description").hide();
316 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
319 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
320 { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
322 "aaSorting": [[ 0, "asc" ]],
323 "sPaginationType": "full"
325 $("#additems").click(function(){
329 $("#removeitems").click(function(){
333 $("#deletebatch").click(function(){
337 $("#deduplicate").click(function(){
341 $("#exportitems").click(function(){
345 $("#exportbatch").click(function(){
349 $(".delete").on("click", function(){
350 return confirmDelete( _("Are you sure you want to delete this?") );
352 $(".export").on("click", function(e){
354 var label_id = $(this).data("label-id");
355 var batch_id = $(this).data("batch-id");
356 GB_showCenter(_("Export labels"),"/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id, 400, 800);
358 $("#savedesc").click(function(event){
359 event.preventDefault(); // prevent form submission
360 var newdescription = $('input[name="description"]').val();
361 var batch_id = $(this).data('batch_id');
363 'newdescription': newdescription,
364 'batch_id': batch_id,
365 'card_element': "batch",
370 url: '/cgi-bin/koha/svc/creator_batches',
376 .done(function(data){
377 if (data.status == 'success') {
378 $("input[name='description']").text(data.newdesc);
379 $("#change-status").text(_("Saved"));
381 $("#change-status").text(_("Unable to save description"));
389 [% INCLUDE 'intranet-bottom.inc' %]