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