Bug 23126: Display multi-line entries in subscrpitions correctly
[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 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Serial collection information for  <i>[% bibliotitle | html %]</i></div>
17
18 <div class="main container-fluid">
19     <div class="row">
20         <div class="col-sm-10 col-sm-push-2">
21             <main>
22
23     [% INCLUDE 'modals/serials_multi_receiving.inc' %]
24
25 [% UNLESS ( popup ) %]
26         [% INCLUDE 'serials-toolbar.inc' %]
27
28         <h1>Serial collection information for  <i>[% bibliotitle | html %]</i>
29         [% IF location %] ([% AuthorisedValues.GetByCode( 'LOC', location ) | html %]) [% END %]
30                 [% IF ( callnumber ) %]callnumber: [% callnumber | html %][% END %]</h1>
31 [% END %]
32
33 [% IF ( subscriptions ) %]
34 <table>
35 [% IF ( subscriptions.size == 1 ) %]
36 <caption> Subscription summary</caption>
37 [% ELSE %]
38 <caption> Subscription summaries</caption>
39 [% END %]
40 <tr>
41   <th>Subscription num.</th>
42   <th>Frequency</th>
43   <th>Numbering pattern</th>
44   <th>Library</th>
45   <th>Call number</th>
46   <th>Notes</th>
47   <th>&nbsp;</th>
48 </tr>
49 [% FOREACH subscription IN subscriptions %]
50     <tr>
51         <td><a href="subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | uri %]"># [% subscription.subscriptionid | html %]</a> </td>
52         <td>[% subscription.frequency.description | html %]</td>
53         <td>[% subscription.numberpattern.label | html %]</td>
54         <td>[% IF subscription.branchcode %][% Branches.GetName( subscription.branchcode ) | html %][% END %]</td>
55         <td> [% subscription.callnumber | html %]</td>
56         <td> [% subscription.notes | html | html_line_break %]
57             [% UNLESS subscription.closed %]
58                 [% IF ( subscription.subscriptionexpired ) %]
59                     <br /><span class="problem"> Subscription expired</span>
60                 [% END %]
61             [% ELSE %]
62                 <br /> Subscription closed
63             [% END %]
64         </td>
65         [% IF ( subscription.abouttoexpire ) || ( subscription.subscriptionexpired ) %]<td class="problem actions">[% ELSE %]<td class="actions">[% END %]
66         [% UNLESS subscription.closed %]
67             [% IF ( routing && CAN_user_serials_routing ) %]
68                 [% IF ( subscription.hasRouting ) %]
69                     <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>
70                 [% ELSE %]
71                     <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>
72                 [% END %]
73             [% END %]
74             [% IF ( subscription.abouttoexpire ) %]<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscription.subscriptionid | html %]" onclick="popup([% subscription.subscriptionid | html %]); return false;"><i class="fa fa-refresh"></i> Renew</a>
75             [% ELSE %]
76                 [% IF ( subscription.subscriptionexpired ) %]<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscription.subscriptionid | html %]" onclick="popup([% subscription.subscriptionid | html %]); return false;"><i class="fa fa-refresh"></i> Renew</a>
77                 [% ELSE %]
78                     &nbsp;
79                 [% END %]
80             [% END %]
81         [% ELSE %]
82             &nbsp;
83         [% END %]
84         </td>
85       </tr>
86 [% END %]
87 [% IF ( subscr ) %]
88 [% IF ( subscriptioncount > 1 ) %]
89 <tr ><td colspan="8">  <a href="serials-collection.pl?biblionumber=[% biblionumber | uri %]">See any subscription attached to this biblio</a></td>
90 </tr>
91 [% END %]
92 [% END %]
93 </table>
94 [% END %]
95
96
97 [% IF ( years ) %]<form name="edition" action="serials-edit.pl" method="post">
98 <div id="subscription_years" class="toptabs numbered">
99 <ul>
100         [% FOREACH year IN years %]
101         [% IF ( year.year ) %]
102             [% IF year.year == 'manage' %]
103                 <li><a href="#subscription-year-manage">Manage</a></li>
104             [% ELSE %]
105                 <li><a href="#subscription-year-[% year.year | uri %]">[% year.year | html %]</a></li>
106             [% END %]
107         [% END %]
108     [% END %]
109 </ul>
110
111  [% FOREACH year IN years %]
112 <div id="subscription-year-[% year.year | html %]">
113     [% IF ( CAN_user_serials_receive_serials ) %]
114         <p>
115             <div class="btn-group"><input type="submit" value="Edit serials" class="btn btn-default btn-sm" /></div>
116             [% UNLESS subscription.closed %]
117                 <div class="btn-group"><input type="button" value="Generate next" onclick="javascription:generateNext([% subscriptionidlist | html %])" class="btn btn-default btn-sm" /></div>
118                 [% IF ( subscriptions.size == 1 and !serialsadditems ) %]&nbsp;
119                     <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
120                 [% END %]
121             [% END %]
122         </p>
123     [% END %]
124       <span class="checkall">
125         <a class="CheckAll" href="#" onclick="CheckAll('subscription-year-[% year.year | html %]'); return false;">Select all</a>
126       </span> |
127       <span class="clearall">
128         <a class="CheckNone" href="#" onclick="CheckNone('subscription-year-[% year.year | html %]'); return false;">Clear all</a>
129       </span>
130         <table class="subscription-year-table">
131           <thead>
132             <tr>
133                 [% IF ( CAN_user_serials_receive_serials ) %]<th>Edit</th>[% END %]
134 [% IF ( subscriptions.size > 1 ) %]
135                 <th># Subs</th>
136 [% END %]
137                 <th class="title-string">Date published
138                 </th>
139                 <th class="title-string">Date published (text)
140                 </th>
141                 <th class="title-string">Date received
142                 </th>
143                 <th>Number
144                 </th>
145                 <th>Status
146                 </th>
147                 <th>Notes
148                 </th>
149                 <th>Library
150                 </th>
151                 [% IF ( routing ) %]<th>Routing</th>[% END %]
152             </tr>
153           </thead>
154           <tbody>
155       [% FOREACH serial IN year.serials %]
156         <tr>
157             [% IF ( CAN_user_serials_receive_serials ) %]
158                 <td>
159                   [% UNLESS CAN_user_serials_receive_serials %]
160                     disabled
161                   [% ELSE %]
162                     [% IF ( serial.subscriptionexpired ) %]
163                     <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" />
164                     [% ELSE %]
165                       [% IF ( serial.checked ) %]
166                     <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid | html %]" />
167                       [% ELSE %]
168                     <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" />
169                       [% END %]
170                     [% END %]
171                   [% END %]
172                 </td>
173             [% END %]
174 [% IF ( subscriptions.size > 1 ) %]
175                  <td><a href="serials-collection.pl?subscriptionid=[% serial.subscriptionid | uri %]">[% serial.subscriptionid | html %]</a></td>
176 [% END %]
177                 <td>
178                     <span title="[% serial.publisheddate | html %]">
179                       [% IF serial.publisheddate %]
180                         [% serial.publisheddate | $KohaDates %]
181                       [% ELSE %]
182                         Unknown
183                       [% END %]
184                     </span>
185                 </td>
186                 <td>
187                    [% IF serial.publisheddatetext %]
188                       <span title="[% serial.publisheddatetext | html %]">
189                         [% serial.publisheddatetext | html %]
190                       </span>
191                    [% END %]
192                 </td>
193                 <td>
194                     <span title="[% serial.planneddate | html %]">
195                       [% IF serial.planneddate %]
196                         [% serial.planneddate | $KohaDates %]
197                       [% ELSE %]
198                         Unknown
199                       [% END %]
200                     </span>
201                 </td>
202                 <td>
203                     [% IF ( matches = serial.serialseq.match('(.*)Spring(.*)') ) %]
204                         [% matches.0 | html %]Spring[% matches.1 | html %]
205                     [% ELSIF ( matches = serial.serialseq.match('(.*)Summer(.*)') ) %]
206                         [% matches.0 | html %]Summer[% matches.1 | html %]
207                     [% ELSIF ( matches = serial.serialseq.match('(.*)Fall(.*)') ) %]
208                         [% matches.0 | html %]Fall[% matches.1 | html %]
209                     [% ELSIF ( matches = serial.serialseq.match('(.*)Winter(.*)') ) %]
210                         [% matches.0 | html %]Winter[% matches.1 | html %]
211                     [% ELSIF ( matches = prediction.number.match('(.*)Spr(.*)') ) %]
212                         [% matches.0 | html %]Spr[% matches.1 | html %]
213                     [% ELSIF ( matches = prediction.number.match('(.*)Sum(.*)') ) %]
214                         [% matches.0 | html %]Sum[% matches.1 | html %]
215                     [% ELSIF ( matches = prediction.number.match('(.*)Fal(.*)') ) %]
216                         [% matches.0 | html %]Fal[% matches.1 | html %]
217                     [% ELSIF ( matches = prediction.number.match('(.*)Win(.*)') ) %]
218                         [% matches.0 | html %]Win[% matches.1 | html %]
219                     [% ELSE %]
220                         [% serial.serialseq | html %]
221                     [% END %]
222                 </td>
223                 <td>
224                     [% IF ( serial.status1 ) %]Expected[% END %]
225                     [% IF ( serial.status2 ) %]Arrived[% END %]
226                     [% IF ( serial.status3 ) %]Late[% END %]
227                     [% IF ( serial.status4 ) %]Missing[% END %]
228                     [% IF ( serial.status41 ) %]Missing (never received)[% END %]
229                     [% IF ( serial.status42 ) %]Missing (sold out)[% END %]
230                     [% IF ( serial.status43 ) %]Missing (damaged)[% END %]
231                     [% IF ( serial.status44 ) %]Missing (lost)[% END %]
232                     [% IF ( serial.status5 ) %]Not issued[% END %]
233                     [% IF ( serial.status6 ) %]Delete[% END %]
234                     [% IF ( serial.status7 ) %]Claimed[% END %]
235                     [% IF ( serial.status8 ) %]Stopped[% END %]
236                 </td>
237                 <td>
238                     [% serial.notes | html %]
239                 </td>
240                 <td>
241                     [% Branches.GetName( serial.branchcode ) | html %]
242                 </td>
243                 [% IF ( routing ) %]
244                 <td class="actions">
245                     <a href="" onclick="print_slip([% serial.subscriptionid | html %], '[% serial.serialseq.replace("'", "\\'") | html %] ([% serial.publisheddate | $KohaDates %])'); return false" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print list</a>
246                 </td>
247                 [% END %]
248             </tr>
249           [% END %]
250         </tbody>
251       </table>
252     </div>
253     [% END %]
254   <input type="hidden" name="subscriptionid" value="[% subscriptionidlist | html %]" />
255
256 </div>
257 </form>
258 [% END %]
259
260             </main>
261         </div> <!-- /.col-sm-10.col-sm-push-2 -->
262
263         <div class="col-sm-2 col-sm-pull-10">
264             <aside>
265                 [% INCLUDE 'serials-menu.inc' %]
266             </aside>
267         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
268      </div> <!-- /.row -->
269
270 [% MACRO jsinclude BLOCK %]
271     [% INCLUDE 'datatables.inc' %]
272     <script>
273         var subscriptionid = "[% subscriptionid | html %]";
274         var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
275         var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
276         var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
277     </script>
278     [% Asset.js("js/serials-toolbar.js") | $raw %]
279     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
280
281     <script>
282
283         function print_slip(subscriptionid,issue){
284             var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
285             window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
286         }
287
288         function popup(subscriptionid) {
289             newin=window.open('subscription-renew.pl?mode=popup&subscriptionid='+subscriptionid,'popup','width=500,height=400,toolbar=false,scrollbars=yes');
290         }
291
292         function generateNext(subscriptionid) {
293             if(confirm(_("Do you really want to generate next serial?"))){
294                 document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid;
295             }
296         }
297
298         function CheckAll( node ) {
299             $("#"+node).checkCheckboxes();
300             return false;
301         }
302         function CheckNone( node ) {
303             $("#"+node).unCheckCheckboxes();
304             return false;
305         }
306         $(document).ready(function() {
307             $('#subscription_years').tabs();
308             $(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, {
309                 "aoColumnDefs": [
310                     { "aTargets": [ 0,-1 ], "bSortable": false, "bSearchable": false },
311                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
312                 ],
313                 "aaSorting": [[0, 'desc']],
314                 "sDom": 't',
315                 "bAutoWidth": false,
316                 "bPaginate": false,
317                 "bInfo": false,
318                 "bFilter": false,
319             } ));
320
321             $('#multi_receiving').on('show', function () {
322                $(this).find(".modal-body").html($(".serials_multi_receiving")[0].outerHTML);
323             });
324
325             $("form[name='edition']").on('submit', function(e){
326                 if ( $(this).find("input[name='serialid']:checked").size() == 0 ) {
327                     e.preventDefault();
328                     alert(_("You must select at least one serial to edit"));
329                     return 0;
330                 }
331                 return 1;
332             });
333         });
334
335     </script>
336 [% END %]
337
338 [% INCLUDE 'intranet-bottom.inc' %]