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