Bug 27998: (follow-up) Address missing instances
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / serials-collection.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues %]
4 [% USE Branches %]
5 [% USE KohaDates %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Serials &rsaquo; Serial collection information for [% bibliotitle | html %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="ser_serials-collection" class="ser">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'serials-search.inc' %]
15
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17     <ol>
18         <li>
19             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20         </li>
21         <li>
22             <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a>
23         </li>
24         <li>
25             <a href="#" aria-current="page">
26                 Serial collection information for <em>[% bibliotitle | html %]</em>
27             </a>
28         </li>
29     </ol>
30 </nav>
31
32 <div class="main container-fluid">
33     <div class="row">
34         <div class="col-sm-10 col-sm-push-2">
35             <main>
36
37     [% INCLUDE 'modals/serials_multi_receiving.inc' %]
38
39 [% UNLESS ( popup ) %]
40         [% INCLUDE 'serials-toolbar.inc' %]
41
42     <h1>Serial collection information for  <em>[% bibliotitle | html %]</em>
43         [% IF location %] ([% AuthorisedValues.GetByCode( 'LOC', location ) | html %]) [% END %]
44                 [% IF ( callnumber ) %]callnumber: [% callnumber | html %][% END %]</h1>
45 [% END %]
46
47 [% IF ( delete ) %]
48     <div class="dialog alert">
49         <h3>You are about to delete [% serialnumber | html %] serial(s). Do you want to continue?</h3>
50         <form action="/cgi-bin/koha/serials/serials-collection.pl/#">
51             [% IF countitems > 0 %]
52                 <h5>Number of items available: [% countitems | html %]</h5>
53                 <p>
54                   <label>Delete associated items? <input type="checkbox" name="delitems" value="Yes" />Yes</label>
55                 </p>
56             [% END %]
57             <input type="hidden" name="op" value="delete_confirmed" />
58             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
59             <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
60             [% FOREACH serialid IN serialsid %]
61                 <input type="hidden" name="serialid" value="[% serialid | html %]" />
62             [% END %]
63             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
64         </form>
65         <form action="/cgi-bin/koha/serials/serials-collection.pl">
66             <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
67             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
68         </form>
69     </div>
70 [% END %]
71
72 [% IF ( error_delitem ) %]
73     <div class="dialog alert">
74         <p><strong>Error</strong>: one or more associated items could not be deleted at this time.</p>
75     </div>
76 [% END %]
77
78 [% IF ( subscriptions ) %]
79 <table>
80 [% IF ( subscriptions.size == 1 ) %]
81 <caption> Subscription summary</caption>
82 [% ELSE %]
83 <caption> Subscription summaries</caption>
84 [% END %]
85 <tr>
86   <th>Subscription num.</th>
87   <th>Frequency</th>
88   <th>Numbering pattern</th>
89   <th>Library</th>
90   <th>Call number</th>
91   <th>Notes</th>
92   <th>&nbsp;</th>
93 </tr>
94 [% FOREACH subscription IN subscriptions %]
95     <tr>
96         <td><a href="subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | uri %]"># [% subscription.subscriptionid | html %]</a> </td>
97         <td>[% subscription.frequency.description | html %]</td>
98         <td>[% subscription.numberpattern.label | html %]</td>
99         <td>[% IF subscription.branchcode %][% Branches.GetName( subscription.branchcode ) | html %][% END %]</td>
100         <td> [% subscription.callnumber | html %]</td>
101         <td> [% subscription.notes | html | html_line_break %]
102             [% UNLESS subscription.closed %]
103                 [% IF ( subscription.subscriptionexpired ) %]
104                     <br /><span class="problem"> Subscription expired</span>
105                 [% END %]
106             [% ELSE %]
107                 <br /> Subscription closed
108             [% END %]
109         </td>
110         [% IF ( subscription.abouttoexpire ) || ( subscription.subscriptionexpired ) %]<td class="problem actions">[% ELSE %]<td class="actions">[% END %]
111         [% UNLESS subscription.closed %]
112             [% IF ( routing && CAN_user_serials_routing ) %]
113                 [% IF ( subscription.hasRouting ) %]
114                     <a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | html %]"><i class="fa fa-pencil"></i> Edit routing list</a>
115                 [% ELSE %]
116                     <a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | html %]&amp;op=new"><i class="fa fa-plus"></i> Create routing list</a>
117                 [% END %]
118             [% END %]
119             [% IF ( subscription.abouttoexpire || subscription.subscriptionexpired) %]
120                 <a class="btn btn-default btn-xs subscription_renew" data-subscriptionid="[% subscription.subscriptionid | html %]" href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscription.subscriptionid | html %]"><i class="fa fa-refresh"></i> Renew</a>
121             [% END %]
122         [% ELSE %]
123             &nbsp;
124         [% END %]
125         </td>
126       </tr>
127 [% END %]
128 [% IF ( subscr ) %]
129 [% IF ( subscriptioncount > 1 ) %]
130 <tr ><td colspan="8">  <a href="serials-collection.pl?biblionumber=[% biblionumber | uri %]">See any subscription attached to this biblio</a></td>
131 </tr>
132 [% END %]
133 [% END %]
134 </table>
135 [% END %]
136
137
138 [% IF ( years ) %]<form name="edition" action="serials-edit.pl" method="post">
139 <div id="subscription_years" class="toptabs numbered">
140 <ul>
141         [% FOREACH year IN years %]
142         [% IF ( year.year ) %]
143             [% IF year.year == 'manage' %]
144                 <li><a href="#subscription-year-manage">Manage</a></li>
145             [% ELSE %]
146                 <li><a href="#subscription-year-[% year.year | uri %]">[% year.year | html %]</a></li>
147             [% END %]
148         [% END %]
149     [% END %]
150 </ul>
151
152  [% FOREACH year IN years %]
153 <div id="subscription-year-[% year.year | html %]">
154     [% IF ( CAN_user_serials_receive_serials ) %]
155         <p>
156             <div class="btn-group"><input type="submit" value="Edit serials" class="btn btn-default btn-sm" /></div>
157             [% UNLESS subscription.closed %]
158                 <div class="btn-group">
159                     <input type="button" value="Generate next" data-subscriptionid="[% subscriptionidlist | html %]" class="btn btn-default btn-sm generatenext" />
160                 </div>
161                 [% IF ( subscriptions.size == 1 and !serialsadditems ) %]&nbsp;
162                     <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
163                 [% END %]
164             [% END %]
165             <input type="button" value="Delete selected issues" class="delete-issues btn btn-default btn-sm" data-subscriptionids="[% subscriptionidlist | html %]" />
166         </p>
167     [% END %]
168       <span class="checkall">
169         <a class="CheckAll" href="#" data-year="[% year.year | html %]">Select all</a>
170       </span> |
171       <span class="clearall">
172         <a class="CheckNone" href="#" data-year="[% year.year | html %]">Clear all</a>
173       </span>
174         <table class="subscription-year-table">
175           <thead>
176             <tr>
177                 [% IF ( CAN_user_serials_receive_serials ) %]<th>Edit</th>[% END %]
178 [% IF ( subscriptions.size > 1 ) %]
179                 <th># Subs</th>
180 [% END %]
181                 <th>Date published
182                 </th>
183                 <th>Date published (text)
184                 </th>
185                 <th>Date received
186                 </th>
187                 <th>Number
188                 </th>
189                 <th>Status
190                 </th>
191                 <th>Notes
192                 </th>
193                 <th>Library
194                 </th>
195                 [% IF ( routing ) %]<th>Routing</th>[% END %]
196             </tr>
197           </thead>
198           <tbody>
199       [% FOREACH serial IN year.serials %]
200         <tr>
201             [% IF ( CAN_user_serials_receive_serials ) %]
202                 <td>
203                   [% UNLESS CAN_user_serials_receive_serials %]
204                     disabled
205                   [% ELSE %]
206                     [% IF ( serial.subscriptionexpired ) %]
207                     <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" />
208                     [% ELSE %]
209                       [% IF ( delete ) %]
210                         [% IF serialsid.grep("${serial.serialid}").size %]
211                           <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled checked />
212                         [% ELSE %]
213                           <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled />
214                         [% END %]
215                       [% ELSE %]
216                         [% IF serial.checked %]
217                           <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" checked />
218                         [% ELSE %]
219                           <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" />
220                         [% END %]
221                       [% END %]
222                     [% END %]
223                   [% END %]
224                 </td>
225             [% END %]
226 [% IF ( subscriptions.size > 1 ) %]
227                  <td><a href="serials-collection.pl?subscriptionid=[% serial.subscriptionid | uri %]">[% serial.subscriptionid | html %]</a></td>
228 [% END %]
229                 <td data-order="[% serial.publisheddate | html %]">
230                     [% IF serial.publisheddate %]
231                         [% serial.publisheddate | $KohaDates %]
232                     [% ELSE %]
233                         Unknown
234                     [% END %]
235                 </td>
236                 <td data-order="[% serial.publisheddatetext | html %]">
237                     [% IF serial.publisheddatetext %]
238                         [% serial.publisheddatetext | html %]
239                     [% END %]
240                 </td>
241                 <td data-order="[% serial.planneddate | html %]">
242                     [% IF serial.planneddate %]
243                         [% serial.planneddate | $KohaDates %]
244                     [% ELSE %]
245                         Unknown
246                     [% END %]
247                 </td>
248                 <td>
249                     [% IF ( matches = serial.serialseq.match('(.*)Spring(.*)') ) %]
250                         [% matches.0 | html %]Spring[% matches.1 | html %]
251                     [% ELSIF ( matches = serial.serialseq.match('(.*)Summer(.*)') ) %]
252                         [% matches.0 | html %]Summer[% matches.1 | html %]
253                     [% ELSIF ( matches = serial.serialseq.match('(.*)Fall(.*)') ) %]
254                         [% matches.0 | html %]Fall[% matches.1 | html %]
255                     [% ELSIF ( matches = serial.serialseq.match('(.*)Winter(.*)') ) %]
256                         [% matches.0 | html %]Winter[% matches.1 | html %]
257                     [% ELSIF ( matches = prediction.number.match('(.*)Spr(.*)') ) %]
258                         [% matches.0 | html %]Spr[% matches.1 | html %]
259                     [% ELSIF ( matches = prediction.number.match('(.*)Sum(.*)') ) %]
260                         [% matches.0 | html %]Sum[% matches.1 | html %]
261                     [% ELSIF ( matches = prediction.number.match('(.*)Fal(.*)') ) %]
262                         [% matches.0 | html %]Fal[% matches.1 | html %]
263                     [% ELSIF ( matches = prediction.number.match('(.*)Win(.*)') ) %]
264                         [% matches.0 | html %]Win[% matches.1 | html %]
265                     [% ELSE %]
266                         [% serial.serialseq | html %]
267                     [% END %]
268                 </td>
269                 <td>
270                     [% IF ( serial.status1 ) %]Expected[% END %]
271                     [% IF ( serial.status2 ) %]Arrived[% END %]
272                     [% IF ( serial.status3 ) %]Late[% END %]
273                     [% IF ( serial.status4 ) %]Missing[% END %]
274                     [% IF ( serial.status41 ) %]Missing (never received)[% END %]
275                     [% IF ( serial.status42 ) %]Missing (sold out)[% END %]
276                     [% IF ( serial.status43 ) %]Missing (damaged)[% END %]
277                     [% IF ( serial.status44 ) %]Missing (lost)[% END %]
278                     [% IF ( serial.status5 ) %]Not issued[% END %]
279                     [% IF ( serial.status6 ) %]Delete[% END %]
280                     [% IF ( serial.status7 ) %]Claimed[% END %]
281                     [% IF ( serial.status8 ) %]Stopped[% END %]
282                 </td>
283                 <td>
284                     [% serial.notes | html %]
285                 </td>
286                 <td>
287                     [% Branches.GetName( serial.branchcode ) | html %]
288                 </td>
289                 [% IF ( routing ) %]
290                 <td class="actions">
291                     <a href="/cgi-bin/koha/serials/routing-preview.pl?ok=1&amp;subscriptionid=[% serial.subscriptionid | uri %]&amp;issue=[% serial.serialseq.replace("'", "\\'") | uri %]%20([% serial.publisheddate | $KohaDates %])" class="btn btn-default btn-xs print_list"><i class="fa fa-print"></i> Print list</a>
292                 </td>
293                 [% END %]
294             </tr>
295           [% END %]
296         </tbody>
297       </table>
298     </div>
299     [% END %]
300   <input type="hidden" name="subscriptionid" value="[% subscriptionidlist | html %]" />
301
302 </div>
303 </form>
304 [% END %]
305
306             </main>
307         </div> <!-- /.col-sm-10.col-sm-push-2 -->
308
309         <div class="col-sm-2 col-sm-pull-10">
310             <aside>
311                 [% INCLUDE 'serials-menu.inc' %]
312             </aside>
313         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
314      </div> <!-- /.row -->
315
316 [% MACRO jsinclude BLOCK %]
317     [% INCLUDE 'datatables.inc' %]
318     <script>
319         var subscriptionid = "[% subscriptionid | html %]";
320     </script>
321     [% Asset.js("js/serials-toolbar.js") | $raw %]
322
323     <script>
324
325         function deleteIssues(subscriptionid) {
326             var serialschecked = $("form[name='edition'] input[name='serialid']:checked");
327             if (serialschecked.length > 0) {
328                 var location = 'serials-collection.pl?subscriptionid='+subscriptionid+'&op=delete_confirm';
329                 for (i=0; i < serialschecked.length; i++) {
330                     location += '&serialid=' + serialschecked[i].value;
331                 }
332                 document.location = location;
333             } else {
334                 alert(_("No serials selected"));
335             }
336         }
337
338         function generateNext(subscriptionid) {
339             if(confirm(_("Do you really want to generate next serial?"))){
340                 document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid;
341             }
342         }
343
344         $(document).ready(function() {
345             $('#subscription_years').tabs();
346             $(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, {
347                 "aoColumnDefs": [
348                     { "aTargets": [ 0,-1 ], "bSortable": false, "bSearchable": false }
349                 ],
350                 "aaSorting": [[0, 'desc']],
351                 "sDom": 't',
352                 "bAutoWidth": false,
353                 "bPaginate": false,
354                 "bInfo": false,
355                 "bFilter": false,
356             } ));
357
358             $(".CheckAll").on("click", function(e){
359                 e.preventDefault();
360                 var years = $(this).data("year");
361                 $("#subscription-year-" + years + " input:checkbox").prop("checked", true );
362             });
363
364             $(".CheckNone").on("click", function(e){
365                 e.preventDefault();
366                 var years = $(this).data("year");
367                 $("#subscription-year-" + years + " input:checkbox").prop("checked", false );
368             });
369
370             $(".generatenext").on("click", function(e){
371                 e.preventDefault();
372                 var subscriptionid = $(this).data("subscriptionid");
373                 generateNext( subscriptionid );
374             });
375
376             $(".subscription_renew").on("click", function(e){
377                 e.preventDefault();
378                 var subscriptionid = $(this).data("subscriptionid");
379                 popup( subscriptionid );
380             });
381
382             $(".print_list").on("click", function(e){
383                 e.preventDefault();
384                 var url = $(this).attr("href");
385                 window.open( url,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
386             });
387
388             $('#multi_receiving').on('show', function () {
389                $(this).find(".modal-body").html($(".serials_multi_receiving")[0].outerHTML);
390             });
391
392             $("form[name='edition']").on('submit', function(e){
393                 if ( $(this).find("input[name='serialid']:checked").size() == 0 ) {
394                     e.preventDefault();
395                     alert(_("You must select at least one serial to edit"));
396                     return 0;
397                 }
398                 return 1;
399             });
400
401             $(".delete-issues").on("click", function(e){
402                 e.preventDefault();
403                 deleteIssues("[% subscriptionidlist | html %]");
404             });
405         });
406
407     </script>
408 [% END %]
409
410 [% INCLUDE 'intranet-bottom.inc' %]