5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Tools › Label creator › Batches › [% IF batch_id %]Edit ([% batch_id | html %])[% ELSE %]New[% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
10 <body id="labels_label-edit-batch" class="tools labels" onload="dofocus();">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'cat-search.inc' %]
13 <div id="breadcrumbs">
14 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
15 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
16 <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a> ›
17 <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Batches</a> ›
19 Edit <a href="/cgi-bin/koha/labels/label-edit-batch.pl?op=edit&element_id=[% batch_id | uri %]">[% description | html %]</a>
21 Edit <a href="/cgi-bin/koha/labels/label-edit-batch.pl?op=edit&element_id=[% batch_id | uri %]">([% batch_id | html %])</a>
27 <div class="main container-fluid">
29 <div class="col-sm-10 col-sm-push-2">
32 [% INCLUDE 'labels-toolbar.inc' %]
34 [% BLOCK xlate_errtype %]
36 [% CASE 'ITEM_NOT_REMOVED' %]
37 <span>Item(s) not removed from batch [% batch_id | html %].</span>
38 [% CASE 'BATCH_NOT_DELETED' %]
39 <span>Batch [% batch_id | html %] was not deleted.</span>
40 [% CASE 'ITEM_NOT_ADDED' %]
41 <span>Item(s) not added to batch [% batch_id | html %].</span>
42 [% CASE 'BRANCH_NOT_SET' %]
43 <span>Library is not set, please set your library before adding items to a batch.</span>
44 [% CASE 'BATCH_NOT_DEDUP' %]
45 <span>Batch [% batch_id | html %] not fully de-duplicated.</span>
47 <span>Unknown error type [% errtype | html %].</span>
50 <div class="dialog alert">
51 <strong>WARNING:</strong> An error was encountered: [% PROCESS xlate_errtype %] Please have your system administrator check the error log for details.
53 [% ELSIF ( duplicate_message ) %]
54 <div class="dialog message">
55 <strong>Duplicate item(s) removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
59 <div id="manage-label-batches">
60 <div class="hint">Current library: [% LoginBranchname | html %]</div>
61 <form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
63 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
64 <ol><li id="description">
65 <input type="hidden" name="op" value="add" />
66 <input type="hidden" name="batch_id" value="[% batch_id | html %]" />
67 <label for="description">Batch description: </label>
68 <input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
71 <input type="radio" name="number_type" id="barcode_enter" value="barcode" checked />
72 <label for="barcode_enter">Enter by barcode:</label><br/>
73 <input type="radio" name="number_type" id="itemnum_enter" value="itemnumber" />
74 <label for="itemnum_enter">Enter by itemnumber:</label>
77 <label for="number_list">Add by barcode(s) or itemnumbers(s):
78 <br /> <span class="hint">One number per line.</span>
79 <br /> <span class="hint">Leave empty to add via item search (itemnumber).</span>
81 <textarea rows="5" id="number_list" name="number_list" tabindex="1" class="focus"></textarea>
86 <div id="batch-manage" class="btn-toolbar">
87 <a class="btn btn-default btn-sm" id="additems" href="#"><i class="fa fa-plus"></i> Add item(s)</a>[% IF ( table_loop ) %]
88 <a class="btn btn-default btn-sm" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
89 <a class="btn btn-default btn-sm" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected items</a>
90 <a class="btn btn-default btn-sm" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
91 <a class="btn btn-default btn-sm" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
92 <a class="btn btn-default btn-sm" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected items</a>
93 <a class="btn btn-default btn-sm" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export full batch</a>[% END %]
95 [% IF ( table_loop ) %]
96 <form name="items" class="checkboxed">
97 <h2>Items in batch number [% batch_id | html %]</h2>
99 [% FOREACH table_loo IN table_loop %]
100 [% IF ( table_loo.header_fields ) %]
103 [% FOREACH header_field IN table_loo.header_fields %]
104 [% SWITCH header_field.field_label -%]
105 [% CASE "Label number" -%]
106 <th>Label number</th>
107 [% CASE "Summary" -%]
108 <th class="anti-the">Summary</th>
109 [% CASE "Item type" %]
111 [% CASE "Call number" %]
118 <th>[% header_field.field_label | html %]</th>
126 [% FOREACH text_field IN table_loo.text_fields %]
127 [% IF ( text_field.select_field ) %]
129 <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>
130 <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>
132 <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]"></td>
135 [% IF ( text_field.field_name == '_item_type_tbl' ) %]
136 [% ItemTypes.GetDescription( text_field.field_value ) | html %]
138 [% text_field.field_value | $raw %]
150 <div class="dialog message">
151 <h4>There are no items in this batch yet</h4>
152 <p>Add items by using the text area above or leave empty to add via item search.</p>
157 </div> <!-- /.col-sm-10.col-sm-push-2 -->
159 <div class="col-sm-2 col-sm-pull-10">
161 [% INCLUDE 'tools-menu.inc' %]
163 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
164 </div> <!-- /.row -->
166 [% MACRO jsinclude BLOCK %]
167 [% Asset.js("js/tools-menu.js") | $raw %]
168 [% INCLUDE 'greybox.inc' %]
169 [% INCLUDE 'datatables.inc' %]
171 function DeleteConfirm() {
172 var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
173 var answer = confirm(msg);
175 window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=batch&element_id=[% batch_id | html %]";
178 return; // abort delete
181 function dofocus() { // named function req'd for body onload event by some FF and IE7 security models
182 $(".focus:last").select();
184 function verifyBarcodes(barcodes) {
185 if (barcodes.value == '') {
186 alert(_("Please add barcodes using either the direct entry text area or the item search."));
187 return false; // not ok
195 item_num = new Array;
196 if(document.items.action.length > 0) {
197 for (var i=0; i < document.items.action.length; i++) {
198 if (document.items.action[i].checked) {
199 items.push("label_id=" + document.items.action[i].value);
203 getstr = items.join("&");
204 item_msg = item_num.join(", ");
205 var msg = _("Are you sure you want to remove label number(s): %s from this batch?").format(item_msg);
206 } else if (document.items.action.checked) {
207 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"));
208 return; // no deletion for single item batch
210 alert(_("Please select at least one label to delete."));
211 return; // no item selected
213 var answer = confirm(msg);
215 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
217 return; // abort delete
221 var number_list = document.getElementById("number_list");
222 if (number_list.value == '') {
223 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');
225 document.forms["add_by_number"].submit();
229 function add_item(item_number) {
230 $("#itemnum_enter").prop("checked",true);
231 $("#number_list").val($("#number_list").val()+item_number+"\r\n");
234 function DeDuplicate() {
235 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
238 function Xport(mode) {
239 if (mode == 'label') {
241 if(document.items.action.length > 0) {
242 for (var i=0; i < document.items.action.length; i++) {
243 if (document.items.action[i].checked) {
244 labels.push("label_id=" + document.items.action[i].value);
247 if (labels.length < 1) {
248 alert(_("Please select at least one label to export."));
249 return; // no batch selected
251 getstr = labels.join("&");
253 else if (document.items.action.checked) {
254 getstr = document.items.action.value;
256 alert(_("Please select at least one label to export."));
257 return; // no batch selected
259 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
260 } else if (mode == 'batch') {
261 return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id | html %]", 400, 800);
263 // some pass-thru error trapping just in case...
267 function selected_layout() {
268 if (document.items.action.length) {
269 for (i=0;i<document.items.action.length;i++){
270 if (document.items.action[i].checked==true){
271 return(document.items.action[i].value);
275 if (document.items.action.checked){
276 return(document.items.action.value);
279 alert(_("Please select at least one item."));
283 $(document).ready(function() {
285 $("#description").show();
287 $("#description").hide();
289 $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
292 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
293 { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
295 "aaSorting": [[ 0, "asc" ]],
296 "sPaginationType": "four_button"
298 $("#additems").click(function(){
302 $("#removeitems").click(function(){
306 $("#deletebatch").click(function(){
310 $("#deduplicate").click(function(){
314 $("#exportitems").click(function(){
318 $("#exportbatch").click(function(){
322 $(".delete").on("click", function(){
323 return confirmDelete( _("Are you sure you want to delete this?") );
325 $(".export").on("click", function(e){
327 var label_id = $(this).data("label-id");
328 var batch_id = $(this).data("batch-id");
329 GB_showCenter(_("Export labels"),"/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id, 400, 800);
331 $("#savedesc").click(function(event){
332 event.preventDefault(); // prevent form submission
333 var newdescription = $('input[name="description"]').val();
334 var batch_id = $(this).data('batch_id');
336 'newdescription': newdescription,
337 'batch_id': batch_id,
338 'card_element': "batch",
343 url: '/cgi-bin/koha/svc/creator_batches',
349 .done(function(data){
350 if (data.status == 'success') {
351 $("input[name='description']").text(data.newdesc);
352 $("#change-status").text(_("Saved"));
354 $("#change-status").text(_("Unable to save description"));
362 [% INCLUDE 'intranet-bottom.inc' %]