Bug 21511: Don't show acquisition details on subscription detail when there is no...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / subscription-detail.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Branches %]
6 [% USE AuthorisedValues %]
7 [% USE Price %]
8 [% USE ColumnsSettings %]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>Koha &rsaquo; Serials &rsaquo; Details for subscription #[% subscriptionid | html %]</title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 [% Asset.css("css/datatables.css") | $raw %]
14 </head>
15
16 <body id="ser_subscription-detail" class="ser">
17 [% INCLUDE 'header.inc' %]
18 [% INCLUDE 'serials-search.inc' %]
19
20 <div id="breadcrumbs">
21     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
22     &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a>
23     [% UNLESS blocking_error %]&rsaquo; Details for subscription #[% subscriptionid | html %][% END %]
24 </div>
25
26 <div class="main container-fluid">
27     <div class="row">
28         <div class="col-sm-10 col-sm-push-2">
29             <main>
30
31         [% INCLUDE 'serials-toolbar.inc' %]
32
33     <h1>Subscription for [% bibliotitle | html %] [% IF closed %](closed)[% END %]</h1>
34     [% IF ( abouttoexpire ) %]
35       [% UNLESS closed %]
36         <div class="dialog message">Subscription will expire [% enddate | html %]. <a href="#" id="renewsub">Renew this subscription</a>.</div>
37       [% END %]
38     [% END %]
39     [% IF ( NEEDSCONFIRMATION ) %]
40     <div id="circ_needsconfirmation" class="dialog alert">
41         <h3>Please confirm subscription deletion</h3>
42
43                         <ul>
44                         [% IF ( NOTEXPIRED ) %] <li>The subscription has not expired yet</li> [% END %] 
45                         [% IF ( LINKEDISSUES ) %] <li>The subscription has linked issues</li> [% END %]
46                         [% IF ( LINKEDITEMS ) %] <li>The subscription has linked items<br /> Those items won't be deleted</li> [% END %]
47                         </ul>
48                         <form method="post" action="/cgi-bin/koha/serials/subscription-detail.pl">
49                         <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
50                         <input type="hidden" name="issueconfirmed" value="1" />
51                         <input type="hidden" name="op" value="del" />
52             <button type="submit" class="approve" accesskey="y"><i class="fa fa-fw fa-check"></i> Yes, delete (Y)</button>
53                         </form>
54                         <form method="get" action="/cgi-bin/koha/serials/subscription-detail.pl">
55                         <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
56             <button type="submit" class="deny" accesskey="n"><i class="fa fa-fw fa-remove"></i> No, don't delete (N)</button>
57                         </form>
58
59         </div>
60         [% END %] <!-- NEEDSCONFIRMATION -->
61
62 <div id="subscription_description" class="toptabs">
63 <ul class="ui-tabs-nav">
64     <li><a href="#subscription_info">Information</a></li>
65     <li><a href="#subscription_planning">Planning</a></li>
66     <li><a href="#subscription_issues">Issues</a></li>
67     <li><a href="#subscription_summary">Summary</a></li>
68     [% IF order_count %]
69         <li>
70             <a href="#acquisition_details">Acquisition details</a>
71         </li>
72     [% END %]
73 </ul>
74
75 <div id="subscription_info">
76     <div class="row">
77     <div class="col-sm-6">
78     <div class="rows">
79                 <ol>
80                 <li><span class="label">Subscription ID: </span>[% subscriptionid | html %]</li>
81         <li><span class="label">Librarian identity:</span> [% librarian | html %]</li>
82         <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid | html %]">[% aqbooksellername | html %]</a></li>
83         <li><span class="label">Biblio:</span>  <a href="/cgi-bin/koha/catalogue/[% default_bib_view | html %].pl?biblionumber=[% bibnum | html %]">[% bibliotitle | html %]</a> <i>([% bibnum | html %])</i></li>
84         [% IF ( OPACBaseURL ) %]
85             <li>
86                 <span class="label">OPAC view:</span>
87                 <a id="view-subscription-in-opac" target="_blank" href="[% Koha.Preference('OPACBaseURL') | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber | html %]">Open in new window.</a>
88             </li>
89         [% END %]
90 [% IF ( branchcode ) %]<li><span class="label">Library:</span> [% Branches.GetName( branchcode ) | html %]</li>[% END %]
91         [% IF ( serialsadditems ) %]
92             <li><span class="label">Items:</span> Serial receipt creates an item record.</li>
93         [% ELSE %]
94             <li><span class="label">Items:</span> Serial receipt does not create an item record.</li>
95         [% END %]
96         <li>
97             <span class="label">Serial number:</span>
98             [% IF skip_serialseq %]
99                 Serial number is skipped when an irregularity is found.
100             [% ELSE %]
101                 Serial number is kept when an irregularity is found.
102             [% END %]
103         </li>
104         <li><span class="label">Grace period:</span> [% graceperiod | html %]</li>
105         </ol>
106     </div>
107     </div>
108     <div class="col-sm-6">
109     <div class="rows">
110         <ol>
111         [% IF ( location ) %]<li><span class="label">Location:</span> [% location | html %]</li>[% END %]
112         [% IF ( callnumber ) %]<li><span class="label">Call number:</span> [% callnumber | html %]</li>[% END %]
113                 [% IF ( staffdisplaycount ) %]<li><span class="label">Number of issues to display to staff:</span>[% staffdisplaycount | html %]</li>[% END %]
114         [% IF ( opacdisplaycount ) %]<li><span class="label">Number of issues to display in OPAC:</span>[% opacdisplaycount | html %]</li>[% END %]
115         [% IF ( letter ) %]
116             <li>
117                 <span class="label">Patron notification:</span> [% letter | html %]
118                 (<a href="/cgi-bin/koha/serials/viewalerts.pl?subscriptionid=[% subscriptionid | html %]">subscribers</a>)
119             </li>
120         [% END %]
121         [% IF ( hasRouting ) %]<li><span class="label">Routing:</span> yes</li>[% END %]
122      </ol>
123      </div>
124      </div>
125      </div>
126
127     [% IF additional_fields_for_subscription %]
128     <hr>
129     <div class="row">
130       <div class="col-sm-6">
131         <h3>Additional fields:</h3>
132         <div class="rows">
133           <ol>
134             [% FOR field IN additional_fields_for_subscription %]
135               <li>
136                 <span class="label">[% field.name | html %]:</span>
137                 [% IF field.authorised_value_category %]
138                   [% AuthorisedValues.GetByCode( field.authorised_value_category, additional_fields.${field.name} ) | html %]
139                 [% ELSE %]
140                   [% additional_fields.${field.name} | html %]
141                 [% END %]
142               </li>
143             [% END %]
144           </ol>
145         </div>
146       </div>
147       </div>
148      [% END %]
149 </div>
150
151     <div id="subscription_planning">
152     <div class="row">
153     <div class="col-sm-12">
154     <div class="rows">
155         <ol>
156             <li><span class="label">Beginning date:</span> [% startdate | html %]
157             </li>
158             <li><span class="label">Frequency:</span>
159                 [% frequency.description | html %]
160             </li>
161             <li>
162               <span class="label">Manual history: </span>
163                 [% IF ( manualhistory ) %]
164                     Enabled <a href="/cgi-bin/koha/serials/subscription-history.pl?subscriptionid=[% subscriptionid | html %]">Edit history</a>
165                 [% ELSE %]
166                     Disabled
167                 [% END %]
168             </li>
169             <li><span class="label">Number pattern:</span>
170                 [% numberpattern.label | html %]
171             </li>
172             <li><table>
173             <tr>
174                 <td>Starting with:</td>
175                 [% IF (has_X) %]
176                     <td align="center">[% lastvalue1 | html %]</td>
177                 [% END %]
178                 [% IF (has_Y) %]
179                     <td align="center">[% lastvalue2 | html %]</td>
180                 [% END %]
181                 [% IF (has_Z) %]
182                     <td align="center">[% lastvalue3 | html %]</td>
183                 [% END %]
184             </tr>
185             <tr>
186                 <td>Rollover:</td>
187                 [% IF (has_X) %]
188                     <td align="center">[% numberpattern.whenmorethan1 | html %]</td>
189                 [% END %]
190                 [% IF (has_Y) %]
191                     <td align="center">[% numberpattern.whenmorethan2 | html %]</td>
192                 [% END %]
193                 [% IF (has_Z) %]
194                     <td align="center">[% numberpattern.whenmorethan3 | html %]</td>
195                 [% END %]
196             </tr>
197             </table></li>
198             [% IF ( irregular_issues ) %]
199             <li><span class="label">Irregularity:</span> [% irregular_issues | html %] issues
200             </li>
201             [% END %]
202             <li><span class="label">First arrival:</span> [% firstacquidate | html %]
203             </li>
204         [% IF ( numberlength ) %]<li><span class="label">Number of issues:</span> [% numberlength | html %]</li>[% END %]
205         [% IF ( weeklength ) %]<li><span class="label">Number of weeks:</span> [% weeklength | html %]</li>[% END %]
206         [% IF ( monthlength ) %]<li><span class="label">Number of months:</span> [% monthlength | html %]</li>[% END %]
207         </ol>
208     </div>
209     </div>
210     </div>
211     </div>
212     <div id="subscription_numbering" style="display:none;">
213         <h3>Numbering calculation</h3>
214         <p><label>Numbering formula:</label> [% numberingmethod | html %]</p>
215         <table>
216             <tr>
217                 <th>&nbsp;</th>
218                 <th>X</th>
219                 <th>Y</th>
220                 <th>Z</th>
221                 </tr>
222                 <tr>
223                     <td>Add</td>
224                     <td>
225                         [% add1 | html %]
226                     </td>
227                     <td>
228                         [% add2 | html %]
229                     </td>
230                     <td>
231                         [% add3 | html %]
232                     </td>
233                 </tr>
234                 <tr>
235                     <td>once every</td>
236                     <td>[% every1 | html %]</td>
237                     <td>[% every2 | html %]</td>
238                     <td>[% every3 | html %]</td>
239                 </tr>
240                 <tr>
241                     <td>When more than</td>
242                     <td>[% whenmorethan1 | html %] [% IF ( innerloop1 ) %]<br />
243                         <i>(is [% innerloop1 | html %])</i>[% END %]</td>
244                     <td>[% whenmorethan2 | html %] [% IF ( innerloop2 ) %]<br />
245                         <i>(is [% innerloop2 | html %])</i>[% END %]</td>
246                     <td>[% whenmorethan3 | html %] [% IF ( innerloop3 ) %]<br />
247                         <i>(is [% innerloop3 | html %])</i>[% END %]</td>
248                 </tr>
249                 <tr>
250                     <td>Set back to</td>
251                     <td>[% setto1 | html %]</td>
252                     <td>[% setto2 | html %]</td>
253                     <td>[% setto3 | html %]</td>
254                 </tr>
255                 <tr>
256                     <td>
257                             Inner counter
258                     </td>
259                     <td>[% innerloop1 | html %]</td>
260                     <td>[% innerloop2 | html %]</td>
261                     <td>[% innerloop3 | html %]</td>
262                 </tr>
263                 <tr>
264                     <td>
265                             Last value
266                     </td>
267                     <td>[% lastvalue1 | html %]</td>
268                     <td>[% lastvalue2 | html %]</td>
269                     <td>[% lastvalue3 | html %]</td>
270                 </tr>
271             </table>
272     </div>
273     <div id="subscription_issues">
274         <table>
275         <tr>
276             <th>Issue number</th>
277             <th>Planned date</th>
278             <th>Published date</th>
279             <th>Published date (text)</th>
280             <th>Status</th>
281         </tr>
282         [% FOREACH serialslis IN serialslist %]
283             <tr>
284                 <td>
285                     [% serialslis.serialseq | html %]
286                 </td>
287                 <td>
288                     [% IF serialslis.planneddate %]
289                       [% serialslis.planneddate | html %]
290                     [% ELSE %]
291                       Unknown
292                     [% END %]
293                 </td>
294                 <td>
295                     [% IF serialslis.publisheddate %]
296                       [% serialslis.publisheddate | html %]
297                     [% ELSE %]
298                       Unknown
299                     [% END %]
300                 </td>
301                 <td>
302                     [% serialslis.publisheddatetext | html %]
303                 </td>
304                 <td>
305                     [% IF ( serialslis.status1 ) %]Expected[% END %]
306                     [% IF ( serialslis.status2 ) %]Arrived[% END %]
307                     [% IF ( serialslis.status3 ) %]Late[% END %]
308                     [% IF ( serialslis.status4 ) %]Missing[% END %]
309                     [% IF ( serialslis.status41 ) %]Missing (never received)[% END %]
310                     [% IF ( serialslis.status42 ) %]Missing (sold out)[% END %]
311                     [% IF ( serialslis.status43 ) %]Missing (damaged)[% END %]
312                     [% IF ( serialslis.status44 ) %]Missing (lost)[% END %]
313                     [% IF ( serialslis.status5 ) %]Not issued[% END %]
314                     [% IF ( serialslis.status6 ) %]Delete[% END %]
315                     [% IF ( serialslis.status7 ) %]
316                       Claimed
317                       [% IF ( serialslis.claimdate ) %]
318                         [% serialslis.claimdate | html %]
319                       [% END %]
320                     [% END %]
321                     [% IF ( serialslis.status8 ) %]Stopped[% END %]
322                 </td>
323             </tr>
324         [% END %]
325         </table>
326     </div>
327     <div id="subscription_summary">
328     <div class="row">
329     <div class="col-sm-12">
330     <div class="rows">
331         <ol>
332             <li><span class="label">Start date:</span> [% startdate | html %] </li>
333             <li><span class="label">End date:</span> [% enddate | html %]</li>
334             <li><span class="label">History start date:</span> [% histstartdate | html %] </li>
335             <li><span class="label">History end date:</span> [% histenddate | html %]</li>
336             <li><span class="label">Received issues:</span>[% recievedlist | html %]</li>
337             <li><span class="label">Missing issues:</span>[% missinglist | html %]</li>
338             <li><span class="label">Nonpublic note:</span>[% internalnotes FILTER html_line_break | html %]</li>
339             <li><span class="label">Public note:</span>[% notes FILTER html_line_break | html %]</li>
340             <li><span class="label">History staff note:</span>[% librariannote FILTER html_line_break | html %]</li>
341             <li><span class="label">History OPAC note:</span>[% opacnote FILTER html_line_break | html %]</li>
342         </ol>
343     </div>
344     </div>
345     </div>
346     </div>
347
348     [% IF order_count %]
349         <div id="acquisition_details">
350             <h2>Acquisition details</h2>
351             <table id="orders">
352                 <caption>
353                   <span class="actions">
354                   <a href="#" id="hide_received_orders">Hide already received orders</a>
355                   | <a href="#" id="show_all_orders">Show all orders</a></span>
356                 </caption>
357
358                 <thead>
359                     <tr>
360                         <th>Invoice</th>
361                         <th>Basket</th>
362                         <th>Order number</th>
363                         <th class="title-string">Creation date</th>
364                         <th class="title-string">Receive date</th>
365                         <th class="title-string">Status</th>
366                         <th>Internal note</th>
367                         <th>Vendor note</th>
368                         <th>Fund</th>
369                         <th title="ecost tax exc. / ecost tax inc.">Ordered</th>
370                         <th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th>
371                     </tr>
372                 </thead>
373                 <tbody>
374                 [% FOR order IN orders %]
375                     <tr>
376                         <td>
377                         [% IF order.invoice %]
378                             [% IF CAN_user_acquisition %]
379                                 <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid | html %]" title="Invoice detail page">
380                                    [% order.invoice.invoicenumber | html %]</a>
381                             [% ELSE %]
382                                 [% order.invoice.invoicenumber | html %]
383                             [% END %]
384                         [% END %]
385                         </td>
386                         <td>[% IF CAN_user_acquisition_order_manage %]
387                             <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]">[% order.basket.basketname | html %] ([% order.basketno | html %])</a>
388                         [% ELSE %]
389                             [% order.basket.basketname | html %] ([% order.basketno | html %])
390                         [% END %]</td>
391                         <td>[% order.ordernumber | html %]</td>
392                         <td><span title="[% order.basket.creationdate | uri %]">[% order.basket.creationdate | $KohaDates%]</span></td>
393                         <td>[% IF order.datereceived %]<span title="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates %]</span>[% END %]</td>
394                         <td>
395                           [% SWITCH order.orderstatus %]
396                             [% CASE 'new' %]<span title="status_1">New</span>
397                             [% CASE 'ordered' %]<span title="status_2">Ordered</span>
398                             [% CASE 'partial' %]<span title="status_3">Partial</span>
399                             [% CASE 'complete' %]<span title="status_4">Complete</span>
400                             [% CASE 'cancelled' %]<span title="status_5">Cancelled</span>
401                           [% END %]
402                         </td>
403                         <td>[% order.order_internalnote | html %]</td>
404                         <td>[% order.order_vendornote | html %]</td>
405                         <td>[% order.fund.budget_name | html %]</td>
406                         <td>
407                             [% UNLESS order.datereceived %]
408                                 [% order.ecost_tax_excluded | $Price %] / [% order.ecost_tax_included | $Price %]
409                             [% END %]
410                         </td>
411                         <td>
412                             [% IF order.datereceived %]
413                                 [%# FIXME What if unitprice has not been filled? %]
414                                 [% order.unitprice_tax_excluded | $Price %] / [% order.unitprice_tax_included | $Price %]
415                             [% END %]
416                         </td>
417                     </tr>
418                 [% END %]
419                 </tbody>
420             </table>
421           </div>
422       [% END %]
423
424             </main>
425         </div> <!-- /.col-sm-10.col-sm-push-2 -->
426
427         <div class="col-sm-2 col-sm-pull-10">
428             <aside>
429                 [% INCLUDE 'serials-menu.inc' %]
430             </aside>
431         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
432      </div> <!-- /.row -->
433
434 [% MACRO jsinclude BLOCK %]
435     <script>
436         var subscriptionid = "[% subscriptionid | html %]";
437         var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
438         var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
439         var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
440     </script>
441     [% Asset.js("js/serials-toolbar.js") | $raw %]
442     [% INCLUDE 'datatables.inc' %]
443     [% INCLUDE 'columns_settings.inc' %]
444     <script>
445         // the english words used in display purposes
446         var text = new Array(_("Number"),_("Volume"),_("Issue"),_("Month"),_("Week"),_("Starting with:"),_("Rollover at:"),_("Choose Hemisphere:"),_("Northern"),_("Southern",
447         "Autumn"),_("Winter"),_("Spring"),_("Summer"),_("Fall"),_("Season"),_("Year"));
448         $(document).ready(function() {
449             $("#subscription_description").tabs();
450             $("#renewsub").click(function(){
451                 popup([% subscriptionid | html %]);
452                 return false;
453             })
454
455             var columns_settings = [% ColumnsSettings.GetColumns( 'serials', 'subscription-detail', 'orders', 'json' ) | $raw %];
456             var table = KohaTable("orders", {
457                 'bPaginate': false,
458                 'bAutoWidth': false,
459                 "aaSorting": [[ 5, "asc" ], [ 2, "desc" ]], // Order by status then ordernumber
460                 "aoColumnDefs": [
461                     { "aTargets": "title-string", "sType": "title-string" }
462                 ]
463             }, columns_settings);
464
465             $("#hide_received_orders").click(function(e){
466                 e.preventDefault();
467                 table.fnFilter( '^$', 4, true ); // Not empty "Receive date" columns
468             });
469             $("#show_all_orders").click(function(e){
470                 e.preventDefault();
471                 table.fnFilter( '', 4 ); // Not filter, display all columns
472             });
473             $("#show_all_orders").click();
474
475
476         });
477     </script>
478 [% END %]
479
480 [% INCLUDE 'intranet-bottom.inc' %]