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