Bug 14399: Numerous small refinements to the inventory script
[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 //]]>
94 </script>
95 </head>
96 <body id="tools_inventory" class="tools">
97 [% INCLUDE 'header.inc' %]
98 [% INCLUDE 'cat-search.inc' %]
99
100 <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>
101
102 <div id="doc3" class="yui-t2">
103
104    <div id="bd">
105     <div id="yui-main">
106     <div class="yui-b">
107     <h1>Inventory</h1>
108     [% IF (moddatecount) %]<div class="dialog message">[% moddatecount %] items modified : datelastseen set to [% date | $KohaDates %]</div>
109     <div class="dialog alert">Number of potential barcodes read: [% LinesRead %]</div>[% END %]
110     [% IF (errorfile) %]<div class="dialog alert">[% errorfile %] can't be opened</div>[% END %]
111     [% IF (err_length && err_length==1) %]<div class="dialog alert">There was 1 barcode that was too long.</div>[% END %]
112     [% IF (err_length && err_length>1) %]<div class="dialog alert">There were [% err_length %] barcodes that were too long.</div>[% END %]
113     [% IF (err_data && err_data==1) %]<div class="dialog alert">There was 1 barcode that contained at least one unprintable character.</div>[% END %]
114     [% IF (err_data && err_data>1) %]<div class="dialog alert">There were [% err_data %] barcodes that contained at least one unprintable character.</div>[% END %]
115     [% FOREACH error IN errorloop %]
116         <div class="dialog alert">
117             [% error.barcode %]
118             [% IF (error.ERR_BARCODE) %]: barcode not found[% END %]
119             [% IF (error.ERR_WTHDRAWN) %]: item withdrawn[% END %]
120             [% IF (error.ERR_ONLOAN_RET) %]: item was on loan. It was returned before marked as seen[% END %]
121             [% IF (error.ERR_ONLOAN_NOT_RET) %]: item was on loan. couldn't be returned.[% END %]
122         </div>
123     [% END %]
124        [% UNLESS op %]
125     <div class="yui-g">
126     <form method="post" id="inventory_form" action="/cgi-bin/koha/tools/inventory.pl" enctype="multipart/form-data">
127         <fieldset class="rows">
128             <legend>Use a barcode file</legend>
129      <ol>
130             <li><label for="uploadbarcodes">Barcode file: </label> <input type="file" id="uploadbarcodes" name="uploadbarcodes" /></li>
131             <li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="datepicker" />
132             </li>
133           </ol>
134         </fieldset>
135
136         <fieldset class="rows">
137         <legend>Select items you want to check</legend>
138         <ol><li>
139         <label for="branch">Library: </label>
140             <input type="radio" name="branch" value="homebranch"> Home library</input>
141             <input type="radio" name="branch" value="holdingbranch"> Current library</input>
142         </li><li>
143         <label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;">
144             <option value="">All libraries</option>
145             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
146         </select>
147         </li>
148         [% IF (authorised_values) %]
149         <li>
150             <label for="locationloop">Shelving location (items.location) is: </label>
151         <select id="locationloop" name="location">
152                 <option value="">Filter location</option>
153         [% FOREACH value IN authorised_values %]
154             [% IF (value.selected) %]
155                 <option value="[% value.authorised_value %]" selected="selected">[% value.lib %]</option>
156             [% ELSE %]
157                 <option value="[% value.authorised_value %]">[% value.lib %]</option>
158             [% END %]
159         [% END %]
160         </select>        </li>
161         [% END %]
162         <li>
163             <label for="minlocation">Item callnumber between: </label>
164                 <input type="text" name="minlocation" id="minlocation" value="[% minlocation %]" /> (items.itemcallnumber)  </li>
165            <li><label for="maxlocation">...and: </label>
166                 <input type="text" name="maxlocation" id="maxlocation" value="[% maxlocation %]" />
167         </li>
168         [% IF (statuses) %]
169     </ol>
170     </fieldset>
171             <fieldset class="rows">
172             <legend>Item statuses</legend>
173             <div id="statuses" style="display: block;">
174                   [% FOREACH status IN statuses %]
175                       [% IF (status.values) %]
176                           <fieldset style="float: left; padding: 5px; margin: 5px;text-align:right">
177                               <legend>[% status.fieldname %]</legend>
178                               <ul id="statuses-[% fieldname %]" style="display: inline;">
179                               [% FOREACH value IN status.values %]
180                                   [% IF (value.lib) %]
181                                     <li>
182                                     <label for="[% value.id %]">
183                                         [% IF value.authorised_value==0 %]
184                                             For loan
185                                         [% ELSE %]
186                                             [% value.lib %]
187                                         [% END %]
188                                     </label>
189                                     <input type="checkbox" name="status-[% status.fieldname %]-[% value.authorised_value %]" id="[% value.authorised_value %]" />
190                                     </li>
191                                   [% END %]
192                               [% END %]
193                               </ul>
194                           </fieldset>
195                       [% END %]
196                   [% END %]
197                 </div>
198             </fieldset>
199         <fieldset class="rows">
200           <ol>
201         [% END %]
202
203         <li><label for="datelastseen">Last inventory date:</label>
204             <input type="text" id="datelastseen" name="datelastseen" value="[% datelastseen | $KohaDates %]" class="datepicker" />
205             (Skip records marked as seen on or after this date.)
206         </li>
207         <li><label for="ignoreissued">Skip items on loan: </label>
208             [% IF (ignoreissued) %]
209             <input type="checkbox" id="ignoreissued" name="ignoreissued" checked="checked" /></li>
210             [% ELSE %]
211             <input type="checkbox" id="ignoreissued" name="ignoreissued" /></li>
212             [% END %]
213         <li>
214            <label for="CSVexport">Export to CSV file: </label>
215            <input type="checkbox" name="CSVexport" id="CSVexport" />
216         </li>
217         <li>
218             <label for="compareinv2barcd">Compare barcodes list to results: </label>
219             <input type="checkbox" name="compareinv2barcd" id="compareinv2barcd" />
220         </li>
221         <li>
222             <label for="dont_checkin">Do not check in items scanned during inventory: </label>
223             <input type="checkbox" name="dont_checkin" id="dont_checkin" />
224         </li>
225         </ol>
226   </fieldset>
227             <input type="hidden" name="op" value="do_it" />
228
229             <fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
230     </form>
231     </div>
232     </div>
233     [% END %]
234     [% IF (op) %]
235     <form method="post" action="/cgi-bin/koha/tools/inventory.pl" class="checkboxed">
236     <input type="hidden" name="minlocation" value="[% minlocation %]" />
237     <input type="hidden" name="maxlocation" value="[% maxlocation %]" />
238     <input type="hidden" name="location" value="[% location %]" />
239     <input type="hidden" name="branchcode" value="[% branchcode %]" />
240     <input type="hidden" name="datelastseen" value="[% datelastseen %]" />
241
242     [% UNLESS compareinv2barcd %]
243       <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>
244     [% END %]
245
246     <table id="inventoryt">
247     <thead>
248         <tr>
249             [% UNLESS compareinv2barcd %]<th>Seen</th>[% END %]
250             <th>Barcode</th>
251             <th>Call number</th>
252             <th>Library</th>
253             <th>Title</th>
254             <th>Status</th>
255             <th>Lost</th>
256             <th>Damaged</th>
257             <th>Withdrawn</th>
258             <th>Last seen</th>
259             <th>Problems</th>
260         </tr>
261     </thead>
262     <tbody>
263     [% FOREACH result IN loop %]
264         <tr>
265             [% UNLESS compareinv2barcd %]
266               <td>
267                 <input type="checkbox" name="SEEN-[% result.itemnumber %]" value="1" />
268               </td>
269             [% END %]
270             <td>
271             [% result.barcode | html %]
272             </td>
273             <td>[% result.itemcallnumber | html %]</td>
274             <td>
275                 [% Branches.GetName( result.homebranch ) %]
276                 [% result.location | html %]
277             </td>
278             <td>
279                 <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% result.biblionumber %]" class="openWin">[% result.title | html %]</a>
280                 <p>[% result.author | html %]</p>
281             </td>
282             <td>
283             [% result.notforloan | html %]
284             </td>
285             <td>
286             [% result.itemlost | html %]
287             </td>
288             <td>
289             [% result.damaged | html %]
290             </td>
291             <td>
292             [% result.withdrawn | html %]
293             </td>
294             <td>
295             [% result.datelastseen | $KohaDates | html %]
296             </td>
297             <td>
298             [% FOREACH problem IN result.problems %]
299                 [% IF problem.key == 'wrongplace' %]
300                     Found in wrong place<br/>
301                 [% ELSIF problem.key == 'changestatus' %]
302                     Unknown not-for-loan status<br/>
303                 [% ELSIF problem.key == 'not_scanned' %]
304                     Missing (not scanned)<br/>
305                 [% ELSIF problem.key == 'checkedout' %]
306                     Still checked out<br/>
307                 [% ELSIF problem.key == 'no_barcode' %]
308                     No barcode<br/>
309                 [% END %]
310             [% END %]
311             </td>
312         </tr>
313     [% END %]
314     </tbody>
315     </table>
316     <div class="spacer"></div>
317     [% UNLESS compareinv2barcd %]
318       <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>
319       <input type="submit" id="markseenandquit" value="Mark seen and quit" />
320       <input type="submit" value="Mark seen and continue &gt;&gt;" id="markseenandcontinuebutton" />
321       <input type="submit" value="Continue without marking &gt;&gt;" id="continuewithoutmarkingbutton" class="submit" />
322     [% END %]
323     </form>
324
325     </div>
326
327     [% END %]
328 </div>
329 <div class="yui-b">
330 [% INCLUDE 'tools-menu.inc' %]
331 </div>
332 </div>
333 [% INCLUDE 'intranet-bottom.inc' %]