Bug 26362: Show correct libraries in overdues report
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / overdue.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [%- USE Branches -%]
5 [%- USE Price -%]
6 [%- USE ItemTypes -%]
7 [%- USE Categories -%]
8 [%- USE ColumnsSettings -%]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>Koha &rsaquo; Circulation &rsaquo; Items overdue as of [% todaysdate | html %]</title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 <style>
14     .sql {display:none;}
15 </style>
16 </head>
17
18 <body id="circ_overdue" class="circ">
19 [% INCLUDE 'header.inc' %]
20 [% INCLUDE 'circ-search.inc' %]
21
22 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Overdues as of [% todaysdate | html %]</div>
23
24 <div class="main container-fluid">
25     <div class="row">
26         <div class="col-sm-10 col-sm-push-2">
27             <main>
28
29 [% IF ( noreport ) %]
30   <h2>Overdue report</h2>
31   <p>Please choose one or more filters to proceed.</p>
32 [% ELSE %]
33
34 [% IF ( overdueloop ) %]
35
36   <h2>[% nnoverdue | html %] [% IF ( noverdue_is_plural ) %]Items[% ELSE %]Item[% END %] overdue as of [% todaysdate | html %][% IF ( isfiltered ) %] <span style="font-size:70%;">(Filtered. <a href="/cgi-bin/koha/circ/overdue.pl">Reset filter</a>)</span>[% END %]</h2>
37
38   <p>
39     [% IF ( isfiltered ) %]
40         [% SET url_params = '' %]
41         [% FOR var IN filters.keys %]
42             [% url_params = BLOCK %][% url_params | $raw %]&amp;[% var | uri %]=[% filters.$var | uri %][% END %]
43         [% END %]
44       <a href="overdue.pl?op=csv[% url_params | $raw %]">Download file of displayed overdues</a>
45     [% ELSE %]
46       <a href="overdue.pl?op=csv">Download file of all overdues</a>
47     [% END %]
48   </p>
49
50   <div class="sql"><pre>[% sql | html %]</pre></div>
51   <div class="searchresults">
52     <table id="overduest">
53       <thead>
54         <tr>
55           <th class="title-string">Due date</th>
56           <th>Patron</th>
57           <th>Patron category</th>
58           <th>Patron library</th>
59           <th class="anti-the">Title</th>
60           <th>Home library</th>
61           <th>Holding library</th>
62           <th>Barcode</th>
63           <th>Call number</th>
64           <th>Item type</th>
65           <th>Price</th>
66           <th>Non-public note</th>
67         </tr>
68       </thead>
69       [%- BLOCK subject -%]Overdue:[%- END -%]
70       <tbody>
71       [% FOREACH overdueloo IN overdueloop %]
72         <tr>
73           <td><span title="[% overdueloo.duedate | html %]">[% overdueloo.duedate | $KohaDates %]</span></td>
74           <td>
75             [% INCLUDE 'patron-title.inc' patron=overdueloo.patron hide_patron_infos_if_needed=1 %]
76             [% IF logged_in_user.can_see_patron_infos( overdueloo.patron ) %]
77                 [% IF ( overdueloo.email ) %][<a href="mailto:[% overdueloo.email | uri %]?subject=[% INCLUDE subject %] [% overdueloo.title | uri %]">email</a>][% END %]
78                 [% IF ( overdueloo.phone ) %]([% overdueloo.phone | html %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile | html %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro | html %])[% END %]</td>
79             [% END %]
80             <td>[% Categories.GetName( overdueloo.patron.categorycode ) | html %]</td>
81             <td>[% Branches.GetName( overdueloo.patron.branchcode ) | html %]</td>
82           <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overdueloo.biblionumber %][% INCLUDE 'biblio-title.inc' biblio=overdueloo %]</a> [% IF ( overdueloo.author ) %], by [% overdueloo.author | html %][% END %][% IF ( overdueloo.enumchron ) %], [% overdueloo.enumchron | html %][% END %]</td>
83             <td>[% Branches.GetName( overdueloo.homebranchcode ) | html %]</td>
84             <td>[% Branches.GetName( overdueloo.holdingbranchcode ) | html %]</td>
85           <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% overdueloo.biblionumber | uri %]&amp;itemnumber=[% overdueloo.itemnum | uri %]#item[% overdueloo.itemnum | uri %]">[% overdueloo.barcode | html %]</a></td>
86           <td>[% overdueloo.itemcallnumber | html %]</td>
87             <td>[% ItemTypes.GetDescription( overdueloo.itemtype ) | html %]</td>
88           <td>[% overdueloo.replacementprice | $Price %]</td>
89           <td>[% overdueloo.itemnotes_nonpublic | html %]</td>
90         </tr>
91       [% END %]
92       </tbody>
93     </table>
94   </div>
95
96 [% ELSE %]
97
98   <h2>Overdue report</h2>
99   [% IF ( isfiltered ) %]
100     <p>There are no overdues matching your search. <a href="/cgi-bin/koha/circ/overdue.pl">Reset filter</a></p>
101   [% ELSE %]
102     <p>There are no overdues.</p>
103   [% END %]
104
105 [% END %]  <!-- overdueloop -->
106 [% END %]  <!-- noreport -->
107
108             </main>
109         </div> <!-- /.col-sm-10.col-sm-push-2 -->
110
111         <div class="col-sm-2 col-sm-pull-10">
112             <aside>
113
114 <form method="post" action="/cgi-bin/koha/circ/overdue.pl">
115   <fieldset class="brief">
116 <h4>Filter on:</h4>
117         <fieldset><legend>Date due:</legend>
118         <ol>
119     <li><label for="from">From:</label>
120     <input type="text" id="from" name="dateduefrom" size="10" value="[% filters.dateduefrom | $KohaDates %]" class="datepickerfrom" />
121         </li>
122         <li>
123     <label for="to">To:</label>
124     <input type="text" id="to" name="datedueto" size="10" value="[% filters.datedueto | $KohaDates %]" class="datepickerto" />
125     </li>
126     </ol></fieldset>
127     <ol>
128     <li><label>Name or cardnumber:</label><input type="text" name="borname" value="[% filters.borname | html %]" /></li>
129     <li><label>Patron category:</label><select name="borcat" id="borcat"><option value="">Any</option>
130       [% FOREACH borcatloo IN borcatloop %]
131         [% IF ( borcatloo.selected ) %]<option value="[% borcatloo.value | html %]" selected="selected">[% borcatloo.catname | html %]</option>[% ELSE %]<option value="[% borcatloo.value | html %]">[% borcatloo.catname | html %]</option>[% END %]
132       [% END %]
133       </select>
134     </li>
135     <li><label>Patron flags:</label>
136         <select name="borflag" size="1" id="borflag">
137             <option value="">None</option>
138             [% IF ( borflag_gonenoaddress ) %]<option value="gonenoaddress" selected="selected">Address in question</option>
139             [% ELSE %]<option value="gonenoaddress">Address in question</option>[% END %]
140             [% IF ( borflag_debarred ) %]<option value="debarred" selected="selected">Restricted</option>
141             [% ELSE %]<option value="debarred">Restricted</option>[% END %]
142             [% IF ( borflag_lost ) %]<option value="lost" selected="selected">Lost card</option>
143             [% ELSE %]<option value="lost">Lost card</option>[% END %]
144         </select>
145     </li>
146         [% FOREACH patron_attr_filter_loo IN patron_attr_filter_loop %]
147                 <!-- domid cgivalue ismany isclone ordinal code description repeatable authorised_value_category -->
148                 <li>
149                         <label>[% patron_attr_filter_loo.description | html %]:</label>
150             [% IF ( patron_attr_filter_loo.authorised_value_category ) %]
151                 <script type="text/javascript" x-code="[% patron_attr_filter_loo.code | html %]">create_auto_completion_responder([% patron_attr_filter_loo.domid | html %],"[% patron_attr_filter_loo.code | html %]");</script>
152                                 <span id="pattrodue-getready-[% patron_attr_filter_loo.domid | html %]">
153                                                 <div class="pattrodue-autocomplete">
154                             <input autocomplete="off" id="pattrodue-input-[% patron_attr_filter_loo.domid | html %]" name="patron_attr_filter_[% patron_attr_filter_loo.code | html %]" value="[% patron_attr_filter_loo.cgivalue | html %]"  class="pattrodue-input" type="text" />
155                                                 </div>
156                                 </span>
157                         [% ELSE %]
158                 <input type="text" name="patron_attr_filter_[% patron_attr_filter_loo.code | html %]" value="[% patron_attr_filter_loo.cgivalue | html %]"/>
159                         [% END %]
160                         [% IF ( patron_attr_filter_loo.repeatable ) %]
161                 <a href="#" onclick="clone_parent(this); return false;">Add</a>
162                 [% IF ( patron_attr_filter_loo.isclone ) %]
163                                     <a href="#" onclick="delete_parent(this); return false;" style="visibility: visible">Delete</a>
164                 [% ELSIF ( patron_attr_filter_loo.ismany ) %]
165                                     <a href="#" onclick="delete_parent(this); return false;" style="visibility: visible">Delete</a>
166                 [% ELSE %]
167                                     <a href="#" onclick="delete_parent(this); return false;" style="visibility: hidden">Delete</a>
168                 [% END %]
169                         [% END %]
170                 </li>
171         [% END %]
172
173     <li><label>Item type:</label><select name="itemtype" id="itemtype"><option value="">Any</option>
174       [% FOREACH itemtypeloo IN itemtypeloop %][% IF ( itemtypeloo.selected ) %]
175         <option value="[% itemtypeloo.value | html %]" selected="selected">[% itemtypeloo.itemtypename | html %]</option>[% ELSE %]
176         <option value="[% itemtypeloo.value | html %]">[% itemtypeloo.itemtypename | html %]</option>[% END %]
177       [% END %]
178       </select>
179     </li>
180
181     <li>
182         <label>Item home library:</label>
183         <select name="homebranch" id="homebranch">
184             <option value="">Any</option>
185             [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.homebranch ) %]
186         </select>
187     </li>
188
189     <li>
190         <label>Item holding library:</label>
191         <select name="holdingbranch" id="holdingbranch">
192             <option value="">Any</option>
193             [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.holdingbranch ) %]
194         </select>
195     </li>
196
197     <li>
198         <label>Library of the patron:</label>
199         <select name="branch" id="branch">
200             <option value="">Any</option>
201             [% PROCESS options_for_libraries libraries => Branches.all( selected => filters.branch, only_from_group => 1 ) %]
202         </select>
203     </li>
204
205 <li class="radio"><label for="showall">Show any items currently checked out:</label>
206         [% IF ( showall ) %]
207             <input type="checkbox" id="showall" name="showall" value="show" checked="checked" />
208     [% ELSE %]
209         <input type="checkbox" id="showall" name="showall" value="show" />
210     [% END %]
211 </li>
212 </ol>
213    <fieldset class="action">
214       <input type="submit" value="Apply filter" class="submit" />
215       <input type="hidden" name="op" value="apply filter" />
216    </fieldset>
217    </fieldset>
218   </form>
219
220             </aside>
221         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
222      </div> <!-- /.row -->
223
224 [% MACRO jsinclude BLOCK %]
225     [% INCLUDE 'calendar.inc' %]
226     [% INCLUDE 'datatables.inc' %]
227     [% INCLUDE 'columns_settings.inc' %]
228     <script>
229         function clone_parent(node) {
230             var parent = node.parentNode;
231             var clone = parent.cloneNode(true);
232             parent.parentNode.insertBefore(clone, parent.nextSibling);
233             $("a", clone).attr("style", "visibility: visible");
234             $("input", clone).attr("value", "");
235
236             var theid = $("span", clone).attr("id") || "";
237             var theid = $("span", clone).attr("id") || "";
238             var parts = theid.match(/^pattrodue-getready-(.*)$/);
239             if (parts && parts.length > 1){
240                 var appendid = "-" + Math.floor(Math.random()*1000+1);
241                 $("span", clone).attr("id",theid+appendid);
242
243                 theid = $("input", clone).attr("id");
244                 $("input", clone).attr("id",theid+appendid);
245
246                 theid = $("div[id]", clone).attr("id");
247                 $("div[id]", clone).attr("id",theid+appendid);
248
249                 var attrcode = $("script", clone).attr("x-code");
250                 var newsuffix = parts[1] + appendid;
251                 create_auto_completion_responder(newsuffix,attrcode);
252             }
253         }
254
255
256         function delete_parent(node) {
257             var parent = node.parentNode;
258             parent.parentNode.removeChild(parent);
259         }
260
261         function create_auto_completion_responder(uniqueid,attrcode) {
262             $("#pattrodue-getready-" + uniqueid).ready(function(){
263                 $( "#pattrodue-input-" + uniqueid ).autocomplete({
264                     source: "/cgi-bin/koha/circ/ypattrodue-attr-search-authvalue.pl/"+attrcode,
265                     select: function( event, ui ) {
266                         $( "#pattrodue-input-"+uniqueid ).val( ui.item.description );
267                         return false;
268                     }
269                 })
270                 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
271                     return $( "<li></li>" )
272                     .data( "ui-autocomplete-item", item )
273                     .append( "<a>" + item.description + " (" + item.authorised_value + ")</a>" )
274                     .appendTo( ul )
275                     .css("font-size","90%").css("width","13em");
276                 };
277             });
278         }
279
280         $(document).ready(function(){
281             var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %];
282             KohaTable("overduest", {
283                 "sPaginationType": "full",
284                 "aaSorting": [[0, 'asc']],
285                 "aoColumnDefs": [
286                     { "sType": "title-string", "aTargets": [ "title-string" ] },
287                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
288                 ],
289                 "autoWidth": false,
290                 "stateSave": true
291             }, columns_settings);
292         });
293   </script>
294 [% END %]
295
296 [% INCLUDE 'intranet-bottom.inc' %]