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