6 [% CASE 'barcode' %]<span>Barcode</span>
7 [% CASE 'itemcallnumber' %]<span>Call number</span>
8 [% CASE 'stocknumber' %]<span>Inventory number</span>
9 [% CASE 'title' %]<span>Title</span>
10 [% CASE 'author' %]<span>Author</span>
11 [% CASE 'publishercode' %]<span>Publisher</span>
12 [% CASE 'publicationyear' %]<span>Publication date</span>
13 [% CASE 'collectiontitle' %]<span>Collection</span>
14 [% CASE 'isbn' %]<span>ISBN</span>
15 [% CASE 'issn' %]<span>ISSN</span>
16 [% CASE 'homebranch' %]<span>Home library</span>
17 [% CASE 'holdingbranch' %]<span>Current location</span>
18 [% CASE 'All libraries' %]<span>All libraries</span>
19 [% CASE 'location' %]<span>Shelving location</span>
20 [% CASE 'All locations' %]<span>All locations</span>
21 [% CASE 'itype' %]<span>Item type</span>
22 [% CASE 'All item types' %]<span>All item types</span>
23 [% CASE 'ccode' %]<span>Collection code</span>
24 [% CASE 'All collection codes' %]<span>All collection codes</span>
25 [% CASE 'notforloan' %]<span>Status</span>
26 [% CASE 'All statuses' %]<span>All statuses</span>
27 [% CASE 'damaged' %]<span>Damaged</span>
28 [% CASE 'itemlost' %]<span>Lost</span>
32 [% BLOCK form_field_select %]
33 <div class="form-field form-field-select">
34 <label class="form-field-label" for="[% name %]">[% INCLUDE form_label label=name %]</label>
35 <select id="[% name %]_op" name="[% name %]_op">
36 <option value="=">is</option>
37 [% IF CGI.param(name _ '_op') == '!=' %]
38 <option value="!=" selected="selected">is not</option>
40 <option value="!=" >is not</option>
43 [% values = CGI.param(name) %]
44 <select id="[% name %]" name="[% name %]" multiple="multiple" size="[% options.size < 4 ? options.size + 1 : 4 %]">
45 [% IF (values == '') %]
46 <option value="" selected="selected">
50 [% IF (empty_option) %][% INCLUDE form_label label=empty_option %][% ELSE %]<span>All</span>[% END %]
52 [% FOREACH option IN options %]
53 [% IF values != '' && values.grep(option.value).size %]
54 <option value="[% option.value %]" selected="selected">[% option.label %]</option>
56 <option value="[% option.value %]">[% option.label %]</option>
63 [% BLOCK form_field_select_option %]
64 [% IF params.f == value %]
65 <option value="[% value %]" selected="selected">[% INCLUDE form_label label=value %]</option>
67 <option value="[% value %]">[% INCLUDE form_label label=value %]</option>
71 [% BLOCK form_field_select_text %]
72 <div class="form-field form-field-select-text">
73 [% IF params.exists('c') %]
74 <select name="c" class="form-field-conjunction">
75 <option value="and">AND</option>
76 [% IF params.c == 'or' %]
77 <option value="or" selected="selected">OR</option>
79 <option value="or">OR</option>
83 <select name="c" class="form-field-conjunction" disabled="disabled">
84 <option value="and">AND</option>
85 <option value="or">OR</option>
88 <select name="f" class="form-field-column">
89 [% INCLUDE form_field_select_option value='barcode' %]
90 [% INCLUDE form_field_select_option value='itemcallnumber' %]
91 [% INCLUDE form_field_select_option value='stocknumber' %]
92 [% INCLUDE form_field_select_option value='title' %]
93 [% INCLUDE form_field_select_option value='author' %]
94 [% INCLUDE form_field_select_option value='publishercode' %]
95 [% INCLUDE form_field_select_option value='publicationyear' %]
96 [% INCLUDE form_field_select_option value='collectiontitle' %]
97 [% INCLUDE form_field_select_option value='isbn' %]
98 [% INCLUDE form_field_select_option value='issn' %]
99 [% IF items_search_fields.size %]
100 <optgroup label="Custom search fields">
101 [% FOREACH field IN items_search_fields %]
102 [% marcfield = field.tagfield %]
103 [% IF field.tagsubfield %]
104 [% marcfield = marcfield _ '$' _ field.tagsubfield %]
106 [% IF params.f == "marc:$marcfield" %]
107 <option value="marc:[% marcfield %]" data-authorised-values-category="[% field.authorised_values_category %]" selected="selected">[% field.label %] ([% marcfield %])</option>
109 <option value="marc:[% marcfield %]" data-authorised-values-category="[% field.authorised_values_category %]">[% field.label %] ([% marcfield %])</option>
115 <input type="text" name="q" class="form-field-value" value="[% params.q %]" />
116 <input type="hidden" name="op" value="like" />
120 [% BLOCK form_field_select_text_block %]
121 [% c = CGI.param('c').list %]
122 [% f = CGI.param('f').list %]
123 [% q = CGI.param('q').list %]
124 [% op = CGI.param('op').list %]
126 [% size = q.size - 1 %]
127 [% FOREACH i IN [0 .. size] %]
137 [% params.c = c.$j %]
139 [% INCLUDE form_field_select_text params=params %]
142 [% INCLUDE form_field_select_text %]
146 [% BLOCK form_field_radio_yes_no %]
147 <div class="form-field">
148 <label class="form-field-label">[% INCLUDE form_label label=name %]:</label>
149 <input type="radio" name="[% name %]" id="[% name %]_indifferent" value="" checked="checked"/>
150 <label for="[% name %]_indifferent">Ignore</label>
151 <input type="radio" name="[% name %]" id="[% name %]_yes" value="yes" />
152 <label for="[% name %]_yes">Yes</label>
153 <input type="radio" name="[% name %]" id="[% name %]_no" value="no" />
154 <label for="[% name %]_no">No</label>
158 [%# Page starts here %]
160 [% INCLUDE 'doc-head-open.inc' %]
161 <title>Koha › Catalog › Item search</title>
162 [% INCLUDE 'doc-head-close.inc' %]
163 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
164 [% INCLUDE 'datatables.inc' %]
165 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
166 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
167 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/itemsearchform.css" />
168 <script type="text/javascript">
170 var authorised_values = [% authorised_values_json %];
172 function loadAuthorisedValuesSelect(select) {
173 var selected = select.find('option:selected');
174 var category = selected.data('authorised-values-category');
175 var form_field_value = select.siblings('.form-field-value');
176 if (category && category in authorised_values) {
177 var values = authorised_values[category];
178 var html = '<select name="q" class="form-field-value">\n';
180 var value = values[i];
181 html += '<option value="' + value.authorised_value + '">' + value.lib + '</option>\n';
183 html += '</select>\n';
184 var new_form_field_value = $(html);
185 new_form_field_value.val(form_field_value.val());
186 form_field_value.replaceWith(new_form_field_value);
188 if (form_field_value.prop('tagName').toLowerCase() == 'select') {
189 html = '<input name="q" type="text" class="form-field-value" />';
190 var new_form_field_value = $(html);
191 form_field_value.replaceWith(new_form_field_value);
196 function addNewField() {
197 var form_field = $('div.form-field-select-text').last();
198 var copy = form_field.clone(true);
199 copy.find('input,select').not('[type="hidden"]').each(function() {
202 copy.find('.form-field-conjunction').prop('disabled', false);
203 form_field.after(copy);
204 copy.find('select.form-field-column').change();
207 function submitForm($form) {
210 + ' <th>' + _("Title") + '</th>'
211 + ' <th>' + _("Publication date") + '</th>'
212 + ' <th>' + _("Publisher") + '</th>'
213 + ' <th>' + _("Collection") + '</th>'
214 + ' <th>' + _("Barcode") + '</th>'
215 + ' <th>' + _("Call number") + '</th>'
216 + ' <th>' + _("Home library") + '</th>'
217 + ' <th>' + _("Current location") + '</th>'
218 + ' <th>' + _("Shelving location") + '</th>'
219 + ' <th>' + _("Inventory number") + '</th>'
220 + ' <th>' + _("Status") + '</th>'
221 + ' <th>' + _("Checkouts") + '</th>'
225 + '<table id="results">'
226 + ' <thead>' + tr + tr + '</thead>'
229 var results_heading = "<h1>" + _("Item search results") + "</h1>";
230 results_heading += "<p><a href=\"/cgi-bin/koha/catalogue/search.pl\">" + _("Go to advanced search") + "</a></p>";
231 results_heading += "<p><a class=\"editsearchlink\" href=\"#\">" + _("Edit search") + "</a>";
232 results_heading += " | <a class=\"resultstocsv\" href=\"#\">" + _("Output results to csv") + "</a></p>";
233 $('#results-wrapper').empty().html(results_heading + table);
236 $form.find('select').not(':disabled').find('option:selected').each(function () {
237 var name = $(this).parents('select').first().attr('name');
238 var value = $(this).val();
239 params.push({ 'name': name, 'value': value });
241 $form.find('input[type="text"],input[type="hidden"]').not(':disabled').each(function () {
242 params.push({ 'name': $(this).attr('name'), 'value': $(this).val() });
244 $form.find('input[type="radio"]:checked').each(function() {
245 params.push({ 'name': $(this).attr('name'), 'value': $(this).val() });
248 $('#results').dataTable($.extend(true, {}, dataTablesDefaults, {
252 'sAjaxSource': '/cgi-bin/koha/catalogue/itemsearch.pl',
253 'fnServerData': function(sSource, aoData, fnCallback) {
254 aoData.push( { 'name': 'format', 'value': 'json' } );
256 aoData.push(params[i]);
263 'success': function(json){
268 'sDom': '<"top pager"ilp>t<"bottom pager"ip>r',
270 { 'sName': 'title' },
271 { 'sName': 'publicationyear' },
272 { 'sName': 'publishercode' },
273 { 'sName': 'collectiontitle' },
274 { 'sName': 'barcode' },
275 { 'sName': 'itemcallnumber' },
276 { 'sName': 'homebranch' },
277 { 'sName': 'holdingbranch' },
278 { 'sName': 'location' },
279 { 'sName': 'stocknumber' },
280 { 'sName': 'notforloan' },
281 { 'sName': 'issues' },
282 { 'sName': 'checkbox', 'bSortable': false }
284 "sPaginationType": "full_numbers"
286 'sPlaceHolder': 'head:after',
294 { 'type': 'select', 'values': [% branches.json %] },
295 { 'type': 'select', 'values': [% branches.json %] },
296 { 'type': 'select', 'values': [% locations.json %] },
298 { 'type': 'select', 'values': [% notforloans.json %] },
305 function hideForm() {
306 $("#item-search-block").hide();
307 $('.editsearchlink').show();
310 $(document).ready(function () {
311 $('#toolbar').fixFloat();
312 // Add the "New field" link.
313 var form_field = $('div.form-field-select-text').last()
314 var NEW_FIELD = _("New field");
315 var button_field_new = $('<a href="#" class="button-field-new" title="Add a new field">' + NEW_FIELD + '</a>');
316 button_field_new.click(function() {
320 form_field.after(button_field_new);
322 // If a field is linked to an authorised values list, display the list.
323 $('div.form-field-select-text select').change(function() {
324 loadAuthorisedValuesSelect($(this));
327 // Prevent user to select the 'All ...' option with other options.
328 $('div.form-field-select').each(function() {
329 $(this).find('select').filter(':last').change(function() {
330 values = $(this).val();
331 if (values.length > 1) {
332 var idx = $.inArray('', values);
334 values.splice(idx, 1);
341 $('#itemsearchform').submit(function() {
342 var searchform = $(this);
343 var format = searchform.find('input[name="format"]:checked').val();
344 if (format == 'html') {
345 submitForm(searchform);
351 $("body").on("click",".editsearchlink",function(e) {
353 $('#item-search-block').show();
358 $("body").on("click",".resultstocsv",function(e) {
360 $('#format-csv').prop("checked",true);
361 $('#itemsearchform').submit();
363 $('#format-html').prop("checked",true);
370 <body id="catalog_itemsearch" class="catalog">
371 [% INCLUDE 'header.inc' %]
372 [% INCLUDE 'home-search.inc' %]
373 <div id="breadcrumbs">
374 <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › Item search
377 <div id="doc" class="yui-t7">
378 <div id="item-search-block">
380 <p><a href="/cgi-bin/koha/catalogue/search.pl">Go to advanced search</a></p>
381 <form action="/cgi-bin/koha/catalogue/itemsearch.pl" method="get" id="itemsearchform">
382 <div id="toolbar" class="btn-toolbar">
383 <fieldset class="action">
384 <div class="btn-group">
385 <button class="btn btn-small"><i class="fa fa-search"></i> Search</button>
390 [% INCLUDE form_field_select
393 empty_option = "All libraries"
395 [% INCLUDE form_field_select
398 empty_option = "All libraries"
400 [% INCLUDE form_field_select
403 empty_option = "All locations"
407 [% INCLUDE form_field_select
410 empty_option = "All item types"
412 [% INCLUDE form_field_select
415 empty_option = "All collection codes"
417 [% INCLUDE form_field_select
419 options = notforloans
420 empty_option = "All statuses"
424 [% INCLUDE form_field_select_text_block %]
425 <p class="hint">You can use the following wildcard characters: % _</p>
426 <p class="hint">% matches any number of characters</p>
427 <p class="hint">_ matches only a single character</p>
430 <div class="form-field">
431 <label class="form-field-label" for="itemcallnumber_from">From call number:</label>
432 [% value = CGI.param('itemcallnumber_from') %]
433 <input type="text" id="itemcallnumber_from" name="itemcallnumber_from" value="[% value %]" />
434 <span class="hint">(inclusive)</span>
436 <div class="form-field">
437 [% value = CGI.param('itemcallnumber_to') %]
438 <label class="form-field-label" for="itemcallnumber_to">To call number:</label>
439 <input type="text" id="itemcallnumber_to" name="itemcallnumber_to" value="[% value %]" />
440 <span class="hint">(inclusive)</span>
442 [% INCLUDE form_field_radio_yes_no name="damaged" %]
443 [% INCLUDE form_field_radio_yes_no name="itemlost" %]
444 <div class="form-field">
445 <label class="form-field-label" for="issues_op">Checkout count:</label>
446 <select id="issues_op" name="issues_op">
447 <option value=">">></option>
448 <option value="<"><</option>
449 <option value="=">=</option>
450 <option value="!=">!=</option>
452 <input type="text" name="issues" />
454 <div class="form-field">
455 <label class="form-field-label" for="datelastborrowed_op">Last checkout date:</label>
456 <select id="datelastborrowed_op" name="datelastborrowed_op">
457 <option value=">">After</option>
458 <option value="<">Before</option>
459 <option value="=">On</option>
461 <input type="text" name="datelastborrowed" />
462 <span class="hint">ISO Format (YYYY-MM-DD)</span>
466 <div class="form-field-radio">
467 <label>Output:</label>
468 <input type="radio" id="format-html" name="format" value="html" checked="checked" /> <label for="format-html">Screen</label>
469 <input type="radio" id="format-csv" name="format" value="csv" /> <label for="format-csv">CSV</label>
474 <p><a id="editsearchlink" href="#" style="display:none">Edit search</a></p>
477 <div id="doc3" class="yui-t7">
478 <div id="results-wrapper">
480 [% IF total_rows > 0 %]
481 <p>Found [% total_rows %] results.</p>
483 <p>No results found.</p>
487 [% INCLUDE 'catalogue/itemsearch_items.inc' items = results %]
497 [% INCLUDE 'intranet-bottom.inc' %]