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