5 [% CASE 'barcode' %]<span>Barcode</span>
6 [% CASE 'itemcallnumber' %]<span>Call number</span>
7 [% CASE 'stocknumber' %]<span>Inventory number</span>
8 [% CASE 'title' %]<span>Title</span>
9 [% CASE 'author' %]<span>Author</span>
10 [% CASE 'publishercode' %]<span>Publisher</span>
11 [% CASE 'publicationyear' %]<span>Publication date</span>
12 [% CASE 'collectiontitle' %]<span>Collection</span>
13 [% CASE 'isbn' %]<span>ISBN</span>
14 [% CASE 'issn' %]<span>ISSN</span>
15 [% CASE 'homebranch' %]<span>Home library</span>
16 [% CASE 'holdingbranch' %]<span>Current location</span>
17 [% CASE 'All libraries' %]<span>All libraries</span>
18 [% CASE 'location' %]<span>Shelving location</span>
19 [% CASE 'All locations' %]<span>All locations</span>
20 [% CASE 'itype' %]<span>Item type</span>
21 [% CASE 'All item types' %]<span>All item types</span>
22 [% CASE 'ccode' %]<span>Collection code</span>
23 [% CASE 'All collection codes' %]<span>All collection codes</span>
24 [% CASE 'notforloan' %]<span>Status</span>
25 [% CASE 'All statuses' %]<span>All statuses</span>
26 [% CASE 'damaged' %]<span>Damaged</span>
27 [% CASE 'itemlost' %]<span>Lost</span>
31 [% BLOCK form_field_select %]
32 <div class="form-field form-field-select">
33 <label class="form-field-label" for="[% name %]">[% INCLUDE form_label label=name %]</label>
34 <select id="[% name %]_op" name="[% name %]_op">
35 <option value="=">is</option>
36 <option value="!=" >is not</option>
38 <select id="[% name %]" name="[% name %]" multiple="multiple" size="[% options.size < 4 ? options.size + 1 : 4 %]">
39 <option value="" selected="selected">
40 [% IF (empty_option) %][% INCLUDE form_label label=empty_option %][% ELSE %]<span>All</span>[% END %]
42 [% FOREACH option IN options %]
43 <option value="[% option.value %]">[% option.label %]</option>
49 [% BLOCK form_field_select_option %]
50 <option value="[% value %]">[% INCLUDE form_label label=value %]</option>
53 [% BLOCK form_field_select_text %]
54 <div class="form-field form-field-select-text">
55 <select name="c" class="form-field-conjunction" disabled="disabled">
56 <option value="and">AND</option>
57 <option value="or">OR</option>
59 <select name="f" class="form-field-column">
60 [% INCLUDE form_field_select_option value='barcode' %]
61 [% INCLUDE form_field_select_option value='itemcallnumber' %]
62 [% INCLUDE form_field_select_option value='stocknumber' %]
63 [% INCLUDE form_field_select_option value='title' %]
64 [% INCLUDE form_field_select_option value='author' %]
65 [% INCLUDE form_field_select_option value='publishercode' %]
66 [% INCLUDE form_field_select_option value='publicationyear' %]
67 [% INCLUDE form_field_select_option value='collectiontitle' %]
68 [% INCLUDE form_field_select_option value='isbn' %]
69 [% INCLUDE form_field_select_option value='issn' %]
70 [% IF items_search_fields.size %]
71 <optgroup label="Custom search fields">
72 [% FOREACH field IN items_search_fields %]
73 [% marcfield = field.tagfield %]
74 [% IF field.tagsubfield %]
75 [% marcfield = marcfield _ '$' _ field.tagsubfield %]
77 <option value="marc:[% marcfield %]" data-authorised-values-category="[% field.authorised_values_category %]">[% field.label %] ([% marcfield %])</option>
82 <input type="text" name="q" class="form-field-value" value="" />
83 <input type="hidden" name="op" value="like" />
87 [% BLOCK form_field_radio_yes_no %]
88 <div class="form-field">
89 <label class="form-field-label">[% INCLUDE form_label label=name %]:</label>
90 <input type="radio" name="[% name %]" id="[% name %]_indifferent" value="" checked="checked"/>
91 <label for="[% name %]_indifferent">Ignore</label>
92 <input type="radio" name="[% name %]" id="[% name %]_yes" value="yes" />
93 <label for="[% name %]_yes">Yes</label>
94 <input type="radio" name="[% name %]" id="[% name %]_no" value="no" />
95 <label for="[% name %]_no">No</label>
99 [%# Page starts here %]
101 [% INCLUDE 'doc-head-open.inc' %]
102 <title>Koha › Catalog › Item search</title>
103 [% INCLUDE 'doc-head-close.inc' %]
104 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
105 [% INCLUDE 'datatables.inc' %]
106 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
107 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
108 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/itemsearchform.css" />
109 <script type="text/javascript">
111 var authorised_values = [% authorised_values_json %];
113 function loadAuthorisedValuesSelect(select) {
114 var selected = select.find('option:selected');
115 var category = selected.data('authorised-values-category');
116 var form_field_value = select.siblings('.form-field-value');
117 if (category && category in authorised_values) {
118 var values = authorised_values[category];
119 var html = '<select name="q" class="form-field-value">\n';
121 var value = values[i];
122 html += '<option value="' + value.authorised_value + '">' + value.lib + '</option>\n';
124 html += '</select>\n';
125 var new_form_field_value = $(html);
126 new_form_field_value.val(form_field_value.val());
127 form_field_value.replaceWith(new_form_field_value);
129 if (form_field_value.prop('tagName').toLowerCase() == 'select') {
130 html = '<input name="q" type="text" class="form-field-value" />';
131 var new_form_field_value = $(html);
132 form_field_value.replaceWith(new_form_field_value);
137 function addNewField() {
138 var form_field = $('div.form-field-select-text').last();
139 var copy = form_field.clone(true);
140 copy.find('input,select').not('[type="hidden"]').each(function() {
143 copy.find('.form-field-conjunction').prop('disabled', false);
144 form_field.after(copy);
145 copy.find('select.form-field-column').change();
148 function submitForm($form) {
151 + ' <th>' + _("Title") + '</th>'
152 + ' <th>' + _("Publication date") + '</th>'
153 + ' <th>' + _("Publisher") + '</th>'
154 + ' <th>' + _("Collection") + '</th>'
155 + ' <th>' + _("Barcode") + '</th>'
156 + ' <th>' + _("Call number") + '</th>'
157 + ' <th>' + _("Home library") + '</th>'
158 + ' <th>' + _("Current location") + '</th>'
159 + ' <th>' + _("Shelving location") + '</th>'
160 + ' <th>' + _("Inventory number") + '</th>'
161 + ' <th>' + _("Status") + '</th>'
162 + ' <th>' + _("Checkouts") + '</th>'
166 + '<table id="results">'
167 + ' <thead>' + tr + tr + '</thead>'
171 var advSearchLink = $('<a>')
172 .attr('href', '/cgi-bin/koha/catalogue/search.pl')
173 .html(_("Go to advanced search"));
174 var editSearchLink = $('<a>')
176 .html(_("Edit search"))
177 .addClass('btn btn-default btn-xs')
178 .on('click', function(e) {
180 $('#item-search-block').show();
183 var csvExportLink = $('<a>')
185 .html(_("Export results to CSV"))
186 .addClass('btn btn-default btn-xs')
187 .on('click', function(e) {
189 $('#format-csv').prop('checked', true);
190 $('#itemsearchform').submit();
191 $('#format-html').prop('checked', true);
193 var barcodesExportLink = $('<a>')
195 .html(_("Export results to barcodes file"))
196 .addClass('btn btn-default btn-xs')
197 .on('click', function(e) {
199 $('#format-barcodes').prop('checked', true);
200 $('#itemsearchform').submit();
201 $('#format-html').prop('checked', true);
204 var editSearchAndExportLinks = $('<p>')
205 .append(editSearchLink)
207 .append(csvExportLink)
209 .append(barcodesExportLink);
211 var results_heading = $('<div>').addClass('results-heading')
212 .append("<h1>" + _("Item search results") + "</h1>")
213 .append($('<p>').append(advSearchLink))
214 .append(editSearchAndExportLinks);
215 $('#results-wrapper').empty()
216 .append(results_heading)
220 $form.find('select').not(':disabled').find('option:selected').each(function () {
221 var name = $(this).parents('select').first().attr('name');
222 var value = $(this).val();
223 params.push({ 'name': name, 'value': value });
225 $form.find('input[type="text"],input[type="hidden"]').not(':disabled').each(function () {
226 params.push({ 'name': $(this).attr('name'), 'value': $(this).val() });
228 $form.find('input[type="radio"]:checked').each(function() {
229 params.push({ 'name': $(this).attr('name'), 'value': $(this).val() });
232 $('#results').dataTable($.extend(true, {}, dataTablesDefaults, {
236 'sAjaxSource': '/cgi-bin/koha/catalogue/itemsearch.pl',
237 'fnServerData': function(sSource, aoData, fnCallback) {
238 aoData.push( { 'name': 'format', 'value': 'json' } );
240 aoData.push(params[i]);
247 'success': function(json){
252 'sDom': '<"top pager"ilp>t<"bottom pager"ip>r',
254 { 'sName': 'title' },
255 { 'sName': 'publicationyear' },
256 { 'sName': 'publishercode' },
257 { 'sName': 'ccode' },
258 { 'sName': 'barcode' },
259 { 'sName': 'itemcallnumber' },
260 { 'sName': 'homebranch' },
261 { 'sName': 'holdingbranch' },
262 { 'sName': 'location' },
263 { 'sName': 'stocknumber' },
264 { 'sName': 'notforloan' },
265 { 'sName': 'issues' },
266 { 'sName': 'checkbox', 'bSortable': false }
268 "sPaginationType": "full_numbers"
270 'sPlaceHolder': 'head:after',
275 { 'type': 'select', 'values': [% ccodes.json %] },
278 { 'type': 'select', 'values': [% branches.json %] },
279 { 'type': 'select', 'values': [% branches.json %] },
280 [% IF locations.size %]
281 { 'type': 'select', 'values': [% locations.json %] },
286 [% IF notforloans.size %]
287 { 'type': 'select', 'values': [% notforloans.json %] },
297 $(document).ready(function () {
298 $('#toolbar').fixFloat();
299 // Add the "New field" link.
300 var form_field = $('div.form-field-select-text').last()
301 var NEW_FIELD = _("New field");
302 var button_field_new = $('<a href="#" class="button-field-new" title="Add a new field">' + NEW_FIELD + '</a>');
303 button_field_new.click(function() {
307 form_field.after(button_field_new);
309 // If a field is linked to an authorised values list, display the list.
310 $('div.form-field-select-text select').change(function() {
311 loadAuthorisedValuesSelect($(this));
314 // Prevent user to select the 'All ...' option with other options.
315 $('div.form-field-select').each(function() {
316 $(this).find('select').filter(':last').change(function() {
317 values = $(this).val();
318 if (values.length > 1) {
319 var idx = $.inArray('', values);
321 values.splice(idx, 1);
328 $('#itemsearchform').submit(function() {
329 var searchform = $(this);
330 var format = searchform.find('input[name="format"]:checked').val();
331 if (format == 'html') {
332 submitForm(searchform);
333 $("#item-search-block").hide();
341 <body id="catalog_itemsearch" class="catalog">
342 [% INCLUDE 'header.inc' %]
343 [% INCLUDE 'home-search.inc' %]
344 <div id="breadcrumbs">
345 <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › Item search
348 <div id="doc" class="yui-t7">
349 <div id="item-search-block">
351 <p><a href="/cgi-bin/koha/catalogue/search.pl">Go to advanced search</a></p>
352 <form action="/cgi-bin/koha/catalogue/itemsearch.pl" method="get" id="itemsearchform">
353 <div id="toolbar" class="btn-toolbar">
354 <fieldset class="action">
355 <div class="btn-group">
356 <button class="btn btn-default btn-sm"><i class="fa fa-search"></i> Search</button>
361 [% INCLUDE form_field_select name="homebranch" options = branches empty_option = "All libraries" %]
362 [% INCLUDE form_field_select name="holdingbranch" options = branches empty_option = "All libraries" %]
363 [% IF locations.size %]
364 [% INCLUDE form_field_select name="location" options = locations empty_option = "All locations" %]
368 [% INCLUDE form_field_select name="itype" options = itemtypes empty_option = "All item types" %]
369 [% INCLUDE form_field_select name="ccode" options = ccodes empty_option = "All collection codes" %]
370 [% IF notforloans.size %]
371 [% INCLUDE form_field_select name="notforloan" options = notforloans empty_option = "All statuses" %]
375 [% INCLUDE form_field_select_text %]
376 <p class="hint">You can use the following wildcard characters: % _</p>
377 <p class="hint">% matches any number of characters</p>
378 <p class="hint">_ matches only a single character</p>
381 <div class="form-field">
382 <label class="form-field-label" for="itemcallnumber_from">From call number:</label>
383 <input type="text" id="itemcallnumber_from" name="itemcallnumber_from" value="" />
384 <span class="hint">(inclusive)</span>
386 <div class="form-field">
387 <label class="form-field-label" for="itemcallnumber_to">To call number:</label>
388 <input type="text" id="itemcallnumber_to" name="itemcallnumber_to" value="" />
389 <span class="hint">(inclusive)</span>
391 [% INCLUDE form_field_radio_yes_no name="damaged" %]
392 [% INCLUDE form_field_radio_yes_no name="itemlost" %]
393 <div class="form-field">
394 <label class="form-field-label" for="issues_op">Checkout count:</label>
395 <select id="issues_op" name="issues_op">
396 <option value=">">></option>
397 <option value="<"><</option>
398 <option value="=">=</option>
399 <option value="!=">!=</option>
401 <input type="text" name="issues" />
403 <div class="form-field">
404 <label class="form-field-label" for="datelastborrowed_op">Last checkout date:</label>
405 <select id="datelastborrowed_op" name="datelastborrowed_op">
406 <option value=">">After</option>
407 <option value="<">Before</option>
408 <option value="=">On</option>
410 <input type="text" name="datelastborrowed" />
411 <span class="hint">ISO Format (YYYY-MM-DD)</span>
415 <div class="form-field-radio">
416 <label>Output:</label>
417 <input type="radio" id="format-html" name="format" value="html" checked="checked" /> <label for="format-html">Screen</label>
418 <input type="radio" id="format-csv" name="format" value="csv" /> <label for="format-csv">CSV</label>
419 <input type="radio" id="format-barcodes" name="format" value="barcodes"/> <label for="format-barcodes">Barcodes file</label>
425 <div id="doc3" class="yui-t7">
426 <div id="results-wrapper"></div>
428 [% INCLUDE 'intranet-bottom.inc' %]