Bug 28066: Remove select tag's size attribute where it is 1
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / inventory.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Tools &rsaquo; Inventory</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 </head>
10
11 <body id="tools_inventory" class="tools">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
14
15 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
16     <ol>
17         <li>
18             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
19         </li>
20         <li>
21             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
22         </li>
23
24         [% IF (loop) %]
25             <li>
26                 <a href="/cgi-bin/koha/tools/inventory.pl">Inventory</a>
27             </li>
28             <li>
29                 <a href="#" aria-current="page">
30                     Results
31                 </a>
32             </li>
33         [% ELSE %]
34             <li>
35                 <a href="#" aria-current="page">
36                     Inventory
37                 </a>
38             </li>
39         [% END %]
40     </ol>
41 </nav>
42
43 <div class="main container-fluid">
44     <div class="row">
45         <div class="col-sm-10 col-sm-push-2">
46             <main>
47
48     <h1>Inventory</h1>
49     [% IF (moddatecount) %]<div class="dialog message">[% moddatecount | html %] items modified : datelastseen set to [% date | $KohaDates %]</div>
50     <div class="dialog alert">Number of potential barcodes read: [% LinesRead | html %]</div>[% END %]
51     [% IF (errorfile) %]<div class="dialog alert">[% errorfile | html %] can't be opened</div>[% END %]
52     [% IF (err_length && err_length==1) %]<div class="dialog alert">There was 1 barcode that was too long.</div>[% END %]
53     [% IF (err_length && err_length>1) %]<div class="dialog alert">There were [% err_length | html %] barcodes that were too long.</div>[% END %]
54     [% IF (err_data && err_data==1) %]<div class="dialog alert">There was 1 barcode that contained at least one unprintable character.</div>[% END %]
55     [% IF (err_data && err_data>1) %]<div class="dialog alert">There were [% err_data | html %] barcodes that contained at least one unprintable character.</div>[% END %]
56     [% FOREACH error IN errorloop %]
57         <div class="dialog alert">
58             [% error.barcode | html %]
59             [% IF (error.ERR_BARCODE) %]: barcode not found[% END %]
60             [% IF (error.ERR_WTHDRAWN) %]: item withdrawn[% END %]
61             [% IF (error.ERR_ONLOAN_RET) %]: item was on loan. It was returned before marked as seen[% END %]
62             [% IF (error.ERR_ONLOAN_NOT_RET) %]: item was on loan. couldn't be returned.[% END %]
63         </div>
64     [% END %]
65        [% UNLESS op %]
66
67     <form method="post" id="inventory_form" action="/cgi-bin/koha/tools/inventory.pl" enctype="multipart/form-data">
68         <fieldset class="rows">
69           <legend>Use a barcode file</legend>
70           <ol>
71             <li><label for="uploadbarcodes">Barcode file: </label> <input type="file" id="uploadbarcodes" name="uploadbarcodes" />
72             <input type="button" id="resetuploadbarcodes" name="resetuploadbarcodes" value="Reset" /></li>
73           </ol>
74         </fieldset>
75         <fieldset class="rows">
76             <legend>Or scan items one by one</legend>
77             <ol>
78                 <li>
79                   <label for="barcodelist">Barcode list (one barcode per line): </label>
80                   <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
81                 </li>
82             </ol>
83         </fieldset>
84         <fieldset class="rows">
85             <legend>Parameters</legend>
86             <ol>
87                 <li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="datepicker" disabled /></li>
88                 <li><label for="compareinv2barcd">Compare barcodes list to results: </label><input type="checkbox" name="compareinv2barcd" id="compareinv2barcd" disabled /></li>
89                 <li><label for="dont_checkin">Do not check in items scanned during inventory: </label><input type="checkbox" name="dont_checkin" id="dont_checkin" disabled /></li>
90                 <li><label for="out_of_order">Check barcodes list for items shelved out of order: </label><input type="checkbox" name="out_of_order" id="out_of_order" disabled /></li>
91             </ol>
92         </fieldset>
93         <fieldset class="rows">
94         <legend>Item location filters</legend>
95         <ol><li>
96         <label for="branch">Location: </label>
97             <input type="radio" name="branch" value="homebranch"> Home library</input>
98             <input type="radio" name="branch" value="holdingbranch"> Current library</input>
99         </li><li>
100         <label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;">
101             <option value="">All libraries</option>
102             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
103         </select>
104         </li>
105         [% IF (authorised_values) %]
106         <li>
107             <label for="locationloop">Shelving location (items.location) is: </label>
108         <select id="locationloop" name="location">
109                 <option value="">Filter location</option>
110         [% FOREACH value IN authorised_values %]
111             [% IF (value.selected) %]
112                 <option value="[% value.authorised_value | html %]" selected="selected">[% value.lib | html %]</option>
113             [% ELSE %]
114                 <option value="[% value.authorised_value | html %]">[% value.lib | html %]</option>
115             [% END %]
116         [% END %]
117         </select>        </li>
118         [% END %]
119         <li>
120             <label for="minlocation">Item call number between: </label>
121                 <input type="text" name="minlocation" id="minlocation" value="[% minlocation | html %]" /> (items.itemcallnumber)  </li>
122            <li><label for="maxlocation">...and: </label>
123                 <input type="text" name="maxlocation" id="maxlocation" value="[% maxlocation | html %]" />
124            <li>
125             <label for="class_source">Call number classification scheme</label>
126             <select name="class_source">
127             [% FOREACH class_source IN class_sources %]
128                 [% IF class_source.cn_source == pref_class %]
129                 <option value="[% class_source.cn_source | html %]" selected="selected">[% class_source.description | html %] (default)</option>
130                 [% ELSE %]
131                 <option value="[% class_source.cn_source | html %]">[% class_source.description | html %]</option>
132                 [% END %]
133             [% END %]
134             </select>
135           </li>
136     </ol>
137     </fieldset>
138
139     <fieldset class="rows" id="optionalfilters">
140             <legend>Optional filters for inventory list or comparing barcodes</legend>
141             <br/>
142             <div id="statuses" style="display: block;">
143                   [% FOREACH status IN statuses %]
144                       [% IF (status.values) %]
145                           <fieldset style="float: left; padding: 5px; margin: 5px;text-align:right">
146                               <legend>[% status.fieldname | html %]</legend>
147                               <ul id="statuses-[% fieldname | html %]" style="display: inline;">
148                               [% FOREACH value IN status.values %]
149                                   [% IF (value.lib) %]
150                                     <li>
151                                     <label for="[% value.id | html %]">
152                                         [% IF ( status.fieldname == 'items.notforloan' && value.authorised_value == 0 && value.lib == '__IGNORE__' ) %]
153                                             For loan
154                                         [% ELSE %]
155                                             [% value.lib | html %]
156                                         [% END %]
157                                     </label>
158                                     <input type="checkbox" name="status-[% status.fieldname | html %]-[% value.authorised_value | html %]" id="[% value.authorised_value | html %]" />
159                                     </li>
160                                   [% END %]
161                               [% END %]
162                               </ul>
163                           </fieldset>
164                       [% END %]
165                   [% END %]
166                 </div>
167         <ol>
168         <li>
169             <br/>
170             <label for="datelastseen">Last inventory date:</label>
171             <input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen | $KohaDates %]" class="datepicker" />
172             (Skip records marked as seen on or after this date.)
173         </li>
174         <li>
175             <label for="ignoreissued">Skip items on loan: </label>
176             [% IF (ignoreissued) %]
177                 <input type="checkbox" id="ignoreissued" name="ignoreissued" checked="checked" />
178             [% ELSE %]
179                 <input type="checkbox" id="ignoreissued" name="ignoreissued" />
180             [% END %]
181         </li>
182         <li>
183             <label for="ignore_waiting_holds">Skip items on hold awaiting pickup: </label>
184             <input type="checkbox" id="ignore_waiting_holds" name="ignore_waiting_holds" />
185         </li>
186         <li>
187             <label>Item types: </label>
188             <div class="branchselector">
189                 <p><a href="#" id="checkallitemtypes"> <i class="fa fa-check"></i> Select all</a> | <a href="#" id="checknoneitemtypes"> <i class="fa fa-remove"></i> Clear all</a></p>
190                 <div class="branchgridrow">
191                     [% FOREACH itemtype IN itemtypes %]
192                         <div class="branchgriditem">
193                             <input id="itemtype-[% itemtype.itemtype | html %]" class="branch_select" type="checkbox" name="itemtype-[% itemtype.itemtype | html %]" value="[% itemtype.itemtype | html %]" />
194                             <label for="itemtype-[% itemtype.itemtype | html %]">[% itemtype.description | html %]</label>
195                         </div>
196                         [% IF loop.count() % 4 == 0 && !loop.last() %]
197                             </div>
198                             <div class="branchgridrow">
199                         [% END %]
200                     [% END %]
201                 </div>
202             </div>
203         </li>
204
205         </ol>
206
207     </fieldset>
208
209         <fieldset class="rows">
210           <legend>Additional options</legend>
211           <ol>
212
213         <li>
214            <label for="CSVexport">Export to CSV file: </label>
215            <input type="checkbox" name="CSVexport" id="CSVexport" />
216         </li>
217         </ol>
218   </fieldset>
219             <input type="hidden" name="op" value="do_it" />
220
221             <fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
222     </form>
223
224     [% END %]
225     [% IF (op) %]
226     <form method="post" action="/cgi-bin/koha/tools/inventory.pl">
227     <input type="hidden" name="minlocation" value="[% minlocation | html %]" />
228     <input type="hidden" name="maxlocation" value="[% maxlocation | html %]" />
229     <input type="hidden" name="location" value="[% location | html %]" />
230     <input type="hidden" name="branchcode" value="[% branchcode | html %]" />
231     <input type="hidden" name="datelastseen" value="[% datelastseen | html %]" />
232
233     [% UNLESS uploadedbarcodesflag %]
234       <div><a href="#" class="checkall"><i class="fa fa-check"></i> Select all</a> <a href="#" class="clearall"><i class="fa fa-remove"></i> Clear all</a></div>
235     [% END %]
236
237     <table id="inventoryt">
238     <thead>
239         <tr>
240             [% UNLESS uploadedbarcodesflag %]<th>Seen</th>[% END %]
241             <th>Barcode</th>
242             <th>Call number</th>
243             <th>Library</th>
244             <th class="anti-the">Title</th>
245             <th>Not for loan</th>
246             <th>Lost</th>
247             <th>Damaged</th>
248             <th>Withdrawn</th>
249             <th>Last seen</th>
250             <th>Problems</th>
251         </tr>
252     </thead>
253     <tbody>
254     [% FOREACH result IN loop %]
255         <tr>
256             [% UNLESS uploadedbarcodesflag %]
257               <td>
258                 <input type="checkbox" name="SEEN-[% result.itemnumber | html %]" value="1" />
259               </td>
260             [% END %]
261             <td>
262             [% result.barcode | html %]
263             </td>
264             <td data-order="[% result.cn_sort | html %]">
265                 [% result.itemcallnumber | html %]
266             </td>
267             <td>
268                 [% Branches.GetName( result.homebranch ) | html %]
269                 <span class="shelvingloc">[% result.location | html %]</span>
270             </td>
271             <td>
272                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% result.biblionumber | uri %]" class="openWin">[% result.title | html %]</a>
273                 [% IF ( result.author ) %]
274                     by <span class="author">[% result.author | html %]</span>
275                 [% END %]
276             </td>
277             <td>
278             [% result.notforloan | html %]
279             </td>
280             <td>
281             [% result.itemlost | html %]
282             </td>
283             <td>
284             [% result.damaged | html %]
285             </td>
286             <td>
287             [% result.withdrawn | html %]
288             </td>
289             <td data-order="[% result.datelastseen | html %]">
290                 [% result.datelastseen | $KohaDates%]
291             </td>
292             <td>
293             [% FOREACH problem IN result.problems %]
294                 [% IF problem.key == 'wrongplace' %]
295                     Found in wrong place<br/>
296                 [% ELSIF problem.key == 'changestatus' %]
297                     Unknown not-for-loan status<br/>
298                 [% ELSIF problem.key == 'not_scanned' %]
299                     Missing (not scanned)<br/>
300                 [% ELSIF problem.key == 'checkedout' %]
301                     Still checked out<br/>
302                 [% ELSIF problem.key == 'no_barcode' %]
303                     No barcode<br/>
304                 [% ELSIF problem.key == 'out_of_order' %]
305                     Item may be shelved out of order<br/>
306                 [% END %]
307             [% END %]
308             </td>
309         </tr>
310     [% END %]
311     </tbody>
312     </table>
313     <div class="spacer"></div>
314     [% UNLESS uploadedbarcodesflag %]
315       <div style="padding : .3em 0"><a href="#" class="checkall"><i class="fa fa-check"></i> Select all</a> <a href="#" class="clearall"><i class="fa fa-remove"></i> Clear all</a></div>
316       <input type="submit" id="markseenandquit" value="Mark seen and quit" />
317       <input type="submit" value="Mark seen and continue &gt;&gt;" id="markseenandcontinuebutton" />
318       <input type="submit" value="Continue without marking &gt;&gt;" id="continuewithoutmarkingbutton" class="submit" />
319     [% END %]
320     </form>
321
322
323     [% END %]
324
325             </main>
326         </div> <!-- /.col-sm-10.col-sm-push-2 -->
327
328         <div class="col-sm-2 col-sm-pull-10">
329             <aside>
330                 [% INCLUDE 'tools-menu.inc' %]
331             </aside>
332         </div> <!-- .col-sm-2.col-sm-pull-10 -->
333      </div> <!-- /.row -->
334
335 [% MACRO jsinclude BLOCK %]
336     [% Asset.js("js/tools-menu.js") | $raw %]
337     [% INCLUDE 'datatables.inc' %]
338     [% INCLUDE 'calendar.inc' %]
339     <script>
340         function checkForm() {
341             if ( $('#uploadbarcodes').val() && $('#barcodelist').val() ) {
342                 alert(_("You have uploaded a barcode file and scanned barcodes at the same time. Please choose one of the two options."));
343                 return false;
344             }
345             if ( $('#uploadbarcodes').val() || $('#barcodelist').val() ) {
346                 if ( !(
347                     $('#branchloop').val()   ||
348                     $('#locationloop').val() ||
349                     $('#minlocation').val()  ||
350                     $('#maxlocation').val()  ||
351                     $('#statuses input:checked').length
352                 ) ) {
353                     return confirm(
354                         _("You have not selected any catalog filters and are about to compare a file of barcodes to your entire catalog.") + "\n\n" +
355                         _("For large catalogs this can result in unexpected behavior") + "\n\n" +
356                         _("Are you sure you want to do this?")
357                     );
358                 }
359             }
360
361             return true;
362         }
363
364         function barcodesProvided() {
365             if( $("#uploadbarcodes").val() || $("#barcodelist").val() ) {
366                 $("#setdate").prop('disabled',false);
367                 $("#compareinv2barcd").prop('disabled',false);
368                 $("#compareinv2barcd").attr('checked',true); // default
369                 $("#dont_checkin").prop('disabled',false);
370                 $("#out_of_order").prop('disabled',false);
371                 if( $("#compareinv2barcd").attr('checked') ) {
372                     $("fieldset#optionalfilters").show();
373                     $("#ignoreissued").attr('checked',true); // default
374                 } else {
375                     $("fieldset#optionalfilters").hide();
376                     $("#ignoreissued").attr('checked',false);
377                 }
378             } else {
379                 $("#setdate").prop('disabled',true);
380                 $("#compareinv2barcd").prop('disabled',true);
381                 $("#compareinv2barcd").attr('checked',false);
382                 $("#dont_checkin").prop('disabled',true);
383                 $("#dont_checkin").attr('checked',false);
384                 $("#out_of_order").prop('disabled',true);
385                 $("#out_of_order").attr('checked',false);
386                 $("fieldset#optionalfilters").show();
387             }
388         }
389
390         $(document).ready(function(){
391             inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, {
392                 'sPaginationType': 'full_numbers',
393                 [% IF compareinv2barcd %]
394                     // sort on callnumber
395                     "aaSorting": [[ 1, "asc" ]],
396                 [% ELSE %]
397                     // first column contains checkboxes
398                     "aoColumnDefs": [
399                         { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
400                         { "bSortable": false, "bSearchable": false, "aTargets": [ 0 ] }
401                     ],
402                     // 3rd column is callnumber
403                     "aaSorting": [[ 2, "asc" ]],
404                 [% END %]
405                 'fnDrawCallback': function() {
406                     //bind the click handler script to the newly created elements held in the table
407                     $('.openWin').bind('click',function(e){
408                         e.preventDefault();
409                         openWindow(this.href,'marcview',800,600);
410                     });
411                 }
412             } ));
413
414
415             $("#continuewithoutmarkingbutton").click(function(){
416                 inventorydt.fnPageChange( 'next' );
417                 return false;
418             });
419
420             $("#markseenandcontinuebutton").click(function(){
421                 var param = '';
422                 $("input:checked").each(function() {
423                     param += "|" + $(this).attr('name');
424                 });
425                 $.post('/cgi-bin/koha/tools/ajax-inventory.pl', { seen: param });
426                 inventorydt.fnPageChange( 'next' );
427                 return false;
428             });
429
430             $("#markseenandquit").click(function(){
431                 var param = '';
432                 $("input:checked").each(function() {
433                     param += "|" + $(this).attr('name');
434                 });
435                 $.ajax({
436                   type: 'POST',
437                   url: '/cgi-bin/koha/tools/ajax-inventory.pl',
438                   data: { seen: param},
439                   async: false
440                 });
441                 document.location.href = '/cgi-bin/koha/tools/inventory.pl';
442                 return false;
443             });
444
445             $(".checkall").click(function(e){
446                 e.preventDefault();
447                 $("#inventoryt input:checkbox").each(function(){
448                     $(this).prop("checked", true);
449                 });
450             });
451             $(".clearall").click(function(e){
452                 e.preventDefault();
453                 $("#inventoryt input:checkbox").each(function(){
454                     $(this).prop("checked", false);
455                 });
456             });
457             $("#inventory_form").on("submit",function(){
458                 return checkForm();
459             });
460
461             $("#resetuploadbarcodes").click(function() {
462                 $("#uploadbarcodes").val("");
463                 barcodesProvided();
464             });
465
466             // #uploadbarcodes and #compareinv2barcd determine the behavior of
467             // the controls within the barcode fieldset and the optional filters
468             $("#uploadbarcodes").change(barcodesProvided);
469             $("#barcodelist").on("change keyup paste", barcodesProvided);
470
471             $("#compareinv2barcd").click(function() {
472                 if( $("#compareinv2barcd").attr('checked') ) {
473                     $("fieldset#optionalfilters").show();
474                     $("#ignoreissued").attr('checked',true); // default
475                 } else {
476                     $("#ignoreissued").attr('checked',false);
477                     $("fieldset#optionalfilters").hide();
478                 }
479             });
480
481             $("#checkallitemtypes").on("click",function(e){
482                 e.preventDefault();
483                 $(".branch_select").prop("checked",1);
484             });
485             $("#checknoneitemtypes").on("click",function(e){
486                 e.preventDefault();
487                 $(".branch_select").prop("checked",0);
488             });
489         });
490     </script>
491 [% END %]
492
493 [% INCLUDE 'intranet-bottom.inc' %]