Bug 16157: Move the selected flag from GetAuthorisedValues to the templates
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / serials-search.tt
1 [% USE Branches %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 [% USE KohaDates %]
4 [% USE AuthorisedValues %]
5 <title>Koha &rsaquo; Serials [% biblionumber %]</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% INCLUDE 'calendar.inc' %]
8 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
9 [% INCLUDE 'datatables.inc' %]
10 <script type="text/javascript">
11 //<![CDATA[
12  $(document).ready(function() {
13     var osrlt = $("#osrlt").dataTable($.extend(true, {}, dataTablesDefaults, {
14         "sPaginationType": "four_button",
15         "aoColumnDefs": [
16             { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
17             { "sType": "title-string", "aTargets" : [ "title-string" ] },
18             { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
19         ]
20     } ) );
21
22     var csrlt = $("#csrlt").dataTable($.extend(true, {}, dataTablesDefaults, {
23         // FIXME sort function of additional_fields!
24         "sPaginationType": "four_button",
25         "aoColumnDefs": [
26             { 'bSortable': false, 'aTargets': [ 'NoSort' ] },
27             { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
28         ]
29     } ) );
30
31     osrlt.fnAddFilters("dt-filter", 750);
32     csrlt.fnAddFilters("dt-filter", 750);
33
34     $('#serialstabs').tabs();
35     $("#reopensub").click(function(){
36       return confirm(_("Are you sure you want to reopen this subscription?"));
37     });
38  });
39  //]]>
40 </script>
41 <style type="text/css">input.dt-filter { width : 100%; font-size : 85%; }</style>
42 </head>
43 <body id="ser_serials-home" class="ser">
44 [% INCLUDE 'header.inc' %]
45 [% INCLUDE 'serials-search.inc' %]
46
47 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; [% IF ( done_searched ) %]<a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Search results[% ELSE %]Serials [% END %] </div>
48
49 <div id="doc3" class="yui-t2">
50   <div id="bd">
51     <div id="yui-main">
52       <div class="yui-b">
53       [% INCLUDE 'serials-toolbar.inc' %]
54
55       <h2>Serials subscriptions ([% total %] found)</h2>
56       [% UNLESS ( done_searched ) %]
57       <div id="advsearch" style="padding-bottom:3em;">
58         <form action="/cgi-bin/koha/serials/serials-search.pl" method="get">
59           <fieldset class="rows">
60           <legend>Search subscriptions</legend>
61               <ol>
62                 <li>
63                   <label for="issn">ISSN:</label>
64                   <input type="text" id="issn" name="ISSN_filter" value="[% ISSN_filter | html %]" />
65                 </li>
66                 <li>
67                   <label for="title">Title:</label>
68                   <input type="text" id="title" name="title_filter" value="[% title_filter | html %]" />
69                 </li>
70                 [% IF ( marcflavour == "UNIMARC" ) %]
71                 <li>
72                   <label for="ean">EAN:</label>
73                   <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter | html %]" />
74                 </li>
75                 [% END %]
76                 <li>
77                   <label for="callnumber">Call number:</label>
78                   <input type="text" id="callnumber" name="callnumber_filter" value="[% callnumber_filter | html %]" />
79                 </li>
80                 <li>
81                   <label for="publisher">Publisher:</label>
82                   <input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter | html %]" />
83                 </li>
84                 <li>
85                   <label for="bookseller">Vendor:</label>
86                   <input type="text" id="bookseller" name="bookseller_filter" value="[% bookseller_filter | html %]" />
87                 </li>
88                 <li>
89                   <label for="branch">Library:</label>
90                   <select id="branch" name="branch_filter">
91                     <option value="">All</option>
92                     [% FOREACH branch IN branches_loop %]
93                       [% IF ( branch.selected ) %]
94                         <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
95                       [% ELSE %]
96                         <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
97                       [% END %]
98                     [% END %]
99                   </select>
100                 </li>
101                 <li>
102                   <label for="location">Location:</label>
103                   [% PROCESS 'av-build-dropbox.inc' name="location_filter", category="LOC", default=location_filter, all=1 %]
104                 </li>
105                 <li>
106                   <label for="to">Expires before:</label>
107                   <input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
108                 </li>
109                 [% FOR field IN additional_fields_for_subscription %]
110                   <li>
111                     <label for="additional_field_[% field.id %]"> [% field.name %]: </label>
112                     [% IF field.authorised_value_choices %]
113                       <select id="additional_field_[% field.id %]" name="additional_field_[% field.id %]_filter">
114                         <option value="">All</option>
115                         [% FOREACH av IN field.authorised_value_choices %]
116                           <option value="[% av.authorised_value %]">[% av.lib %]</option>
117                         [% END %]
118                       </select>
119                     [% ELSE %]
120                       <input id="additional_field_[% field.id %]" type="text" value="[% additional_fields.${field.name} %]" name="additional_field_[% field.id %]_filter" />
121                     [% END %]
122                   </li>
123                 [% END %]
124               </ol>
125               <input type="hidden" name="searched" value="1" />
126               <fieldset class="action">
127                 <input type="submit" value="Search" />
128               </fieldset>
129           </fieldset>
130         </form>
131       </div>
132       [% END %]
133       [% IF ( done_searched ) %]
134         [% IF ( total ) %]
135           <div id="serialstabs" class="toptabs" style="clear:both;">
136             <ul class="ui-tabs-nav">
137               <li><a href="#opened">Open ([% openedsubscriptions.size || 0 %])</a></li>
138               <li><a href="#closed">Closed ([% closedsubscriptions.size || 0 %])</a></li>
139             </ul>
140             <div id="opened">
141               [% IF openedsubscriptions %]
142                 <table id="osrlt">
143                   <thead>
144                     <tr>
145                         <th>ISSN</th>
146                         <th class="anti-the">Title</th>
147                         <th>Notes</th>
148                         <th>Library</th>
149                         <th>Location</th>
150                         <th>Call number</th>
151                         <th class="title-string">Expiration date</th>
152                         [% FOR field IN additional_fields_for_subscription %]
153                           <th>[% field.name %]</th>
154                         [% END %]
155                         <th class="NoSort">Actions</th>
156                     </tr>
157                   </thead>
158                   <tfoot>
159                     <tr>
160                       <td><input type="text" class="dt-filter" data-column_num="0" placeholder="Search ISSN" /></td>
161                       <td><input type="text" class="dt-filter" data-column_num="1" placeholder="Search title" /></td>
162                       <td><input type="text" class="dt-filter" data-column_num="2" placeholder="Search notes" /></td>
163                       <td><input type="text" class="dt-filter" data-column_num="3" placeholder="Search library" /></td>
164                       <td><input type="text" class="dt-filter" data-column_num="4" placeholder="Search location" /></td>
165                       <td><input type="text" class="dt-filter" data-column_num="5" placeholder="Search callnumber" /></td>
166                       <td><input type="text" class="dt-filter" data-column_num="6" placeholder="Search expiration date" /></td>
167                       [% FOR field IN additional_fields_for_subscription %]
168                         <td><input type="text" class="dt-filter" data-column_num="[% loop.count + 6 %]" placeholder="Search [% field.name %]" /></td>
169                       [% END %]
170                       <td></td>
171                     </tr>
172                   </tfoot>
173                   <tbody>
174                     [% FOREACH subscription IN openedsubscriptions %]
175                     [% UNLESS subscription.cannotdisplay %]
176                       <tr>
177                         <td>
178                         [% IF ( subscription.issn ) %][% subscription.issn %]
179                         [% END %]
180                         </td>
181                         <td><a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid %]" class="button" title="subscription detail">[% subscription.title |html %]</a>
182                         </td>
183                         <td>[% IF ( subscription.publicnotes ) %][% subscription.publicnotes %][% END %]
184                         [% IF ( subscription.internalnotes ) %]([% subscription.internalnotes %])[% END %]
185                         </td>
186                         <td>
187                           [% IF ( subscription.branchcode ) %][% Branches.GetName( subscription.branchcode ) %][% END %]
188                         </td>
189                         <td>
190                           [% IF ( subscription.location ) %][% AuthorisedValues.GetByCode( 'LOC', subscription.location ) %][% END %]
191                         </td>
192                         <td>
193                           [% IF ( subscription.callnumber ) %][% subscription.callnumber %][% END %]
194                         </td>
195                         <td>
196                             [% IF ( subscription.enddate ) %]
197                                 <span title="[% subscription.enddate %]">[% subscription.enddate | $KohaDates %]</span>
198                             [% ELSE %]
199                                 <span title="0000-00-00"></span>
200                             [% END %]
201                         </td>
202
203                         [% FOR field IN additional_fields_for_subscription %]
204                           [% IF field.authorised_value_category %]
205                             <td>[% AuthorisedValues.GetByCode( field.authorised_value_category, subscription.additional_fields.${field.name} ) %]</td>
206                           [% ELSE %]
207                             <td>[% subscription.additional_fields.${field.name} %]</td>
208                           [% END %]
209                         [% END %]
210
211                         <td>
212                             <div class="dropdown">
213                                 <a class="btn btn-mini dropdown-toggle" id="subactions[% subscription.subscriptionid %]" role="button" data-toggle="dropdown" href="#">
214                                    Actions <b class="caret"></b>
215                                 </a>
216                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="subactions[% subscription.subscriptionid %]">
217
218                                     [% IF ( routing && CAN_user_serials_routing ) %]
219                                         [% IF ( subscription.cannotedit ) %]
220                                         [% ELSE %]
221                                             [% IF ( subscription.routingedit ) %]
222                                                 <li>
223                                                     <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid %]"><i class="fa fa-pencil"></i> Edit routing list ([% subscription.routingedit %])</a>
224                                                 </li>
225                                             [% ELSE %]
226                                                 <li>
227                                                     <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid %]&amp;op=new"> <i class="fa fa-plus"></i> New routing list</a>
228                                                 </li>
229                                             [% END %]
230                                         [% END %]
231                                     [% END # IF ( routing && CAN_user_serials_routing ) %]
232
233                                     <li>
234                                         <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% subscription.subscriptionid %]"><i class="fa fa-list-alt"></i> Issue history</a>
235                                     </li>
236                                     [% IF ( CAN_user_serials_receive_serials ) %]
237                                         <li>
238                                             <a href="/cgi-bin/koha/serials/serials-edit.pl?subscriptionid=[% subscription.subscriptionid %]&amp;serstatus=1,3,7"> <i class="fa fa-inbox"></i> Serial receive</a>
239                                         </li>
240                                     [% END %]
241                                 </ul>
242                             </div>
243                         </td>
244
245                       </tr>
246                       [% END %]
247                     [% END %]
248                   </tbody>
249                 </table>
250               [% ELSE %]
251                 <div class="dialog message">
252                   <p>Your search returned no open subscriptions.</p>
253                 </div>
254               [% END %]
255             </div>
256             <div id="closed">
257               [% IF closedsubscriptions %]
258                 <table id="csrlt">
259                 <!-- FIXME add additional_fields for closed subs -->
260                   <thead>
261                     <tr>
262                         <th>ISSN</th>
263                         <th class="anti-the">Title</th>
264                         <th>Notes</th>
265                         <th>Library</th>
266                         <th>Location</th>
267                         <th>Call number</th>
268                         [% FOR field IN additional_fields_for_subscription %]
269                           <th>[% field.name %]</th>
270                         [% END %]
271                         <th class="NoSort">Actions</th>
272                     </tr>
273                   </thead>
274                   <tfoot>
275                     <tr>
276                       <td><input type="text" class="dt-filter" data-column_num="0" placeholder="Search ISSN" /></td>
277                       <td><input type="text" class="dt-filter" data-column_num="1" placeholder="Search title" /></td>
278                       <td><input type="text" class="dt-filter" data-column_num="2" placeholder="Search notes" /></td>
279                       <td><input type="text" class="dt-filter" data-column_num="3" placeholder="Search library" /></td>
280                       <td><input type="text" class="dt-filter" data-column_num="4" placeholder="Search location" /></td>
281                       <td><input type="text" class="dt-filter" data-column_num="5" placeholder="Search callnumber" /></td>
282                       [% FOR field IN additional_fields_for_subscription %]
283                         <td><input type="text" class="dt-filter" data-column_num="[% loop.count + 5 %]" placeholder="Search [% field.name %]" /></td>
284                       [% END %]
285                       <td></td>
286                     </tr>
287                   </tfoot>
288                   <tbody>
289                     [% FOREACH subscription IN closedsubscriptions %]
290                     [% UNLESS subscription.cannotdisplay %]
291                       <tr>
292                         <td>
293                           [% IF ( subscription.issn ) %]
294                             [% subscription.issn %]
295                           [% END %]
296                         </td>
297                         <td>
298                           <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid %]" class="button" title="subscription detail">[% subscription.title |html %]</a>
299                         </td>
300                         <td>
301                           [% IF ( subscription.notes ) %][% subscription.notes %][% END %]
302                           [% IF ( subscription.internalnotes ) %]([% subscription.internalnotes %])[% END %]
303                         </td>
304                         <td>
305                           [% IF ( subscription.branchcode ) %][% Branches.GetName( subscription.branchcode ) %][% END %]
306                         </td>
307                         <td>
308                           [% IF ( subscription.location ) %][% AuthorisedValues.GetByCode( 'LOC', subscription.location ) %][% END %]
309                         </td>
310                         <td>
311                           [% IF ( subscription.callnumber ) %][% subscription.callnumber %][% END %]
312                         </td>
313                         [% FOR field IN additional_fields_for_subscription %]
314                           [% IF field.authorised_value_category %]
315                             <td>[% AuthorisedValues.GetByCode( field.authorised_value_category, subscription.additional_fields.${field.name} ) %]</td>
316                           [% ELSE %]
317                             <td>[% subscription.additional_fields.${field.name} %]</td>
318                           [% END %]
319                         [% END %]
320                         <td>
321                             <div class="dropdown">
322                                 <a class="btn btn-mini dropdown-toggle" id="closedsubactions[% subscription.subscriptionid %]" role="button" data-toggle="dropdown" href="#">
323                                    Actions <b class="caret"></b>
324                                 </a>
325                                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="closedsubactions[% subscription.subscriptionid %]">
326
327                                     [% IF ( routing && CAN_user_serials_routing ) %]
328                                         [% UNLESS ( subscription.cannotedit ) %]
329                                             <li>
330                                                 <a href="/cgi-bin/koha/serials/serials-search.pl?subscriptionid=[% subscription.subscriptionid %]&amp;op=reopen&amp;routing=[% subscription.routing %]&amp;searched=1&amp;title_filter=[% title_filter | uri %]&amp;ISSN_filter=[% ISSN_filter | uri %]&amp;EAN_filter=[% EAN_filter | uri %]&amp;published_filter=[% publisher_filter | uri %]&amp;bookseller_filter=[% bookseller_filter | uri %]&amp;branch_filter=[% branch_filter | uri %]" id="reopensub"> <i class="fa fa-repeat"></i> Reopen</a>
331                                             </li>
332                                         [% END %]
333                                     [% END # IF ( routing && CAN_user_serials_routing ) %]
334
335                                     <li>
336                                         <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% subscription.subscriptionid %]"><i class="fa fa-list-alt"></i> Issue history</a>
337                                     </li>
338
339                                 </ul>
340                             </div>
341                         </td>
342                       </tr>
343                     [% END %]
344                     [% END %]
345                   </tbody>
346                 </table>
347               [% ELSE %]
348                 <div class="dialog message">
349                   <p>Your search returned no closed subscriptions.</p>
350                 </div>
351               [% END %]
352             </div>
353           </div>
354         [% ELSE %]
355             <div class="dialog message">
356               <p>Your search returned no results.</p>
357             </div>
358         [% END %]
359       [% END %]
360     </div>
361   </div>
362
363   <div class="yui-b">
364     [% INCLUDE 'serials-menu.inc' %]
365     [% IF ( done_searched ) %]
366     <div id="advsearch">
367         <form action="/cgi-bin/koha/serials/serials-search.pl" method="get">
368           <fieldset class="brief">
369             <h4>Search subscriptions</h4>
370               <ol>
371                 <li>
372                   <label for="issn">ISSN:</label>
373                   <input type="text" id="issn" name="ISSN_filter" value="[% ISSN_filter | html %]" />
374                 </li>
375                 <li>
376                   <label for="title">Title:</label>
377                   <input type="text" id="title" name="title_filter" value="[% title_filter | html %]" />
378                 </li>
379                 [% IF ( marcflavour == "UNIMARC" ) %]
380                 <li>
381                   <label for="ean">EAN:</label>
382                   <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter | html %]" />
383                 </li>
384                 [% END %]
385                 <li>
386                   <label for="callnumber">Call number:</label>
387                   <input type="text" id="callnumber" name="callnumber_filter" value="[% callnumber_filter | html %]" />
388                 </li>
389                 <li>
390                   <label for="publisher">Publisher:</label>
391                   <input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter | html %]" />
392                 </li>
393                 <li>
394                   <label for="bookseller">Vendor:</label>
395                   <input type="text" id="bookseller" name="bookseller_filter" value="[% bookseller_filter | html %]" />
396                 </li>
397                 <li>
398                   <label for="branch">Library:</label>
399                   <select id="branch" name="branch_filter">
400                     <option value="">All</option>
401                     [% FOREACH branch IN branches_loop %]
402                       [% IF ( branch.selected ) %]
403                         <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
404                       [% ELSE %]
405                         <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
406                       [% END %]
407                     [% END %]
408                   </select>
409                 </li>
410                 <li>
411                   <label for="location">Location:</label>
412                   [% PROCESS 'av-build-dropbox.inc' name="location_filter", category="LOC", default=location_filter, all=1 %]
413                 </li>
414                 <li>
415                   <label for="to">Expires before:</label>
416                   <input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
417                 </li>
418
419                 [% FOR field IN additional_fields_for_subscription %]
420                   <li>
421                     <label for="additional_field_[% field.id %]ID"> [% field.name %]: </label>
422                     [% IF field.authorised_value_choices %]
423                       <select id="additional_field_[% field.id %]" name="additional_field_[% field.id %]_filter">
424                         <option value="">All</option>
425                         [% FOREACH av IN field.authorised_value_choices %]
426                           [% IF av.authorised_value == additional_field_filters.${field.name}.value %]
427                             <option value="[% av.authorised_value %]" selected="selected">[% av.lib %]</option>
428                           [% ELSE %]
429                             <option value="[% av.authorised_value %]">[% av.lib %]</option>
430                           [% END %]
431                         [% END %]
432                       </select>
433                     [% ELSE %]
434                       <input id="additional_field_[% field.id %]" type="text" value="[% additional_field_filters.${field.name}.value %]" name="additional_field_[% field.id %]_filter" />
435                     [% END %]
436                   </li>
437                 [% END %]
438               </ol>
439               <input type="hidden" name="searched" value="1" />
440               <fieldset class="action">
441                 <input type="submit" value="Search" />
442               </fieldset>
443             </div>
444           </fieldset>
445         </form>
446       [% END %]
447   </div>
448 </div>
449 [% INCLUDE 'intranet-bottom.inc' %]