Bug 2696: Fine payments should show what was paid for
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / inventory.tt
1 [% USE Asset %]
2 [% USE KohaDates %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; Inventory</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% Asset.css("css/datatables.css") %]
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 id="doc3" class="yui-t2">
18
19    <div id="bd">
20     <div id="yui-main">
21     <div class="yui-b">
22     <h1>Inventory</h1>
23     [% IF (moddatecount) %]<div class="dialog message">[% moddatecount %] items modified : datelastseen set to [% date | $KohaDates %]</div>
24     <div class="dialog alert">Number of potential barcodes read: [% LinesRead %]</div>[% END %]
25     [% IF (errorfile) %]<div class="dialog alert">[% errorfile %] 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 %] 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 %] barcodes that contained at least one unprintable character.</div>[% END %]
30     [% FOREACH error IN errorloop %]
31         <div class="dialog alert">
32             [% error.barcode %]
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     <div class="yui-g">
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" /></li>
46             <li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="datepicker" disabled /></li>
47             <li><label for="compareinv2barcd">Compare barcodes list to results: </label><input type="checkbox" name="compareinv2barcd" id="compareinv2barcd" disabled /></li>
48             <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>
49           </ol>
50         </fieldset>
51
52         <fieldset class="rows">
53         <legend>Item location filters</legend>
54         <ol><li>
55         <label for="branch">Library: </label>
56             <input type="radio" name="branch" value="homebranch"> Home library</input>
57             <input type="radio" name="branch" value="holdingbranch"> Current library</input>
58         </li><li>
59         <label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;">
60             <option value="">All libraries</option>
61             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
62         </select>
63         </li>
64         [% IF (authorised_values) %]
65         <li>
66             <label for="locationloop">Shelving location (items.location) is: </label>
67         <select id="locationloop" name="location">
68                 <option value="">Filter location</option>
69         [% FOREACH value IN authorised_values %]
70             [% IF (value.selected) %]
71                 <option value="[% value.authorised_value %]" selected="selected">[% value.lib %]</option>
72             [% ELSE %]
73                 <option value="[% value.authorised_value %]">[% value.lib %]</option>
74             [% END %]
75         [% END %]
76         </select>        </li>
77         [% END %]
78         <li>
79             <label for="minlocation">Item callnumber between: </label>
80                 <input type="text" name="minlocation" id="minlocation" value="[% minlocation %]" /> (items.itemcallnumber)  </li>
81            <li><label for="maxlocation">...and: </label>
82                 <input type="text" name="maxlocation" id="maxlocation" value="[% maxlocation %]" />
83         </li>
84     </ol>
85     </fieldset>
86
87     <fieldset class="rows" id="optionalfilters">
88             <legend>Optional filters for inventory list or comparing barcodes</legend>
89             <br/>
90             <div id="statuses" style="display: block;">
91                   [% FOREACH status IN statuses %]
92                       [% IF (status.values) %]
93                           <fieldset style="float: left; padding: 5px; margin: 5px;text-align:right">
94                               <legend>[% status.fieldname %]</legend>
95                               <ul id="statuses-[% fieldname %]" style="display: inline;">
96                               [% FOREACH value IN status.values %]
97                                   [% IF (value.lib) %]
98                                     <li>
99                                     <label for="[% value.id %]">
100                                         [% IF value.authorised_value==0 %]
101                                             For loan
102                                         [% ELSE %]
103                                             [% value.lib %]
104                                         [% END %]
105                                     </label>
106                                     <input type="checkbox" name="status-[% status.fieldname %]-[% value.authorised_value %]" id="[% value.authorised_value %]" />
107                                     </li>
108                                   [% END %]
109                               [% END %]
110                               </ul>
111                           </fieldset>
112                       [% END %]
113                   [% END %]
114                 </div>
115         <ol>
116         <li>
117             <br/>
118             <label for="datelastseen">Last inventory date:</label>
119             <input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen | $KohaDates %]" class="datepicker" />
120             (Skip records marked as seen on or after this date.)
121         </li>
122         <li>
123             <label for="ignoreissued">Skip items on loan: </label>
124             [% IF (ignoreissued) %]
125                 <input type="checkbox" id="ignoreissued" name="ignoreissued" checked="checked" />
126             [% ELSE %]
127                 <input type="checkbox" id="ignoreissued" name="ignoreissued" />
128             [% END %]
129         </li>
130         </ol>
131     </fieldset>
132
133         <fieldset class="rows">
134           <legend>Additional options</legend>
135           <ol>
136
137         <li>
138            <label for="CSVexport">Export to CSV file: </label>
139            <input type="checkbox" name="CSVexport" id="CSVexport" />
140         </li>
141         </ol>
142   </fieldset>
143             <input type="hidden" name="op" value="do_it" />
144
145             <fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
146     </form>
147     </div>
148     </div>
149     [% END %]
150     [% IF (op) %]
151     <form method="post" action="/cgi-bin/koha/tools/inventory.pl" class="checkboxed">
152     <input type="hidden" name="minlocation" value="[% minlocation %]" />
153     <input type="hidden" name="maxlocation" value="[% maxlocation %]" />
154     <input type="hidden" name="location" value="[% location %]" />
155     <input type="hidden" name="branchcode" value="[% branchcode %]" />
156     <input type="hidden" name="datelastseen" value="[% datelastseen %]" />
157
158     [% UNLESS uploadedbarcodesflag %]
159       <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>
160     [% END %]
161
162     <table id="inventoryt">
163     <thead>
164         <tr>
165             [% UNLESS uploadedbarcodesflag %]<th>Seen</th>[% END %]
166             <th>Barcode</th>
167             <th>Call number</th>
168             <th>Library</th>
169             <th>Title</th>
170             <th>Not for loan</th>
171             <th>Lost</th>
172             <th>Damaged</th>
173             <th>Withdrawn</th>
174             <th>Last seen</th>
175             <th>Problems</th>
176         </tr>
177     </thead>
178     <tbody>
179     [% FOREACH result IN loop %]
180         <tr>
181             [% UNLESS uploadedbarcodesflag %]
182               <td>
183                 <input type="checkbox" name="SEEN-[% result.itemnumber %]" value="1" />
184               </td>
185             [% END %]
186             <td>
187             [% result.barcode | html %]
188             </td>
189             <td>[% result.itemcallnumber | html %]</td>
190             <td>
191                 [% Branches.GetName( result.homebranch ) %]
192                 <span class="shelvingloc">[% result.location | html %]</span>
193             </td>
194             <td>
195                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% result.biblionumber %]" class="openWin">[% result.title | html %]</a>
196                 [% IF ( result.author ) %]
197                     by <span class="author">[% result.author | html %]</span>
198                 [% END %]
199             </td>
200             <td>
201             [% result.notforloan | html %]
202             </td>
203             <td>
204             [% result.itemlost | html %]
205             </td>
206             <td>
207             [% result.damaged | html %]
208             </td>
209             <td>
210             [% result.withdrawn | html %]
211             </td>
212             <td>
213             [% result.datelastseen | $KohaDates | html %]
214             </td>
215             <td>
216             [% FOREACH problem IN result.problems %]
217                 [% IF problem.key == 'wrongplace' %]
218                     Found in wrong place<br/>
219                 [% ELSIF problem.key == 'changestatus' %]
220                     Unknown not-for-loan status<br/>
221                 [% ELSIF problem.key == 'not_scanned' %]
222                     Missing (not scanned)<br/>
223                 [% ELSIF problem.key == 'checkedout' %]
224                     Still checked out<br/>
225                 [% ELSIF problem.key == 'no_barcode' %]
226                     No barcode<br/>
227                 [% END %]
228             [% END %]
229             </td>
230         </tr>
231     [% END %]
232     </tbody>
233     </table>
234     <div class="spacer"></div>
235     [% UNLESS uploadedbarcodesflag %]
236       <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>
237       <input type="submit" id="markseenandquit" value="Mark seen and quit" />
238       <input type="submit" value="Mark seen and continue &gt;&gt;" id="markseenandcontinuebutton" />
239       <input type="submit" value="Continue without marking &gt;&gt;" id="continuewithoutmarkingbutton" class="submit" />
240     [% END %]
241     </form>
242
243     </div>
244
245     [% END %]
246 </div>
247 <div class="yui-b">
248 [% INCLUDE 'tools-menu.inc' %]
249 </div>
250 </div>
251
252 [% MACRO jsinclude BLOCK %]
253     [% Asset.js("js/tools-menu.js") %]
254     [% INCLUDE 'datatables.inc' %]
255     [% INCLUDE 'calendar.inc' %]
256     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
257     <script type="text/javascript">
258         function checkForm() {
259             if ( $('#uploadbarcodes').val() ) {
260                 if ( !(
261                     $('#branchloop').val()   ||
262                     $('#locationloop').val() ||
263                     $('#minlocation').val()  ||
264                     $('#maxlocation').val()  ||
265                     $('#statuses input:checked').length
266                 ) ) {
267                     return confirm(
268                         _("You have not selected any catalog filters and are about to compare a file of barcodes to your entire catalog.") + "\n\n" +
269                         _("For large catalogs this can result in unexpected behavior") + "\n\n" +
270                         _("Are you sure you want to do this?")
271                     );
272                 }
273             }
274
275             return true;
276         }
277
278         $(document).ready(function(){
279             inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, {
280                 'sPaginationType': 'full_numbers',
281                 [% IF compareinv2barcd %]
282                     // sort on callnumber
283                     "aaSorting": [[ 1, "asc" ]],
284                 [% ELSE %]
285                     // first column contains checkboxes
286                     "aoColumnDefs": [
287                         { "bSortable": false, "bSearchable": false, "aTargets": [ 0 ] },
288                     ],
289                     // 3rd column is callnumber
290                     "aaSorting": [[ 2, "asc" ]],
291                 [% END %]
292                 'fnDrawCallback': function() {
293                     //bind the click handler script to the newly created elements held in the table
294                     $('.openWin').bind('click',function(e){
295                         e.preventDefault();
296                         openWindow(this.href,'marcview',800,600);
297                     });
298                 }
299             } ));
300
301
302             $("#continuewithoutmarkingbutton").click(function(){
303                 inventorydt.fnPageChange( 'next' );
304                 return false;
305             });
306
307             $("#markseenandcontinuebutton").click(function(){
308                 var param = '';
309                 $("input:checked").each(function() {
310                     param += "|" + $(this).attr('name');
311                 });
312                 $.post('/cgi-bin/koha/tools/ajax-inventory.pl', { seen: param });
313                 inventorydt.fnPageChange( 'next' );
314                 return false;
315             });
316
317             $("#markseenandquit").click(function(){
318                 var param = '';
319                 $("input:checked").each(function() {
320                     param += "|" + $(this).attr('name');
321                 });
322                 $.ajax({
323                   type: 'POST',
324                   url: '/cgi-bin/koha/tools/ajax-inventory.pl',
325                   data: { seen: param},
326                   async: false
327                 });
328                 document.location.href = '/cgi-bin/koha/tools/inventory.pl';
329                 return false;
330             });
331
332
333             $(".checkall").click(function(){
334                     $(".checkboxed").checkCheckboxes();
335                     return false;
336                 });
337             $(".clearall").click(function(){
338                     $(".checkboxed").unCheckCheckboxes();
339                     return false;
340                 });
341             $("#inventory_form").on("submit",function(){
342                 return checkForm();
343             });
344
345             // #uploadbarcodes and #compareinv2barcd determine the behavior of
346             // the controls within the barcode fieldset and the optional filters
347             $("#uploadbarcodes").change(function() {
348                 if( $("#uploadbarcodes").val() ) {
349                     $("#setdate").prop('disabled',false);
350                     $("#compareinv2barcd").prop('disabled',false);
351                     $("#compareinv2barcd").attr('checked',true); // default
352                     $("#dont_checkin").prop('disabled',false);
353                     if( $("#compareinv2barcd").attr('checked') ) {
354                         $("fieldset#optionalfilters").show();
355                         $("#ignoreissued").attr('checked',true); // default
356                     } else {
357                         $("fieldset#optionalfilters").hide();
358                         $("#ignoreissued").attr('checked',false);
359                     }
360                 } else {
361                     $("#setdate").prop('disabled',true);
362                     $("#compareinv2barcd").prop('disabled',true);
363                     $("#compareinv2barcd").attr('checked',false);
364                     $("#dont_checkin").prop('disabled',true);
365                     $("#dont_checkin").attr('checked',false);
366                     $("fieldset#optionalfilters").show();
367                 }
368             });
369             $("#compareinv2barcd").click(function() {
370                 if( $("#compareinv2barcd").attr('checked') ) {
371                     $("fieldset#optionalfilters").show();
372                     $("#ignoreissued").attr('checked',true); // default
373                 } else {
374                     $("#ignoreissued").attr('checked',false);
375                     $("fieldset#optionalfilters").hide();
376                 }
377             });
378         });
379     </script>
380 [% END %]
381
382 [% INCLUDE 'intranet-bottom.inc' %]