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