Bug 31082: (QA follow-up) Fix translation - we are in a .tt not in a .js file
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / detail.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE KohaPlugins %]
6 [% USE AuthorisedValues %]
7 [% USE Branches %]
8 [% USE Biblio %]
9 [% USE Price %]
10 [% USE TablesSettings %]
11 [% PROCESS 'i18n.inc' %]
12
13 [% IF Koha.Preference('AmazonAssocTag') %]
14     [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
15 [% ELSE %]
16     [% AmazonAssocTag = '' %]
17 [% END %]
18
19 [% ShowCourseReserves = 0 | html %]
20 [% IF UseCourseReserves %]
21     [% FOREACH item IN itemloop %]
22        [% IF item.course_reserves %]
23            [% FOREACH r IN item.course_reserves %]
24                [% IF r.course.enabled == 'yes' %]
25                    [% ShowCourseReserves = 1 | html %]
26                [% END %]
27            [% END %]
28         [% END %]
29     [% END %]
30 [% END %]
31
32 [% SET plugins_intranet_catalog_biblio_tabs = KohaPlugins.get_plugins_intranet_catalog_biblio_tab({ biblio => biblio, biblio_id => biblionumber }) %]
33
34 [% SET footerjs = 1 %]
35 [% INCLUDE 'doc-head-open.inc' %]
36 <title>
37   [% IF ( unknownbiblionumber ) %]
38     Unknown record
39   [% ELSE %]
40     Details for [% INCLUDE 'biblio-title-head.inc' %]
41   [% END %] &rsaquo; Catalog &rsaquo; Koha
42 </title>
43 [% INCLUDE 'doc-head-close.inc' %]
44 [% Asset.css("lib/Chocolat/css/chocolat.css") | $raw %]
45 </head>
46
47 <body id="catalog_detail" class="catalog">
48
49 [% WRAPPER 'header.inc' %]
50     [% INCLUDE 'cat-search.inc' %]
51 [% END %]
52
53 [% WRAPPER 'sub-header.inc' %]
54     [% WRAPPER breadcrumbs %]
55         [% WRAPPER breadcrumb_item %]
56             <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
57         [% END %]
58
59         [% IF ( unknownbiblionumber ) %]
60             [% WRAPPER breadcrumb_item bc_active= 1 %]
61                 <span>Unknown record</span>
62             [% END %]
63         [% ELSE %]
64             [% WRAPPER breadcrumb_item %]
65                 [% INCLUDE 'biblio-title.inc' link = 1 %]
66             [% END %]
67             [% WRAPPER breadcrumb_item bc_active= 1 %]
68                 <span>Details</span>
69             [% END %]
70         [% END %]
71     [% END #/ WRAPPER breadcrumbs %]
72 [% END #/ WRAPPER sub-header.inc %]
73
74 <div class="main container-fluid">
75     <div class="row">
76         <div class="col-sm-10 col-sm-push-2">
77             <main>
78                 <div class="row">
79
80 [% IF ( unknownbiblionumber ) %]
81   <div class="dialog message">The record you requested does not exist ([% biblionumber | html %]).</div>
82 [% ELSE %]
83
84 [% IntranetCoce    = Koha.Preference('IntranetCoce') %]
85 [% CoceProviders   = Koha.Preference('CoceProviders') %]
86 [% CoceHost        = Koha.Preference('CoceHost') %]
87 [% SyndeticsCovers = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') %]
88
89 [% INCLUDE 'cat-toolbar.inc' %]
90     [% IF decoding_error %]
91         <div>
92            <span class="biberror">
93             There is an error with this bibliographic record, the view may be degraded.</span>
94             <span class="error"><br/> Error: [% decoding_error | html %]</span>
95         </div>
96     [% END %]
97     [% IF analytics_error %]
98         <div>
99            <span class="analytics_error">
100             There was an error searching for analytic records, please see the logs for details.</span>
101         </div>
102     [% END %]
103     [% IF ( ocoins ) %]
104         <!-- COinS / OpenURL -->
105         <span class="Z3988" title="[% ocoins | html %]"></span>
106     [% END %]
107
108     [% IF ( AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
109         <div id="catalogue_detail_biblio" class="col-xs-9">
110     [% ELSE %]
111         <div id="catalogue_detail_biblio" class="col-xs-12">
112     [% END %]
113         <div class="page-section">
114
115         [% XSLTBloc | $raw %]
116
117         [% IF shelves.count %]
118             <span class="results_summary"><span class="label">Lists that include this title: </span>
119             [% FOREACH s IN shelves %]
120                 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a>
121                 [% IF ( loop.last ) %][% ELSE %]|[% END %]
122             [% END %]
123             </span>
124         [% END %]
125         [% IF ( TagsEnabled &&  TagsShowOnDetail &&  TagLoop ) %]
126                 <span class="results_summary"><span class="label">Tags:</span>
127                     [% FOREACH TagLoo IN TagLoop %]
128                         [% IF ( CAN_user_tools_moderate_tags ) %]
129                         <a href="/cgi-bin/koha/tags/list.pl?tag=[% TagLoo.term |uri %]">[% TagLoo.term | html %]</a>
130                         [% ELSE %]
131                         [% TagLoo.term | html %]
132                         [% END %]
133                         <span class="weight">([% TagLoo.weight_total | html %])</span>[% IF ( loop.last ) %][% ELSE %], [% END %]
134                     [% END %]
135                     </span>
136         [% END %]
137         <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber | uri %]&amp;viewas=html" title="MARC" class="previewMARC">Show</a></span>
138         [% IF !item_level_itypes ||  Koha.Preference("BiblioItemtypeInfo") %]
139            <span class="results_summary itemtype"><span class="label">Itemtype:</span>
140           [% IF ( !noItemTypeImages && imageurl ) %]
141               <img src="[% imageurl | html %]" alt="" />
142           [% END %]
143           [% IF ( description ) %]
144               <span class="itypetext">[% description | html %]</span>
145           [% ELSE %]
146               <span class="itypetext">[% itemtype | html %]</span>
147           [% END %]
148           </span>
149         [% END %]
150
151         [% IF ( holdcount ) %]
152             <span class="results_summary">
153                 <span class="label">Holds:</span>
154                 <span class="number_box">
155                     [% IF CAN_user_reserveforothers_place_holds %]
156                         <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber | uri %]">[% holdcount | html %]</a>
157                     [% ELSE %]
158                         <span>[% holdcount | html %]</span>
159                     [% END %]
160                 </span>
161             </span>
162         [% END %]
163
164         [% IF illrequests.count %]
165             <span class="results_summary">
166                 <span class="label">ILL requests:</span>
167                 [% IF CAN_user_ill %]
168                     [% FOREACH ill IN illrequests %]
169                         <a href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% ill.illrequest_id | uri %]">Request [% ill.illrequest_id | html %]</a>[% IF ! loop.last %], [% END %]
170                     [% END %]
171                 [% ELSE %]
172                     [% FOREACH ill IN illrequests %]
173                         <span>Request [% ill.illrequest_id | html %]</span>[% IF ! loop.last %], [% END %]
174                     [% END %]
175                 [% END %]
176             </span>
177         [% END %]
178
179         [% IF ( article_requests_count = Biblio.ArticleRequestsActiveCount( biblionumber ) ) %]
180             <span class="results_summary">
181                 <span class="label">Article requests:</span>
182                 <span class="number_box">
183                     <a href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% biblionumber | uri %]">[% article_requests_count | html %]</a>
184                 </span>
185             </span>
186         [% END %]
187
188         [% IF course_reserves %]
189             <span class="results_summary"><span class="label">Courses that have reserved this title: </span>
190             [% FOREACH c IN course_reserves %]
191                 <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% c.course_id | uri %]">[% c.course.course_name | html %]</a>
192                 [% IF ( loop.last ) %][% ELSE %]|[% END %]
193             [% END %]
194             </span>
195         [% END %]
196         </div> [%# .page-section %]
197
198         [% IF ( AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
199         </div>
200             <div class="col-xs-3 bookcoverimg">
201                 <div id="biblio-cover-slider" class="cover-slider">
202                     [% IF ( LocalCoverImages ) %]
203                         [% IF localimages.count %]
204                             [% FOREACH image IN localimages %]
205                                 <div class="cover-image local-coverimg">
206                                     <a href="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
207                                         <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
208                                     </a>
209                                     <div class="hint">Local cover image</div>
210                                 </div>
211                             [% END %]
212                         [% END %]
213                     [% END %]
214
215                     [% IF ( AmazonCoverImages && normalized_isbn) %]
216                         <div class="cover-image" id="amazon-bookcoverimg">
217                             <a href="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.LZZZZZZZ.jpg" title="Amazon cover image">
218                                 <img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.MZZZZZZZ.jpg" alt="Amazon cover image" data-link="http://www.amazon[% AmazonTld | uri %]/gp/reader/[% normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"/>
219                             </a>
220                             <div class="hint">Image from Amazon.com</div>
221                         </div>
222                     [% END %]
223
224                     [% IF ( IntranetCoce && CoceProviders && normalized_isbn ) %]
225                         [% coce_id = normalized_ean || normalized_isbn %]
226                         <div class="cover-image coce-coverimg">
227                             [% IF ( coce_id ) %]
228                                 <a title="Image from Coce" class="[% coce_id | html %]" id="coce-thumbnail-preview"></a>
229                             [% ELSE %]
230                                 <span class="no-image">No cover image available</span>
231                             [% END %]
232                             <div class="hint">Image from Coce</div>
233                         </div>
234                     [% END %]
235
236                     [% IF ( SyndeticsCovers ) %]
237                         [% IF ( content_identifier_exists ) %]
238                         <div class="cover-image" id="syndetics-bookcoverimg">
239                             <a href="https://secure.syndetics.com/index.aspx?isbn=[% normalized_isbn | url %]/LC.GIF&amp;client=[% Koha.Preference('SyndeticsClientCode') | url %]&amp;type=xw10&amp;upc=[% normalized_upc | url %]&amp;oclc=[% normalized_oclc | url %]" title="Syndetics cover image">
240                                 <img src="https://secure.syndetics.com/index.aspx?isbn=[% normalized_isbn | url %]/[% Koha.Preference('SyndeticsCoverImageSize') | url %].GIF&amp;client=[% Koha.Preference('SyndeticsClientCode') | url %]&amp;type=xw10&amp;upc=[% normalized_upc | url %]&amp;oclc=[% normalized_oclc | url %]" alt="" class="thumbnail" />
241                             </a>
242                             <div class="hint">Image from Syndetics</div>
243                         </div>
244                             [% ELSE %]
245                                 <span class="no-image">No cover image available</span>
246                             [% END %]
247                     [% END %]
248
249                     [% IF Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL') %]
250                         [% SET custom_cover_image_url = biblio.custom_cover_image_url %]
251                         [% IF custom_cover_image_url %]
252                             <div class="cover-image" id="custom-coverimg">
253                                 <a class="custom_cover_image" href="[% custom_cover_image_url | url %]" title="Custom cover image">
254                                     <img id="custom-img" alt="Custom cover image" src="[% custom_cover_image_url | url %]" />
255                                 </a>
256                                 <div class="hint">Custom cover image</div>
257                             </div>
258                         [% END %]
259                     [% END %]
260                 </div> <!-- /.cover-slider -->
261             </div> <!-- /.bookcoverimg.col-xs-3 -->
262         [% ELSE %]
263         </div> <!-- /.col-xs-* -->
264         [% END # /IF ( AmazonCoverImages, etc ) %]
265 </div>
266
267 <div id="bibliodetails" class="toptabs">
268
269 <ul class="nav nav-tabs" role="tablist">
270     [% IF (SeparateHoldings) %]
271         <li role="presentation">
272             <a href="#holdings" aria-controls="holdings" role="tab" data-toggle="tab">[% Branches.GetLoggedInBranchname | html %] holdings ([% itemloop.size() || 0 | html %])</a>
273         </li>
274         <li role="presentation">
275             <a href="#otherholdings"  aria-controls="otherholdings" role="tab" data-toggle="tab">Other holdings ([% otheritemloop.size() || 0 | html %])</a>
276         </li>
277     [% ELSE %]
278         <li role="presentation">
279             <a href="#holdings" aria-controls="holdings" role="tab" data-toggle="tab">Holdings ([% itemloop.size() || 0 | html %])</a>
280         </li>
281     [% END %]
282     [% IF Koha.Preference('EnableItemGroups') %]
283         <li role="presentation">
284             <a href="#item_groups" aria-controls="item_groups" role="tab" data-toggle="tab">Item groups</a>
285         </li>
286     [% END %]
287 [% IF ( MARCNOTES || notes ) %]<li role="presentation"><a href="#description" aria-controls="description" role="tab" data-toggle="tab">Descriptions ([% ( MARCNOTES.size || 1 ) | html %])</a></li>[% END %]
288 [% IF ComponentParts && ComponentParts.size %]<li id="components_tab" role="presentation"><a href="#components"  aria-controls="components" role="tab" data-toggle="tab">Components ([% ComponentParts.size | html %])</a></li>[% END %]
289 [% IF ( subscriptionsnumber ) %]<li role="presentation"><a href="#subscriptions"  aria-controls="subscriptions" role="tab" data-toggle="tab">Subscriptions</a></li>[% END %]
290 [% IF Koha.Preference('AcquisitionDetails') %]<li role="presentation"><a href="#acq_details"  aria-controls="acq_details" role="tab" data-toggle="tab">Acquisition details</a></li>[% END %]
291 [% IF suggestions.count %]<li role="presentation"><a href="#suggestion_details"  aria-controls="suggestion_details" role="tab" data-toggle="tab">Suggestion details</a></li>[% END %]
292 [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li role="presentation"><a href="#editions"  aria-controls="editions" role="tab" data-toggle="tab">Editions</a></li>[% END %][% END %]
293 [% IF ( LocalCoverImages ) %]
294     <li role="presentation">
295         <a href="#images"  aria-controls="images" role="tab" data-toggle="tab">Images ([% localimages.count || 0 | html %])</a>
296     </li>
297 [% END %]
298 [% IF HTML5MediaEnabled && HTML5MediaSets.size %]
299     <li id="media_tab" role="presentation"><a href="#html5media"  aria-controls="html5media" role="tab" data-toggle="tab">Play media</a></li>
300 [% END %]
301 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
302     <li class="NovelistSelect" style="display:none;" role="presentation"><a href="#NovelistSelect"  aria-controls="NovelistSelect" role="tab" data-toggle="tab">NoveList Select</a></li>
303 [% END %]
304 [% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
305     <li role="presentation"><a href="#[% plugins_intranet_catalog_biblio_tab.id | uri %]"  aria-controls="[% plugins_intranet_catalog_biblio_tab.id | uri %]" role="tab" data-toggle="tab">[% plugins_intranet_catalog_biblio_tab.title | html %]</a></li>
306 [% END %]
307 </ul>
308
309 <div class="tab-content">
310 [% items_table_block_iter = 0 %]
311 [% BLOCK items_table %]
312     [% items_table_block_iter = items_table_block_iter + 1 %]
313     <div class="[% tab | html %]_table_table_controls">
314         [% IF (StaffDetailItemSelection) %]
315             | <a href="#" class="SelectAll" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a> |
316             <a href="#" class="ClearAll" data-tab="[% tab | html %]"><i class="fa fa-remove"></i> Clear all</a>
317             <span class="itemselection_actions">
318               | Actions:
319               [% IF CAN_user_tools_items_batchdel %]
320                 <a class="itemselection_action_delete"><i class="fa fa-trash"></i> Delete selected items</a>
321               [% END %]
322               [% IF CAN_user_tools_items_batchmod %]
323                 <a class="itemselection_action_modify"><i class="fa fa-pencil"></i> Modify selected items</a>
324               [% END %]
325               [% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %]
326                 <a class="itemselection_action_item_group_set" href="#"><i class="fa fa-book"></i> Add/move to item group</a>
327                 <a class="itemselection_action_item_group_unset" href="#"><i class="fa fa-unlink"></i> Remove from item group</a>
328               [% END %]
329             </span>
330         [% END %]
331     </div>
332     <table class="items_table" id="[% tab | html %]_table">
333         <thead>
334             <tr>
335                 [% IF (StaffDetailItemSelection) %]<th id="[% tab | html %]_checkbox" data-colname="[% tab | html %]_checkbox" class="NoSort"></th>[% END %]
336                 [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
337                     <th id="[% tab | html %]_cover_image" data-colname="[% tab | html %]_cover_image">Cover image</th>
338                 [% END %]
339                 [% IF ( item_level_itypes ) %]<th id="[% tab | html %]_itype" data-colname="[% tab | html %]_itype">Item type</th>[% END %]
340                 <th id="[% tab | html %]_holdingbranch" data-colname="[% tab | html %]_holdingbranch">Current library</th>
341                 <th id="[% tab | html %]_homebranch" data-colname="[% tab | html %]_homebranch">Home library</th>
342                 [% IF ( itemdata_ccode ) %]<th id="[% tab | html %]_ccode" data-colname="[% tab | html %]_ccode">Collection</th>[% END %]
343                 [% IF Koha.Preference('EnableItemGroups') %]
344                     <th id="[% tab | html %]_item_group" data-colname="[% tab | html %]_item_group">Item group</th>
345                 [% END %]
346                 <th id="[% tab | html %]_itemcallnumber" data-colname="[% tab | html %]_itemcallnumber">Call number</th>
347                 [% IF volinfo %]
348                     <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron">Serial enumeration / chronology</th>
349                 [% END %]
350                 <th id="[% tab | html %]_status" data-colname="[% tab | html %]_status">Status</th>
351                 <th id="[% tab | html %]_lastseen" data-colname="[% tab | html %]_lastseen">Last seen</th>
352                 <th id="[% tab | html %]_issues" data-colname="[% tab | html %]_issues">Checkouts</th>
353                 <th id="[% tab | html %]_renewals" data-colname="[% tab | html %]_renewals">Renewals</th>
354                 <th id="[% tab | html %]_dateaccessioned" data-colname="[% tab | html %]_dateaccessioned">Date accessioned</th>
355                 <th id="[% tab | html %]_datelastborrowed" data-colname="[% tab | html %]_datelastborrowed">Date last borrowed</th>
356                 <th id="[% tab | html %]_barcode" data-colname="[% tab | html %]_barcode">Barcode</th>
357                 [% IF ( itemdata_uri ) %]<th id="[% tab | html %]_uri" data-colname="[% tab | html %]_uri">URL</th>[% END %]
358                 [% IF ( itemdata_copynumber ) %]<th id="[% tab | html %]_copynumber" data-colname="[% tab | html %]_copynumber">Copy number</th>[% END %]
359                 [% IF ( itemdata_stocknumber ) %]<th id="[% tab | html %]_stocknumber" data-colname="[% tab | html %]_stocknumber">Inventory number</th>[% END %]
360                 [% IF materials %]<th id="[% tab | html %]_materials" data-colname="[% tab | html %]_materials">Materials specified</th>[% END %]
361                 [% IF ( itemdata_itemnotes ) %]<th id="[% tab | html %]_itemnotes" data-colname="[% tab | html %]_itemnotes">Public notes</th>[% END %]
362                 [% IF ( itemdata_nonpublicnotes ) %]<th id="[% tab | html %]_itemnotes_nonpublic" data-colname="[% tab | html %]_itemnotes_nonpublic">Non-public notes</th>[% END %]
363                 [% IF ( hostrecords ) %]<th id="[% tab | html %]_hostrecord" data-colname="[% tab | html %]_hostrecord">Host records</th>[% END %]
364                 [% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %]
365                 [% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %]
366                 [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %]
367                 [% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort noExport">&nbsp;</th>[% END %]
368             </tr>
369         </thead>
370         <tbody>
371             [% FOREACH item IN items %]
372                 [% SET date_due = item.object.checkout.date_due %]
373                 <tr id="item_[% item.itemnumber | html %]" data-itemnumber="[% item.itemnumber | html %]" data-duedate="[% date_due | html %]">
374                 [% IF (StaffDetailItemSelection) %]
375                     <td style="text-align:center;vertical-align:middle">
376                         <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
377                     </td>
378                 [% END %]
379                     [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
380                         <td class="cover">
381                             <div class="bookcoverimg">
382                                 <div class="cover-slider">
383                                     [% FOREACH image IN item.cover_images %]
384                                         <div class="cover-image local-coverimg">
385                                             <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
386                                                 <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% item.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
387                                             </a>
388                                         </div>
389                                     [% END %]
390                                 </div>
391                             </div>
392                         </td>
393                     [% END %]
394
395                     [% IF ( item_level_itypes ) %]
396                         <td class="itype">
397                             [% SET itemtype = item.itemtype %]
398                             [% IF !noItemTypeImages && itemtype.image_location('intranet') %]
399                                 <img src="[% itemtype.image_location('intranet') | html %]" alt="[% itemtype.translated_description | html %]" title="[% itemtype.translated_description | html %]" />
400                             [% END %]
401                             <span class="itypedesc itypetext">[% itemtype.translated_description | html %]</span>
402                         </td>
403                     [% END %]
404                     <td class="location">[% UNLESS ( singlebranchmode ) %][% Branches.GetName( item.holdingbranch ) | html %] [% END %]</td>
405                     <td class="homebranch">
406                         <span class="homebranchdesc">[% Branches.GetName(item.homebranch) | html %]</span>
407                         <span class="shelvingloc">
408                         [%# If permanent location is defined, show description or code and             %]
409                         [%# display current location in parentheses. If not, display current location. %]
410                         [%# Note that permanent location is a code, and location may be an authval.    %]
411                             [% SET item_location = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) %]
412                             [% IF item.permanent_location %]
413                                 [% SET permloc_authval = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.permanent_location ) %]
414                                 [% permloc_authval | html %]
415                                 [% IF item_location AND item_location != permloc_authval AND item.location != item.permanent_location %]
416                                     ([% item_location | html %])
417                                 [% END %]
418                             [% ELSE %]
419                                 [% item.location | html %]
420                             [% END %]
421                         </span>
422                     </td>
423                     [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
424                     [% IF Koha.Preference('EnableItemGroups') %]<td class="item_group">[% item.object.item_group.description | html %]</td>[% END %]
425                     <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
426                     [% IF ( volinfo ) %]
427                         [% SET serial = item.serial %]
428                         [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting %]
429                             <td class="enumchron" data-order="[% serial.publisheddate | html %]">
430                         [% ELSE %]
431                             <td class="enumchron">
432                         [% END %]
433                             [% IF ( itemdata_enumchron ) %]
434                                 [% IF item.enumchron && serial.serialseq %]
435                                     <span class="enum">[% item.enumchron | html %]</span>
436                                     [% IF ( serial.serialseq && item.enumchron != serial.serialseq ) %]
437                                         <span class="sep"> -- </span>
438                                         <span class="serialseq">[% serial.serialseq | html %]</span>
439                                     [% END %]
440                                 [% ELSIF item.enumchron %]
441                                     <span class="enum">[% item.enumchron | html %]</span>
442                                 [% ELSIF item.serialseq %]
443                                     <span class="serialseq">[% serial.serialseq | html %]</span>
444                                 [% END %]
445                                 [% IF serial.publisheddate %]
446                                     <span class="pubdate">([% serial.publisheddate | $KohaDates %])</span>
447                                 [% END %]
448                             [% END %]
449                             </span>
450                         </td>
451                     [% END %]
452                     <td class="status">
453
454                         [% IF item.checkout %]
455                           [% IF item.checkout.onsite_checkout %]
456                             <span>Currently in local use
457                           [% ELSE %]
458                             <span class="datedue">Checked out
459                           [% END %]
460                                 [% UNLESS ( item.not_same_branch) %]
461                                   [% IF item.checkout.onsite_checkout %]
462                                     by
463                                   [% ELSE %]
464                                     to
465                                   [% END %]
466                                   [% INCLUDE 'patron-title.inc' patron=item.checkout.patron hide_patron_infos_if_needed=1 %]
467                                 [% END %]
468                                 : due [% date_due | $KohaDates as_due_date => 1 %]
469                             </span>
470                         [% ELSIF ( item.transfer ) %]
471                             [% IF (item.transfer.datesent) %]
472                                 <span class="intransit">In transit from [% Branches.GetName( item.transfer.frombranch ) | html %] to [% Branches.GetName( item.transfer.tobranch ) | html %] since [% item.transfer.datesent | $KohaDates %]</span>
473                             [% ELSE %]
474                                 <span class="transitrequested">Transit pending from [% Branches.GetName( item.transfer.frombranch ) | html %] to [% Branches.GetName( item.transfer.tobranch ) | html %] since [% item.transfer.daterequested | $KohaDates %]</span>
475
476                             [% END %]
477                         [% END %]
478
479                         [% IF ( item.itemlost ) %]
480                             [% IF itemlostloop %]
481                                 [% FOREACH itemlostloo IN itemlostloop %]
482                                     [% IF itemlostloo.authorised_value == item.itemlost %]
483                                         <span class="lost">[% itemlostloo.lib | html %]</span>
484                                     [% END %]
485                                 [% END %]
486                             [% ELSE %]
487                                 <span class="lost">Unavailable (lost or missing)</span>
488                             [% END %]
489                         [% END %]
490
491                         [% IF ( item.withdrawn ) %]
492                             [% IF itemwithdrawnloop %]
493                                 [% FOREACH itemwithdrawnloo IN itemwithdrawnloop %]
494                                     [% IF itemwithdrawnloo.authorised_value == item.withdrawn %]
495                                         <span class="wdn">[% itemwithdrawnloo.lib | html %]</span>
496                                     [% END %]
497                                 [% END %]
498                             [% ELSE %]
499                                 <span class="wdn">Withdrawn</span>
500                             [% END %]
501                         [% END %]
502
503                         [% IF ( item.damaged ) %]
504                             [% IF itemdamagedloop %]
505                                 [% FOREACH itemdamagedloo IN itemdamagedloop %]
506                                     [% IF itemdamagedloo.authorised_value == item.damaged %]
507                                         <span class="dmg">[% itemdamagedloo.lib | html %]</span>
508                                     [% END %]
509                                 [% END %]
510                             [% ELSE %]
511                                 <span class="dmg">Damaged</span>
512                             [% END %]
513                         [% END %]
514
515                         [% IF ( item.notforloan || item.itemtype.notforloan ) %]
516                             <span class="notforloan">Not for loan
517                             [% SET not_for_loan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
518                             [% IF not_for_loan_description %]
519                                 <span class="reason">([% not_for_loan_description | html %])</span>
520                             [% END %]
521                             </span>
522                         [% END %]
523
524                         [% SET hold = item.first_hold %]
525                         [% IF hold %]
526                             [% IF hold.waitingdate %]
527                                 <span class="waitingat">Waiting at [% Branches.GetName( hold.branchcode ) | html %][% IF ( hold.desk_id ) %], [% hold.desk.desk_name | html %][% END %] since [% hold.waitingdate | $KohaDates %].</span>
528                                 [% IF canreservefromotherbranches AND ( hold.waitingdate OR hold.priority == 1 ) %]
529                                     <span class="heldfor">Hold for:</span>
530                                     [% INCLUDE 'patron-title.inc' patron=hold.borrower hide_patron_infos_if_needed=1 %]
531                                 [% END %]
532                             [% ELSE %]
533                                 <span class="holdonitem">There is an item level hold on this item (priority = [% hold.priority | html %]).</span>
534                             [% END %]
535                         [% END %]
536
537                         [% SET recall = item.recall %]
538                         [% IF recall %]
539                             [% IF recall.waiting_date %]
540                                 <span>Waiting at [% Branches.GetName( recall.pickup_library_id ) | html %] since [% recall.waiting_date | $KohaDates %]</span>
541                             [% ELSE %]
542                                 [% patron_link = BLOCK %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% recall.patron_id | uri %]">[% recall.patron.firstname | html %] [% recall.patron.surname | html %] ([% recall.patron.cardnumber | html %])</a>[% END %]
543                                 <span>recalled by [% patron_link| $raw %] on [% recall.created_date | $KohaDates %]</span>
544                             [% END %]
545                         [% END %]
546
547                         [% UNLESS ( item.notforloan || item.itemtype.notforloan || item.onloan || item.itemlost || item.withdrawn || item.damaged || item.transfer || hold || ( Koha.Preference('UseRecalls') && recall ) ) %]
548                             <span>Available</span>
549                         [% END %]
550
551                         [% IF ( item.restricted ) %]
552                             <span class="restricted">([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) | html %])</span>
553                         [% END %]
554
555                         [% IF ( item.bundle_host ) %]
556                             <span class="bundled">In bundle: [% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio link = 1 %]</span>
557                         [% END %]
558
559                     </td>
560                     <td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td>
561                     <td class="issues" data-order="[% item.issues || 0 | html %]">[% item.issues || 0 | html %]</td>
562                     <td class="renewals" data-order="[% item.renewals || 0 | html %]">[% item.renewals || 0 | html %]</td>
563                     <td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td>
564                     <td class="datelastborrowed" data-order="[% item.datelastborrowed | html %]">[% item.datelastborrowed | $KohaDates %]</td>
565                     <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.itemnumber | uri %]&amp;biblionumber=[% item.biblionumber | uri %]&amp;bi=[% item.biblioitemnumber | uri %]#item[% item.itemnumber | uri %]">[% item.barcode | html %]</a></td>
566                     [% IF ( itemdata_uri ) %]
567                         [% IF item.uri.split(' \| ').size > 1 %]
568                             <td class="uri">
569                                 [% FOREACH uri IN item.uri.split(' \| ') %]<a href="[% uri | url %]">[% uri | html %]</a><br>[% END %]
570                             </td>
571                         [% ELSE %]
572                             <td class="uri">
573                                 [% IF item.uri %]
574                                     <a href="[% item.uri | url %]">[% IF Koha.Preference('URLLinkText') %][% Koha.Preference('URLLinkText') | html %][% ELSE %]Link to resource[% END %]</a>
575                                 [% END %]
576                             </td>
577                         [% END %]
578                     [% END %]
579                     [% IF ( itemdata_copynumber ) %]
580                         <td class="copynumber">[% item.copynumber | html %]</td>
581                     [% END %]
582                     [% IF ( itemdata_stocknumber ) %]
583                         <td class="stocknumber">[% item.stocknumber | html %]</td>
584                     [% END %]
585                     [% IF materials %]
586                         <td class="materials"> [% item.materials | html %] </td>
587                     [% END %]
588                     [% IF ( itemdata_itemnotes ) %]
589                         <td><div class="itemnotes">[% item.itemnotes | $raw %]</div></td>
590                     [% END %]
591                     [% IF itemdata_nonpublicnotes %]
592                         <td class="nonpublicnote">[% item.itemnotes_nonpublic | html %]</td>
593                     [% END %]
594                     [% IF ( hostrecords ) %]
595                         <td>[% IF ( item.hostbiblionumber) %]<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.hostbiblionumber | uri %]" >[% item.hosttitle | html %]</a>[% END %]</td>
596                     [% END %]
597                     [% IF ( analyze ) %]
598                         <td>
599                             [% IF ( item.countanalytics ) %]
600                                 <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=[% item.itemnumber | uri %]">[% item.countanalytics | html %] analytics</a>
601                             [% END %]
602                         </td>
603                     [% END %]
604                     [% IF ( analyze ) %]
605                         <td><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=[% item.biblionumber | uri %]&amp;hostitemnumber=[% item.itemnumber | uri %]">Create analytics</a></td>
606                     [% END %]
607
608                 [% IF ShowCourseReserves %]
609                     <td>
610                         [% IF item.course_reserves %]
611                             [% FOREACH r IN item.course_reserves %]
612                                 [% IF r.course.enabled == 'yes' %]
613                                     <p>
614                                       <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% r.course.course_id | uri %]">
615                                          [% r.course.course_name | html %]
616                                          <!--[% IF r.course.course_number %] [% r.course.course_number | html %] [% END %]-->
617                                          [% IF r.course.section %] [% r.course.section | html %] [% END %]
618                                          [% IF r.course.term %] [% AuthorisedValues.GetByCode( 'TERM', r.course.term ) | html %] [% END %]
619                                       </a>
620                                    </p>
621                                [% END %]
622                            [% END %]
623                        [% END %]
624                     </td>
625                 [% END %]
626
627                 [% IF ( SpineLabelShowPrintOnBibDetails ) %]
628                     <td><a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=[% item.barcode | uri %]"><i class="fa fa-print"></i> Print label</a></td>
629                 [% END %]
630
631                 [% IF CAN_user_editcatalogue_edit_items %]
632                     <td class="actions">
633                         [% UNLESS item.cannot_be_edited %]
634                             [% IF Koha.Preference('LocalCoverImages') OR Koha.Preference('OPACLocalCoverImages') %]
635                                 <div class="btn-group">
636                                     <a  class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]#edititem"><i class="fa fa-pencil"></i> Edit</a><a class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
637                                     <ul class="dropdown-menu pull-right">
638                                         <li><a href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=[% item.itemnumber | uri %]&amp;filetype=image"><i class="fa fa-upload"></i> Upload image</a></li>
639                                     </ul>
640                                 </div>
641                             [% ELSE %]
642                                 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]#edititem"><i class="fa fa-pencil"></i> Edit</a>
643                             [% END %]
644                         [% END %]
645                         [% IF bundlesEnabled %]
646                             <button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> Manage bundle ([% item.bundled | html %]|[% item.bundled_lost | html %])</button>
647                         [% END %]
648                     </td>
649                 [% END %]
650                 </tr>
651             [% END %]
652         </tbody>
653     </table>
654
655 [% END %][%# end of block items_table %]
656
657 [% IF Koha.Preference('EnableItemGroups') %]
658     <div role="tabpanel" class="tab-pane" id="item_groups">
659         [% IF CAN_user_editcatalogue_manage_item_groups %]
660             <div class="item_groups_table_table_controls">
661                 <a href="#" class="item-group-create btn btn-default btn-xs"><i class="fa fa-plus"></i> New item group</a>
662             </div>
663         [% END %]
664         <table class="items-group-table" id="items-group-table">
665             <thead>
666                 <tr>
667                     <td>Display order</td>
668                     <td>Description</td>
669                     <td>&nbsp;</td>
670                 </tr>
671             </thead>
672         </table>
673     </div>
674 [% END %]
675
676
677 <div role="tabpanel" class="tab-pane" id="holdings">
678
679 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'above' ) %]
680     <span class="results_summary NovelistSelect" style="display:none;">
681         <span class="label">Novelist Select: </span>
682         <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
683     </span>
684 [% END %]
685
686 [% IF ( count ) %]
687     [% IF ( showncount ) %]
688         [% PROCESS items_table tab="holdings" items=itemloop %]
689         [% END %]
690                 [% IF ( hiddencount ) %]
691                    <p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]&amp;showallitems=1">Show all items ([% hiddencount | html %] hidden)</a>
692                 [% END %]               
693                 [% IF ( debug_display ) %]
694                 <br /><br />
695                 <table>
696                         <tr><td>itemdata_enumchron</td><td>[% itemdata_enumchron | html %]</td></tr>
697                         <tr><td>itemdata_copynumber</td><td>[% itemdata_copynumber | html %]</td></tr>
698                         <tr><td>serial</td><td>[% serial | html %]</td></tr>
699                 </table>
700                 [% END %]
701 [% ELSE %]
702     [% IF ( ALTERNATEHOLDINGS ) %]
703     [% FOREACH ALTERNATEHOLDING IN ALTERNATEHOLDINGS %]
704         <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding | html %]</div>
705     [% END %]
706     [% ELSE %]
707     <div id="noitems">No physical items for this record</div>
708     [% END %]
709 [% END %]
710
711 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'below' ) %]
712     <span class="results_summary NovelistSelect" style="display:none;">
713         <span class="label">Novelist Select: </span>
714         <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
715     </span>
716 [% END %]
717     </div>
718
719 [% IF (SeparateHoldings) %]
720     <div role="tabpanel" class="tab-pane" id="otherholdings">
721         [% IF (otheritemloop.size) %]
722             [% PROCESS items_table tab="otherholdings" items=otheritemloop %]
723         [% ELSE %]
724             <span class="nootheritems">No other items.</span>
725         [% END %]
726     </div>
727 [% END %]
728
729 [% IF ( MARCNOTES ) %]
730
731 <div role="tabpanel" class="tab-pane" id="description">
732 <div class="content_set">
733
734     [% FOREACH MARCNOTE IN MARCNOTES %]
735         <p>
736         [% IF MARCNOTE.marcnote.match('^https?://\S+$') %]
737             <a href="[% MARCNOTE.marcnote | url %]">[% MARCNOTE.marcnote | html %]</a>
738         [% ELSE %]
739             [% MARCNOTE.marcnote | html | html_line_break %]
740         [% END %]
741         </p>
742 [% END %]
743 </div>
744 </div>
745
746 [% END %]
747
748 [% IF ComponentParts && ComponentParts.size %]
749 <div role="tabpanel" class="tab-pane" id="components">
750     <div class="content_set">
751         <table>
752             [% FOR PART IN ComponentParts %]
753             <tr>
754                 <td>
755                     [% PART | $raw %]
756                 </td>
757             </tr>
758             [% END %]
759         </table>
760         [% IF ComponentParts.size == Koha.Preference('MaxComponentRecords')%]
761         <p>Only [% ComponentParts.size | html %] results are shown: <a href="/cgi-bin/koha/catalogue/search.pl?q=[% ComponentPartsQuery | url %]"/>show all component parts</a></p>
762         [% END %]
763     </div> <!-- /.content_set -->
764 </div> <!-- /#components -->
765
766 [% END %]
767
768 [% IF ( subscriptionsnumber ) %]
769 <div role="tabpanel" class="tab-pane" id="subscriptions">
770 <div id="catalogue_detail_subscriptions">
771     <h2>This is a serial subscription</h2>
772     <p> (There are [% subscriptionsnumber | html %] subscriptions associated with this title).</p> 
773     [% FOREACH subscription IN subscriptions %]
774             [% IF subscription.branchcode %]
775                 <h3>At library: [% Branches.GetName(subscription.branchcode) || subscription.branchcode | html %]</h3>
776             [% END %]
777             [% IF ( subscription.closed ) %]<p>This subscription is closed.</p>[% END %]
778             [% IF ( subscription.location ) %]<p class="subscription_location">Location: [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => subscription.location ) | html %]</p>[% END %]
779             [% IF ( subscription.callnumber ) %]<p>Callnumber: [% subscription.callnumber | html %] </p>[% END %]
780             [% IF ( subscription.subscriptionnotes ) %]<p>[% subscription.subscriptionnotes | html | html_line_break %] </p>[% END %]
781             [% IF ( subscription.missinglist ) %]<p>Missing issues: [% subscription.missinglist | html %] </p>[% END %]
782             [% IF ( subscription.librariannote ) %]<p>([% subscription.librariannote | html %])</p>[% END %]
783             [% IF ( subscription.latestserials ) %]
784             <p> The [% subscription.staffdisplaycount | html %] latest issues related to this subscription:</p>
785             <table>
786                 <tr>
787                     <th>Issue #</th>
788                     <th>Date arrived</th>
789                     <th>Date published</th>
790                     <th>Date published (text)</th>
791                     <th>Status</th>
792                     <th>Note</th>
793                 </tr>
794             [% FOREACH latestserial IN subscription.latestserials %]
795                 <tr>
796                     <td>[% latestserial.serialseq | html %]</td>
797                     <td data-order="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</td>
798                     <td data-order="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</td>
799                     <td>[% latestserial.publisheddatetext | html %]</td>
800                     <td>
801                       [% IF ( latestserial.status1 ) %]<span>Expected</span>[% END %]
802                       [% IF ( latestserial.status2 ) %]<span>Arrived</span>[% END %]
803                       [% IF ( latestserial.status3 ) %]<span>Late</span>[% END %]
804                       [% IF ( latestserial.status4 ) %]<span>Missing</span>[% END %]
805                       [% IF ( latestserial.status41 ) %]<span>Missing (never received)</span>[% END %]
806                       [% IF ( latestserial.status42 ) %]<span>Missing (sold out)</span>[% END %]
807                       [% IF ( latestserial.status43 ) %]<span>Missing (damaged)</span>[% END %]
808                       [% IF ( latestserial.status44 ) %]<span>Missing (lost)</span>[% END %]
809                       [% IF ( latestserial.status5 ) %]<span>Not issued</span>[% END %]
810                       [% IF ( latestserial.status6 ) %]<span>Delete</span>[% END %]
811                       [% IF ( latestserial.status7 ) %]<span>Claimed</span>[% END %]
812                       [% IF ( latestserial.status8 ) %]<span>Stopped</span>[% END %]
813                     </td>
814                     <td>[% latestserial.notes | html %]</td>
815                 </tr>
816             [% END %]
817             </table>
818             [% END %]
819             [% IF ( CAN_user_serials ) %]
820                 <p>
821                     <a class="btn btn-link" href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | uri %]"><i class="fa fa-list" aria-hidden="true"></i> Subscription details</a>
822                 </p>
823             [% END %]
824     [% END %]
825 </div>
826 </div>
827 [% END %]
828
829 [% IF Koha.Preference('AcquisitionDetails') %]
830 <div role="tabpanel" class="tab-pane" id="acq_details">
831   [% IF orders.count %]
832     <table id="orders">
833       <thead>
834         <tr>
835           <th>Vendor</th>
836           <th>Invoice</th>
837           <th>Basket group</th>
838           <th>Basket</th>
839           <th>Order number</th>
840           <th>Creation date</th>
841           <th>Receive date</th>
842           <th>Status</th>
843           <th>Quantity</th>
844           <th title="Estimated cost tax incl. while pending, actual cost tax incl. once received">Price</th>
845           <th>Internal note</th>
846           <th>Subscription</th>
847           <th>Subscription call number</th>
848         </tr>
849       </thead>
850       <tbody>
851       [% FOR order IN orders %]
852         [% SET basket = order.basket %]
853         [% SET vendor = basket.bookseller %]
854           <tr>
855             <td>
856                 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]" title="Vendor detail page">[% vendor.name | html %]</a>
857             </td>
858             <td>
859             [% IF order.invoiceid %]
860                 [% IF CAN_user_acquisition %]
861                     <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid | uri %]"
862                        title="Invoice detail page">
863                        [% order.invoice.invoicenumber | html %]</a>
864                 [% ELSE %]
865                     [% order.invoice.invoicenumber | html %]
866                 [% END %]
867             [% END %]
868             </td>
869             <td>
870             [% IF basket.basketgroupid %]
871                 [% SET basket_group = basket.basket_group %]
872                 [% IF CAN_user_acquisition_group_manage %]
873                     <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% vendor.id | uri %]&basketgroupid=[% basket_group.id | uri %]">[% basket_group.name | html%] ([% basket_group.id | html %])</a>
874                 [% ELSE %]
875                     [% basket_group.name | html %] ([% basket_group.id | html %])
876                 [% END %]
877             [% END %]
878             </td>
879             <td>[% IF CAN_user_acquisition_order_manage %]
880                 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">[% basket.basketname | html %] ([% basket.basketno | html %])</a>
881             [% ELSE %]
882                 [% basket.basketname | html %] ([% basket.basketno | html %])
883             [% END %]</td>
884             <td>[% order.ordernumber | html %]</td>
885             <td data-order="[% basket.creationdate | uri %]">[% basket.creationdate | $KohaDates%]</td>
886             <td data-order="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates%]</td>
887             <td>
888               [% SWITCH order.orderstatus %]
889                 [% CASE 'new' %]<span>New</span>
890                 [% CASE 'ordered' %]<span>Ordered</span>
891                 [% CASE 'partial' %]<span>Partial</span>
892                 [% CASE 'complete' %]<span>Complete</span>
893                 [% CASE 'cancelled' %]<span>Cancelled</span>
894               [% END %]
895             </td>
896             <td>[% order.quantity | html %]</td>
897             <td>[% IF ( order.unitprice_tax_included > 0 ) %][% order.unitprice_tax_included | $Price %][% ELSE %][% order.ecost_tax_included | $Price %][% END %]
898             <td>[% order.order_internalnote | html %]</td>
899             <td>
900                 [% IF order.subscriptionid %]
901                     <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% order.subscriptionid | uri %]">[% order.subscriptionid | html %]</a>
902                 [% END %]
903             </td>
904             <td>
905                 [% IF order.subscriptionid %]
906                     [% order.subscription.callnumber | html %]
907                 [% END %]
908             </td>
909           </tr>
910       [% END %]
911       </tbody>
912     </table>
913   [% ELSE %]
914     <span class="noorder">There is no order for this bibliographic record.</span>
915   [% END %]
916 </div>
917 [% END %]
918
919 [% IF suggestions.count %]
920     <div role="tabpanel" class="tab-pane" id="suggestion_details">
921         [% IF nb_archived_suggestions > 0 %]
922             <p>[% tnpx('pluralization', 'There is one archived suggestion.', 'There are {count} archived suggestions.', nb_archived_suggestions, { count = nb_archived_suggestions }) | $raw  %]
923         [% END %]
924         <table id="suggestions" class="sorted">
925             <thead>
926                 <tr>
927                     <th class="NoSort">&nbsp;</th>
928                     <th class="anti-the">Suggestion</th>
929                     <th>Suggested by - on</th>
930                     <th>Managed by - on</th>
931                     <th>Last modification by - on</th>
932                     <th>Library</th>
933                     <th>Fund</th>
934                     <th>Status</th>
935                 </tr>
936             </thead>
937             <tbody>
938             [% FOREACH suggestion IN suggestions %]
939                 <tr>
940                     <td>[% suggestion.suggestionid | html %]</td>
941                     <td>
942                         <a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestion.suggestionid | uri %]&amp;op=show" title="suggestion" >
943                             [% suggestion.title | html %][% IF ( suggestion.author ) %], by [% suggestion.author | html %][% END %]</a>
944                         <br />
945                         [% IF ( suggestion.copyrightdate ) %]&copy; [% suggestion.copyrightdate | html %] [% END %]
946                         [% IF ( suggestion.volumedesc ) %]; Volume:<em>[% suggestion.volumedesc | html %]</em> [% END %]
947                         [% IF ( suggestion.isbn ) %]; ISBN:<em>[% suggestion.isbn | html %]</em> [% END %][% IF ( suggestion.publishercode ) %]; Published by [% suggestion.publishercode | html %] [% END %][% IF ( suggestion.publicationyear ) %] in <em>[% suggestion.publicationyear | html %]</em> [% END %][% IF ( suggestion.place ) %] in <em>[% suggestion.place | html %]</em> [% END %][% IF ( suggestion.collectiontitle ) %]; [% suggestion.collectiontitle | html %] [% END %][% IF ( suggestion.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestion.itemtype, 0 ) | html %] [% END %]<br />[% IF ( suggestion.note ) %]<div class="suggestion_note"><i class="fa fa-comment"></i> [% suggestion.note | html %]</div>[% END %]
948                     </td>
949                     <td>
950                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.suggestedby | uri %]">[% INCLUDE 'patron-title.inc' patron => suggestion.suggester %]</a>
951                         [% IF suggestion.suggesteddate %] - [% suggestion.suggesteddate | $KohaDates %][% END %]
952                     </td>
953                     <td>
954                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.managedby | uri %]">[% INCLUDE 'patron-title.inc' patron => suggestion.manager %]</a>
955                         [% IF suggestion.manageddate %] - [% suggestion.manageddate | $KohaDates %][% END %]
956                     </td>
957                     <td>
958                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestion.lastmodificationby | uri %]">[% INCLUDE 'patron-title.inc' patron => suggestion.last_modifier %]</a>
959                         [% IF suggestion.lastmodificationdate %] - [% suggestion.lastmodificationdate | $KohaDates %][% END %]
960                     </td>
961                     <td>
962                         [% Branches.GetName( suggestion.branchcode ) | html %]
963                     </td>
964                     <td>
965                         [% suggestion.fund.budget_name | html %]
966                     </td>
967                     <td>
968                         [% IF    suggestion.STATUS == 'ASKED'     %]<span>Pending</span>
969                         [% ELSIF suggestion.STATUS == 'ACCEPTED'  %]<span>Accepted</span>
970                         [% ELSIF suggestion.STATUS == 'ORDERED'   %]<span>Ordered</span>
971                         [% ELSIF suggestion.STATUS == 'REJECTED'  %]<span>Rejected</span>
972                         [% ELSIF suggestion.STATUS == 'CHECKED'   %]<span>Checked</span>
973                         [% ELSIF suggestion.STATUS == 'AVAILABLE' %]<span>Available</span>
974                         [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.STATUS ) %]
975                             [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.STATUS ) | html %]
976                         [% ELSE %]<span>Status unknown</span>
977                         [% END %]
978                         [% IF suggestion.reason %]
979                             <br />([% suggestion.reason | html %])
980                         [% END %]
981                     </td>
982                 </tr>
983                 [% END %]
984             </tbody>
985         </table>
986     </div>
987 [% END %]
988
989 [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]
990 <div role="tabpanel" class="tab-pane" id="editions"><h4>Editions</h4>
991 <table>
992 [% FOREACH XISBN IN XISBNS %]<tr>[% IF ( AmazonCoverImages ) %]<td><a href="http://www.amazon.com/gp/reader/[% XISBN.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% XISBN.normalized_isbn | html %].01._AA75_PU_PU-5_.jpg" /></a></td>[% END %]
993 [% IF ( !item_level_itypes || Koha.Preference('BiblioItemtypeInfo') ) %]<td>[% IF ( noItemTypeImages ) %]<span class="itypetext">[% XISBN.description | html %]</span>[% ELSE %]<img src="[% XISBN.imageurl | html %]" alt="[% XISBN.description | html %]" title="[% XISBN.description | html %]">[% END %]</td>[% END %]
994 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% XISBN.biblionumber | uri %]">[% XISBN.title | html %]</a> <span>by</span> [% XISBN.author | html %] &copy;[% XISBN.copyrightdate | html %]
995   [% IF ( XISBN.publishercode ) %]
996 [% XISBN.publishercode | html %] [% IF ( XISBN.place ) %]([% XISBN.place | html %])[% END %] [% IF ( XISBN.publicationyear ) %], [% XISBN.publicationyear | html %][% END %] [% IF ( XISBN.editionstatement ) %][% XISBN.editionstatement | html %][% END %] [% IF ( XISBN.editionresponsibility ) %][% XISBN.editionresponsibility | html %][% END %]
997     [% END %]
998                 [% IF ( XISBN.pages ) %] [% END %][% XISBN.pages | html %] [% IF ( XISBN.illus ) %][% XISBN.illus | html %][% END %]
999                 [% IF ( XISBN.size ) %], [% END %][% XISBN.size | html %]
1000 </td>
1001
1002 [% END %]
1003 </table></div>[% END %]
1004 [% END %]
1005
1006 [% IF ( LocalCoverImages ) %]
1007     <div role="tabpanel" class="tab-pane" id="images">
1008         [% IF localimages.count %]
1009             <p>Click on an image to view it in the image viewer</p>
1010             <ul class="thumbnails">
1011                 [% FOREACH image IN localimages %]
1012                     [% IF image %]
1013                         <li id="imagenumber-[% image.imagenumber | html %]" class="thumbnail">
1014                             <a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]">
1015                                 <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" />
1016                             </a>
1017                             [% IF CAN_user_tools_upload_local_cover_images %]
1018                                 <a href="#" class="remove"><i class="fa fa-trash"></i> Delete image</a>
1019                             [% END %]
1020                         </li>
1021                     [% END %]
1022                 [% END %]
1023             </ul>
1024         [% ELSE # - No image passed JavaScript takes care %]
1025             <span class="noimagesuploaded">No images have been uploaded for this bibliographic record yet.</span>
1026         [% END %]
1027         [% IF ( CAN_user_tools_upload_local_cover_images ) %]
1028             <p>Upload an image file: <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber | uri %]&amp;filetype=image"><i class="fa fa-upload" aria-hidden="true"></i> Upload</a>
1029             </p>
1030         [% END %]
1031     </div>
1032 [% END %]
1033
1034 [% IF ( HTML5MediaEnabled ) %]
1035 <div role="tabpanel" class="tab-pane" id="html5media">
1036           [% FOREACH HTML5MediaSet IN HTML5MediaSets %]
1037             <p>
1038                 [% IF HTML5MediaSet.is_youtube %]
1039                     <iframe id="player" width="640" height="360" src="[% HTML5MediaSet.srcblock | url %]"></iframe>
1040                 [% ELSE %]
1041                   <[% HTML5MediaParent | html %] controls preload=none>
1042                     <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | url %]"[% HTML5MediaSet.typeblock | html %] />
1043                     [[% HTML5MediaParent | html %] tag not supported by your browser.]
1044                   </[% HTML5MediaParent | html %]>
1045                 [% END %]
1046             </p>
1047           [% END %]
1048 </div>
1049 [% END %]
1050
1051
1052 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
1053     <div role="tabpanel" class="tab-pane" id="NovelistSelect" class="novelistSelect">
1054         <div data-novelist-novelistselect=[% normalized_isbn | html %]></div>
1055     </div>
1056 [% END %]
1057
1058 [% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
1059     <div role="tabpanel" class="tab-pane" id="[% plugins_intranet_catalog_biblio_tab.id | html %]">
1060         [% plugins_intranet_catalog_biblio_tab.content | $raw %]
1061     </div>
1062 [% END %]
1063
1064 </div><!-- /tab-content -->
1065 </div><!-- /bibliodetails -->
1066
1067 <div id="export" style="margin-top: 1em;">
1068 <form method="get" action="/cgi-bin/koha/catalogue/export.pl">
1069 <table>  <tr>
1070       <th>Save record</th>   </tr>
1071     <tr><td> Select download format:    <select name="format">
1072         <option value="mods">MODS (XML)</option>
1073         <option data-toggle="modal" data-target="#exportModal_">Dublin Core</option>
1074         <option value="marcxml">MARCXML</option>
1075         <option value="marc8">MARC (non-Unicode/MARC-8)</option>
1076         <option value="utf8">MARC (Unicode/UTF-8)</option>    </select>
1077         <input type="submit" name="save" class="btn btn-primary" value="Download record" /></td>
1078   </tr>
1079   <tr><td>
1080     <input type="hidden" name="op" value="export" /><input type="hidden" name="bib" value="[% biblionumber | html %]" />
1081   </td></tr>
1082 </table>
1083 </form>
1084 </div>
1085
1086 <div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
1087     <div class="modal-dialog modal-lg">
1088     <div class="modal-content">
1089     <div class="modal-header">
1090         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1091         <h3 id="marcPreviewLabel">MARC preview</h3>
1092     </div>
1093     <div class="modal-body">
1094         <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
1095     </div>
1096     <div class="modal-footer">
1097         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
1098     </div>
1099     </div>
1100     </div>
1101 </div>
1102
1103             </main>
1104         </div> <!-- /.col-sm-10.col-sm-push-2 -->
1105
1106         <div class="col-sm-2 col-sm-pull-10">
1107             <aside>
1108                 [% INCLUDE 'biblio-view-menu.inc' %]
1109             </aside>
1110         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1111      </div> <!-- /.row -->
1112
1113 [% END %]
1114
1115 <div class="modal fade" id="modal-item-group-create" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-create-label">
1116     <div class="modal-dialog">
1117         <div class="modal-content">
1118             <div class="modal-header">
1119                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1120                 <h3 id="modal-item-group-create-label"><i class="fa fa-plus"></i> Create a new item group</h3>
1121             </div>
1122             <form id="modal-item-group-create-form" class="validated">
1123                 <div class="modal-body">
1124                     <fieldset>
1125                         <p>
1126                             <label for="item_group_description" class="required">Name: </label>
1127                             <input name="description" id="modal-item-group-create-form-description" type="text" size="30" required="required" class="required" />
1128                             <span class="required">Required</span>
1129                         </p>
1130                         <p>
1131                             <label for="item_group_display_order" class="required">Display order: </label>
1132                             <input name="display_order" id="modal-item-group-create-form-display_order" value="0" size="5" required="required" class="required" />
1133                             <span class="required">Required</span>
1134                             <br/>
1135                             <span class="hint">Numbers only, item groups will be displayed in counting order</span>
1136                         </p>
1137                     </fieldset>
1138                 </div>
1139                 <div class="modal-footer">
1140                     <button id="modal-item-group-create-submit" class="btn btn-default"><i class="fa fa-plus"></i> Submit</button>
1141                     <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1142                 </div>
1143             </form>
1144         </div>
1145     </div>
1146 </div>
1147
1148 <div class="modal fade" id="modal-item-group-edit" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-edit-label">
1149     <div class="modal-dialog">
1150         <div class="modal-content">
1151             <div class="modal-header">
1152                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1153                 <h3 id="modal-item-group-edit-label"><i class='fa fa-edit'></i> Edit item group</h3>
1154             </div>
1155             <form id="modal-item-group-edit-form" class="validated">
1156                 <div class="modal-body">
1157                     <fieldset>
1158                         <p>
1159                             <label for="item_group_description" class="required">Name: </label>
1160                             <input name="description" id="modal-item-group-edit-form-description" type="text" size="30" required="required" class="required" />
1161                             <span class="required">Required</span>
1162                         </p>
1163                         <p>
1164                             <label for="item_group_display_order" class="required">Sort order: </label>
1165                             <input name="display_order" id="modal-item-group-edit-form-display_order" size="5" />
1166                             <span class="hint">Numbers only, item groups will be displayed in counting order</span>
1167                         </p>
1168                     </fieldset>
1169                 </div>
1170                 <div class="modal-footer">
1171                     <button id="modal-item-group-edit-submit" class="btn btn-default"><i class='fa fa-edit'></i> Submit</button>
1172                     <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1173                 </div>
1174             </form>
1175         </div>
1176     </div>
1177 </div>
1178
1179 <div class="modal fade" id="modal-item-group-delete" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-delete-label">
1180     <div class="modal-dialog">
1181         <div class="modal-content">
1182             <div class="modal-header">
1183                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1184                 <h3 id="modal-item-group-delete-label"><i class='fa fa-trash'></i> Delete item group</h3>
1185             </div>
1186             <div class="modal-body">
1187                 Are you sure you want to delete this item group?
1188             </div>
1189             <div class="modal-footer">
1190                 <button id="modal-item-group-delete-submit" class="btn btn-danger"><i class='fa fa-trash'></i> Delete</button>
1191                 <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1192             </div>
1193         </div>
1194     </div>
1195 </div>
1196
1197 <div class="modal fade" id="modal-item-group-set" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-set-label">
1198     <div class="modal-dialog">
1199         <div class="modal-content">
1200             <div class="modal-header">
1201                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1202                 <h3 id="modal-item-group-set-label"><i class='fa fa-book'></i> Set item group for items</h3>
1203             </div>
1204             <form id="modal-item-group-set-form" class="validated">
1205                 <div class="modal-body">
1206                     <fieldset>
1207                         <p>
1208                             <label for="item_group" class="required">Item group: </label>
1209                             <select name="item_group" id="item-group-add-form-select">
1210                                 [% FOREACH ig IN biblio.item_groups %]
1211                                     <option value="[% ig.id | html %]">[% ig.description | html %]</option>
1212                                 [% END %]
1213                             </select>
1214                             <span class="required">Required</span>
1215                         </p>
1216                     </fieldset>
1217                 </div>
1218                 <div class="modal-footer">
1219                     <button id="modal-item-group-set-submit" class="btn btn-default"><i class='fa fa-book'></i> Set item group</button>
1220                     <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1221                 </div>
1222             </form>
1223         </div>
1224     </div>
1225 </div>
1226
1227 <div class="modal fade" id="modal-item-group-unset" tabindex="-1" role="dialog" aria-labelledby="modal-item-group-unset-label">
1228     <div class="modal-dialog">
1229         <div class="modal-content">
1230             <div class="modal-header">
1231                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1232                 <h3 id="modal-item-group-unset-label"><i class='fa fa-unlink'></i> Remove item from item group</h3>
1233             </div>
1234             <div class="modal-body">
1235                 Are you sure you want to remove these item(s) from their item group(s)?
1236             </div>
1237             <div class="modal-footer">
1238                 <button id="modal-item-group-unset-submit" class="btn btn-danger"><i class='fa fa-unlink'></i> Remove</button>
1239                 <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1240             </div>
1241         </div>
1242     </div>
1243 </div>
1244
1245     [% IF bundlesEnabled %]
1246     <div class="modal" id="addToBundleModal" tabindex="-1" role="dialog" aria-labelledby="addToBundleLabel">
1247         <form id="addToBundleForm" action="">
1248             <div class="modal-dialog" role="document">
1249                 <div class="modal-content">
1250                     <div class="modal-header">
1251                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1252                         <h3 id="addToBundleLabel">Add to bundle</h3>
1253                     </div>
1254                     <div class="modal-body">
1255                         <div id="addResult"></div>
1256                         <fieldset class="rows">
1257                             <ol>
1258                                 <li>
1259                                     <label class="required" for="external_id">Item barcode: </label>
1260                                     <input type="text" id="external_id" name="external_id" required="required">
1261                                     <span class="required">Required</span>
1262                                 </li>
1263                             </ol>
1264                         </fieldset>
1265                     </div>
1266                     <div class="modal-footer">
1267                         <button type="submit" class="btn btn-default">Submit</button>
1268                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
1269                     </div>
1270                 </div>
1271             </div>
1272         </form>
1273     </div>
1274
1275     <div class="modal" id="removeFromBundleModal" tabindex="-1" role="dialog" aria-labelledby="removeFromBundleLabel">
1276         <form id="removeFromBundleForm" action="">
1277             <div class="modal-dialog" role="document">
1278                 <div class="modal-content">
1279                     <div class="modal-header">
1280                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1281                         <h3 id="removeFromBundleLabel">Remove from bundle</h3>
1282                     </div>
1283                     <div class="modal-body">
1284                         <div id="removeResult"></div>
1285                         <fieldset class="rows">
1286                             <ol>
1287                                 <li>
1288                                     <label class="required" for="external_id">Item barcode: </label>
1289                                     <input type="text" id="rm_external_id" name="external_id" required="required">
1290                                     <span class="required">Required</span>
1291                                 </li>
1292                             </ol>
1293                         </fieldset>
1294                     </div>
1295                     <div class="modal-footer">
1296                         <button type="submit" class="btn btn-default">Submit</button>
1297                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
1298                     </div>
1299                 </div>
1300             </div>
1301         </form>
1302     </div>
1303     [% END %]
1304
1305 [% MACRO jsinclude BLOCK %]
1306     [% INCLUDE 'catalog-strings.inc' %]
1307     [% Asset.js("js/catalog.js") | $raw %]
1308     [% Asset.js("js/recalls.js") | $raw %]
1309     [% Asset.js("js/coce.js") | $raw %]
1310     [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
1311     <script>
1312         var interface = "[% interface | html %]";
1313         var theme = "[% theme | html %]";
1314         // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
1315         function verify_cover_images() {
1316             // Loop over each container in the template which contains covers
1317             $(".cover-slider").each(function(){
1318                 var lightbox_descriptions = [];
1319                 var first_shown = 0;
1320                 $(this).find(".cover-image").each( function( index ){
1321                 var div = $(this);
1322                 // Find the image in the container
1323                 var img = div.find("img")[0];
1324                 if( $(img).length > 0 ){
1325                     var description = "";
1326                         // All slides start hidden. If this is the first one, show it.
1327                         if( first_shown == 0 ){
1328                             div.show();
1329                             first_shown = 1;
1330                         }
1331                         // Check if Amazon image is present
1332                         if ( div.attr("id") == "amazon-bookcoverimg"  ) {
1333                             w = img.width;
1334                             h = img.height;
1335                             if ((w == 1) || (h == 1)) {
1336                                 // Amazon returned single-pixel placeholder
1337                                 // Remove the container
1338                                 div.remove();
1339                             } else {
1340                                 lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1341                             }
1342                         } else if( div.attr("id") == "custom-coverimg" ){
1343                             if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
1344                                 // No image was loaded via the CustomCoverImages system preference
1345                                 // Remove the container
1346                                 div.remove();
1347                             } else {
1348                                 lightbox_descriptions.push("Custom cover image");
1349                             }
1350                         } else if ( div.attr("id") == "syndetics-bookcoverimg" ){
1351                                 lightbox_descriptions.push(_("Syndetics cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1352                         }
1353                         else if( div.hasClass("coce-coverimg" ) ){
1354                             // Identify which service's image is being loaded by Coce
1355                             var coce_description;
1356                             if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
1357                                 coce_description = ("Coce image from Amazon.com");
1358                             } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
1359                                 coce_description = _("Coce image from Google Books");
1360                             } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
1361                                 coce_description = _("Coce image from Open Library");
1362                             }
1363                             div.find(".hint").html(coce_description);
1364                             lightbox_descriptions.push(coce_description);
1365                         } else if ( div.attr("class") == "cover-image local-coverimg" ) {
1366                             lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link')));
1367                         } else {
1368                             lightbox_descriptions.push(_("Cover image source unknown"));
1369                         }
1370                     }
1371                 });
1372
1373                 // Lightbox for cover images
1374                 Chocolat(this.querySelectorAll('.cover-image a'), {
1375                     description: function(){
1376                         return lightbox_descriptions[this.settings.currentImageIndex];
1377                     }
1378                 });
1379
1380             });
1381
1382             $(".cover-slider").each(function(){
1383                 var coverSlide = this;
1384                 var coverImages = $(this).find(".cover-image");
1385                 if( coverImages.length > 1 ){
1386                     coverImages.each(function( index ){
1387                         // If more that one image is present, add a navigation link
1388                         // for activating the slide
1389                         var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>");
1390                         if( index == 0 ){
1391                             // Set the first navigation link as active
1392                             $(covernav).addClass("nav-active");
1393                         }
1394                         $(covernav).html("<i class=\"fa fa-circle\"></i>");
1395                         $(coverSlide).append( covernav );
1396                     });
1397                 }
1398
1399                 if( $(coverSlide).attr('id') == 'biblio-cover-slider' // Hide if not visible, but only for the biblio images. Images for items are only local cover images
1400                     && $(coverSlide).find(".cover-image:visible").length < 1 ){
1401                     $(coverSlide).remove();
1402                 } else {
1403                     $(coverSlide).addClass("cover-slides");
1404                     var img = $(coverSlide).find(".cover-image:visible").find("img")[0];
1405                     if( $(img).length > 0 && img.complete && img.naturalHeight > 0 ){
1406                         $(".cover-slides").css({"background-image":"none"});
1407                     }
1408                 }
1409             });
1410
1411             $("#editions img").each(function(i){
1412                 if ( this.src.indexOf('amazon.com') >= 0 ) {
1413                     w = this.width;
1414                     h = this.height;
1415                     if ((w == 1) || (h == 1)) {
1416                         this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1417                     } else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) {
1418                         this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1419                     }
1420                 }
1421             });
1422         }
1423
1424         function removeLocalImage(imagenumber) {
1425             var thumbnail = $("#imagenumber-" + imagenumber );
1426             var copy = thumbnail.html();
1427             thumbnail.find("img").css("opacity", ".2");
1428             thumbnail.find("a.remove").html("<img style='display:inline-block' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' />");
1429             $.ajax({
1430                 url: "/cgi-bin/koha/svc/cover_images?action=delete&imagenumber=" + imagenumber,
1431                 success: function(data) {
1432                     $(data).each( function(i) {
1433                         if ( this.deleted == 1 ) {
1434                             thumbnail.remove();
1435                         } else {
1436                             thumbnail.html( copy );
1437                             alert(_("An error occurred on deleting this image"));
1438                         }
1439                         if ( $('ul.thumbnails > li').length == 0 ) {
1440                             showNoImageMessage();
1441                         }
1442                     });
1443                 },
1444                 error: function(data) {
1445                     thumbnail.html( copy );
1446                     alert(_("An error occurred on deleting this image"));
1447                 }
1448             });
1449         }
1450
1451         function showNoImageMessage() {
1452             var no_images_msg = _("No images have been uploaded for this bibliographic record yet.");
1453             no_images_msg = '<p>' + no_images_msg + '</p>';
1454             [% IF ( CAN_user_tools_upload_local_cover_images ) %]
1455                 var please_upload = _("Upload an image file: %sUpload%s").format("<a class='btn btn-default btn-xs' href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=" + biblionumber + "&amp;filetype=image'><i class='fa fa-upload' aria-hidden='true'></i> ","</a>");
1456                 no_images_msg += "<p id='upload_image'>" + please_upload + '</p>';
1457             [% END %]
1458             $('#images').html(no_images_msg);
1459         }
1460
1461         [% IF StaffDetailItemSelection %]
1462             function itemSelectionBuildDeleteLink(div) {
1463                 var itemnumbers = new Array();
1464                 $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() {
1465                     itemnumbers.push($(this).val());
1466                 });
1467                 if (itemnumbers.length > 0) {
1468                     var url = '/cgi-bin/koha/tools/batchMod.pl?op=show&del=1';
1469                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1470                     url += '&biblionumber=[% biblionumber | uri %]';
1471                     url += '&src=CATALOGUING';
1472                     $('a.itemselection_action_delete').attr('href', url);
1473                 } else {
1474                     return false;
1475                 }
1476                 return true
1477             }
1478
1479             function itemSelectionBuildModifyLink(div) {
1480                 var itemnumbers = new Array();
1481                 $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() {
1482                     itemnumbers.push($(this).val());
1483                 });
1484                 if (itemnumbers.length > 0) {
1485                     var url = '/cgi-bin/koha/tools/batchMod.pl?op=show';
1486                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1487                     url += '&biblionumber=[% biblionumber | uri %]';
1488                     url += '&src=CATALOGUING';
1489                     $('a.itemselection_action_modify').attr('href', url);
1490                 } else {
1491                     return false;
1492                 }
1493                 return true;
1494             }
1495
1496             function itemSelectionBuildActionLinks(tab) {
1497                 var div = $("#" + tab);
1498                 var delete_link_ok = itemSelectionBuildDeleteLink(div);
1499                 var modify_link_ok = itemSelectionBuildModifyLink(div);
1500                 if (modify_link_ok || delete_link_ok) {
1501                     $('.itemselection_actions', div).show();
1502                 } else {
1503                     $('.itemselection_actions', div).hide();
1504                 }
1505             }
1506
1507             $(document).ready(function() {
1508                 $('table.items_table').each(function() {
1509                     var div = $(this).parent().attr("id");
1510                     itemSelectionBuildActionLinks(div);
1511                 });
1512
1513                 $("input[name='itemnumber'][type='checkbox']").change(function() {
1514                     var div = $(this).parents('table').parent().parent().attr("id");
1515                     itemSelectionBuildActionLinks(div);
1516                 });
1517
1518                 $(".SelectAll").on("click",function(e){
1519                     e.preventDefault();
1520                     var tab = $(this).data("tab");
1521                     $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', true);
1522                     itemSelectionBuildActionLinks(tab);
1523                 });
1524
1525                 $(".ClearAll").on("click",function(e){
1526                     e.preventDefault();
1527                     var tab = $(this).data("tab");
1528                     $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false);
1529                     itemSelectionBuildActionLinks(tab);
1530                 });
1531             });
1532         [% END %]
1533
1534         $(document).ready(function() {
1535             // Pick details tab to display by default
1536             [% IF count == 0 %]
1537                 [% IF ( Koha.Preference('HTML5MediaEnabled') == 'staff' or Koha.Preference('HTML5MediaEnabled') == 'both' ) && HTML5MediaSets.size %]
1538                     $(".nav-tabs a[href='#html5media']").tab("show");
1539                 [% ELSIF ComponentParts && ComponentParts.size %]
1540                     $(".nav-tabs a[href='#components']").tab("show");
1541                 [% ELSE %]
1542                     $(".nav-tabs a[href='#holdings']").tab("show");
1543                 [% END %]
1544             [% ELSE %]
1545                 $(".nav-tabs a[href='#holdings']").tab("show");
1546             [% END %]
1547             $('#search-form').focus();
1548             $('.thumbnails > li > .remove').click(function() {
1549                 var result = confirm(_("Are you sure you want to delete this cover image?"));
1550
1551                 if ( result == true ) {
1552                     var imagenumber = $(this).parent().attr('id').split('-')[1];
1553                     removeLocalImage(imagenumber);
1554                 }
1555
1556                 return false;
1557             });
1558             [% IF ( IntranetCoce && CoceProviders ) %]
1559                 KOHA.coce.getURL('[% CoceHost | html %]', '[% CoceProviders | html %]');
1560             [% END %]
1561
1562             $("body").on("click",".previewMARC", function(e){
1563                 e.preventDefault();
1564                 var page = $(this).attr("href");
1565                 $("#marcPreview .modal-body").load(page + " table");
1566                 $('#marcPreview').modal({show:true});
1567             });
1568             $("#marcPreview").on("hidden.bs.modal", function(){
1569                 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1570             });
1571             [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
1572                 novSelect.loadContentForQuery({
1573                     ClientIdentifier : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
1574                     ISBN : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
1575                     version : '2.1'
1576                 },
1577                 '[% Koha.Preference('NovelistSelectStaffProfile') | html %]',
1578                 '[% Koha.Preference('NovelistSelectPassword') | html %]',
1579                 function(d){
1580                     if ( d.length > 0 ){ //If no content
1581                         $(".NovelistSelect").show();
1582                     }
1583                  });
1584              [% END %]
1585              $(".print-label").on("click", function(e){
1586                 e.preventDefault();
1587                 link = $(this).attr("href");
1588                 openWindow(link,"Print spine label",400,400);
1589              });
1590              $(".cover-slider").on("click",".cover-nav", function(e){
1591                  e.preventDefault();
1592                 var cover_slider = $(this).parent();
1593                 // Adding click handler for cover image navigation links
1594                 var num = $(this).data("num");
1595                 $(cover_slider).find(".cover-nav").removeClass("nav-active");
1596                 $(this).addClass("nav-active");
1597                 $(cover_slider).find(".cover-image").hide();
1598                 $(cover_slider).find(".cover-image").eq( num ).show();
1599              });
1600         });
1601
1602
1603         [% IF ( IntranetCoce && CoceProviders ) %]
1604             let counter_wait = 0;
1605             function wait_for_images(cb){
1606
1607                 var loaded = 1;
1608                 counter_wait++;
1609
1610                 if ( loaded ) {
1611                     loaded = KOHA.coce.done;
1612                 }
1613
1614                 if (!loaded && counter_wait < 50) {// Do not wait more than 5 seconds
1615                     window.setTimeout(function(){wait_for_images(cb);}, 100);
1616                 } else {
1617                     if (counter_wait >= 50 ) {
1618                         console.log("Could not retrieve the images")
1619                     }
1620                     cb();
1621                 }
1622             }
1623
1624             $(window).load(function() {
1625                 wait_for_images(verify_cover_images);
1626             });
1627         [% ELSE %]
1628             $(window).load(function() {
1629                 verify_cover_images();
1630             });
1631         [% END %]
1632     </script>
1633     [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
1634         <script src="https://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
1635     [% END %]
1636     [% INCLUDE 'datatables.inc' %]
1637     [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
1638     [% INCLUDE 'columns_settings.inc' %]
1639     [% INCLUDE 'js-date-format.inc' %]
1640     [% INCLUDE 'js-patron-format.inc' %]
1641     [% INCLUDE 'js-biblio-format.inc' %]
1642     [% Asset.js("js/browser.js") | $raw %]
1643     [% Asset.js("js/table_filters.js") | $raw %]
1644     <script>
1645         var browser;
1646         browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10));
1647         browser.show();
1648
1649         [% IF bundlesEnabled %]
1650         var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1651         var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1652         [% END %]
1653         $(document).ready(function() {
1654
1655             [% IF bundlesEnabled %] // Bundle handling
1656             function createChild ( row, itemnumber, duedate ) {
1657
1658                 // Toolbar
1659                 var bundle_toolbar = $('<div id="toolbar" class="btn-toolbar"></div>');
1660                 bundle_toolbar.append('<a class="btn btn-default" data-toggle="modal" data-target="#addToBundleModal" data-item="' + itemnumber + '"><i class="fa fa-plus"></i> ' + _("Add to bundle") + '</a>');
1661                 bundle_toolbar.append('<a class="btn btn-default" data-toggle="modal" data-target="#removeFromBundleModal" data-item="' + itemnumber + '"><i class="fa fa-minus"></i> ' + _("Remove from bundle") + '</a>');
1662
1663                 // Disable management if there's a duedate
1664                 if(duedate) {
1665                     bundle_toolbar.children('.btn').addClass("disabled");
1666                     bundle_toolbar.attr("title", _("This bundle is checked out, it cannot be modified"));
1667                 }
1668
1669                 // This is the table we'll convert into a DataTable
1670                 var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" id="bundle_table_'+itemnumber+'" width="100%"/>');
1671
1672                 // Display it the child row
1673                 row.child( bundle_toolbar.add(bundles_table), 'bundle' ).show();
1674
1675                 // Initialise as a DataTable
1676                 var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?";
1677                 var bundle_table = bundles_table.kohaTable({
1678                     "ajax": {
1679                         "url": bundle_table_url
1680                     },
1681                     "embed": [
1682                         "biblio",
1683                         "return_claim.patron"
1684                     ],
1685                     "order": [[ 1, "asc" ]],
1686                     "columnDefs": [ {
1687                         "targets": [0,1,2,3],
1688                         "render": function (data, type, row, meta) {
1689                             if ( data && type == 'display' ) {
1690                                 return data.escapeHtml();
1691                             }
1692                             return data;
1693                         }
1694                     } ],
1695                     "columns": [
1696                         {
1697                             "data": "biblio.title:biblio.subtitle:biblio.medium",
1698                             "title": _("Title"),
1699                             "searchable": true,
1700                             "orderable": true,
1701                             "render": function(data, type, row, meta) {
1702                                 return $biblio_to_html(row.biblio, { link: 1 });
1703                             }
1704                         },
1705                         {
1706                             "data": "biblio.author",
1707                             "title": _("Author"),
1708                             "searchable": true,
1709                             "orderable": true,
1710                         },
1711                         {
1712                             "data": "callnumber",
1713                             "title": _("Callnumber"),
1714                             "searchable": true,
1715                             "orderable": true,
1716                         },
1717                         {
1718                             "data": "external_id",
1719                             "title": _("Barcode"),
1720                             "searchable": true,
1721                             "orderable": true,
1722                         },
1723                         {
1724                             "data": "lost_status:last_seen_date:return_claim.patron",
1725                             "title": _("Status"),
1726                             "searchable": false,
1727                             "orderable": true,
1728                             "render": function(data, type, row, meta) {
1729                                 if ( row.lost_status == bundle_lost_value ) {
1730                                     let out = '<span class="lost">' + _("Last seen") + ': ' + $date(row.last_seen_date) + '</span>';
1731                                     if ( row.return_claim ) {
1732                                         out = out + '<span class="claims_return">' + _("Claims returned by") + ': ' + $patron_to_html( row.return_claim.patron, { display_cardnumber: false, url: true } ) + '</span>';
1733                                     }
1734                                     return out;
1735                                 }
1736                                 else if ( row.lost_status !== 0 ) {
1737                                     return '<span class="lost">' + _("Lost") + ': ' + row.lost_status + '</span>';
1738                                 }
1739                                 return '<span class="available">' + _("Present") + '</span>';
1740                             }
1741                         },
1742                         {
1743                             "data": function( row, type, val, meta ) {
1744                                 var result;
1745                                 if (duedate) {
1746                                     result = '<button class="btn btn-default btn-xs remove disabled" role="button" data-itemnumber="'+row.item_id+'" title="%s"><i class="fa fa-minus" aria-hidden="true"></i> %s</button>\n'.format(_("This bundle is checked out, it cannot be modified"), _("Remove"));
1747                                 } else {
1748                                     result = '<button class="btn btn-default btn-xs remove" role="button" data-itemnumber="'+row.item_id+'"><i class="fa fa-minus" aria-hidden="true"></i> '+_("Remove")+'</button>\n';
1749                                 }
1750                                 return result;
1751                             },
1752                             "title": _("Actions"),
1753                             "searchable": false,
1754                             "orderable": false,
1755                             "class": "noExport"
1756                         }
1757                     ]
1758                 }, bundle_settings, 1);
1759                 $(".tbundle").on("click", ".remove:not(.disabled)", function(){
1760                     var bundle_table = $(this).closest('table');
1761                     var host_itemnumber = bundle_table.data('itemnumber');
1762                     var component_itemnumber = $(this).data('itemnumber');
1763                     var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/" + component_itemnumber;
1764                     $.ajax({
1765                         type: "DELETE",
1766                         url: unlink_item_url,
1767                         success: function(){
1768                             bundle_table.DataTable({ 'retrieve': true }).draw(false);
1769                         }
1770                     });
1771                 });
1772
1773                 return;
1774             }
1775
1776             var bundle_changed;
1777             var bundle_form_active;
1778             $("#addToBundleModal").on("shown.bs.modal", function(e){
1779                 var button = $(e.relatedTarget);
1780                 var item_id = button.data('item');
1781                 $("#addResult").replaceWith('<div id="addResult"></div>');
1782                 $("#addToBundleForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items');
1783                 $("#external_id").focus();
1784                 bundle_changed = 0;
1785                 bundle_form_active = item_id;
1786             });
1787
1788             function addToBundle (url, data) {
1789                   /* Send the data using post with external_id */
1790                   var posting = $.post({
1791                       url: url,
1792                       data: JSON.stringify(data),
1793                       contentType: "application/json; charset=utf-8",
1794                       dataType: "json"
1795                   });
1796
1797                   const barcode = data.external_id;
1798
1799                   /* Report the results */
1800                   posting.done(function(data) {
1801                       $('#addResult').replaceWith('<div id="addResult" class="alert alert-success">'+_("Success: Added '%s'").format(barcode)+'</div>');
1802                       $('#external_id').val('').focus();
1803                       bundle_changed = 1;
1804                   });
1805                   posting.fail(function(data) {
1806                       if ( data.status === 409 ) {
1807                           var response = data.responseJSON;
1808                           if ( response.error_code === 'already_bundled' ) {
1809                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
1810                           } else if (response.error_code === 'bundle_checkout_out') {
1811                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Bundle is currently checked out")+'</div>');
1812                           } else if (response.error_code === 'checked_out') {
1813                               const button = $('<button type="button">')
1814                                 .addClass('btn btn-xs')
1815                                 .text(__("Check in and add to bundle"))
1816                                 .on('click', function () {
1817                                     addToBundle(url, { external_id: barcode, force_checkin: true });
1818                                 });
1819                               $('#addResult')
1820                                 .empty()
1821                                 .attr('class', 'alert alert-warning')
1822                                 .append(__x('Warning: Item {barcode} is checked out', { barcode }))
1823                                 .append(' ', button);
1824                           } else if (response.error_code === 'failed_checkin') {
1825                               $('#addResult')
1826                                 .empty()
1827                                 .attr('class', 'alert alert-danger')
1828                                 .append(__x('Failure: Item {barcode} cannot be checked in', { barcode }))
1829                           } else {
1830                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' belongs to another bundle").format(barcode)+'</div>');
1831                           }
1832                       } else if ( data.status === 404 ) {
1833                           $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' not found").format(barcode)+'</div>');
1834                       } else if ( data.status === 400 ) {
1835                           var response = data.responseJSON;
1836                           if ( response.error_code === "failed_nesting" ) {
1837                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' is a bundle and bundles cannot be nested").format(barcode)+'</div>');
1838                           } else {
1839                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Check the logs for details")+'</div>');
1840                           }
1841                       } else {
1842                           $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Check the logs for details")+'</div>');
1843                       }
1844                       $('#external_id').val('').focus();
1845                   });
1846             }
1847
1848             $("#addToBundleForm").submit(function(event) {
1849                   /* stop form from submitting normally */
1850                   event.preventDefault();
1851
1852                   const url = this.action;
1853                   const data = { external_id: this.elements.external_id.value };
1854
1855                   addToBundle(url, data);
1856             });
1857
1858             $("#addToBundleModal").on("hidden.bs.modal", function(e){
1859                 if ( bundle_changed ) {
1860                     $('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload();
1861                 }
1862                 bundle_form_active = 0;
1863                 bundle_changed = 0;
1864             });
1865
1866             $("#removeFromBundleModal").on("shown.bs.modal", function(e){
1867                 var button = $(e.relatedTarget);
1868                 var item_id = button.data('item');
1869                 $("#removeResult").replaceWith('<div id="removeResult"></div>');
1870                 $("#removeFromBundleForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items/');
1871                 $("#rm_external_id").focus();
1872                 bundle_changed = 0;
1873                 bundle_form_active = item_id;
1874             });
1875
1876             $("#removeFromBundleForm").submit(function(event) {
1877
1878                 /* stop form from submitting normally */
1879                 event.preventDefault();
1880
1881                 /* get the action attribute from the <form action=""> element */
1882                 var $form = $(this),
1883                 url = $form.attr('action');
1884
1885                 var barcode = $('#rm_external_id').val();
1886
1887                 /* Fetch itemnumber using rm_external_id */
1888                 var itemReq = $.get('/api/v1/items', { q: JSON.stringify({
1889                     external_id: barcode
1890                 }) }, null, "json");
1891
1892                 var itemnumber;
1893                 itemReq.done(function(data) {
1894                     if (data.length === 1) {
1895                         itemnumber = data[0].item_id;
1896
1897                         /* Remove link using fetch itemnumber */
1898                         var deleteReq = $.ajax( url + itemnumber, {
1899                             type : 'DELETE'
1900                         });
1901
1902                         /* Report the results */
1903                         deleteReq.done(function(data) {
1904                             var barcode = $('#rm_external_id').val();
1905                             $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-success">'+_("Success: Removed '%s'").format(barcode)+'</div>');
1906                             $('#rm_external_id').val('').focus();
1907                             bundle_changed = 1;
1908                         });
1909                         deleteReq.fail(function(data) {
1910                             var barcode = $('#rm_external_id').val();
1911                             if ( data.status === 409 ) {
1912                                 var response = data.responseJSON;
1913                                 if (response.error_code === 'bundle_checkout_out') {
1914                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Bundle is currently checked out")+'</div>');
1915                                 } else if ( response.key === "PRIMARY" ) {
1916                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
1917                                 } else {
1918                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Item '%s' belongs to another bundle").format(barcode)+'</div>');
1919                                 }
1920                             } else if ( data.status === 404 ) {
1921                                 $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' not found").format(barcode)+'</div>');
1922                             } else {
1923                                 $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Check the logs for details")+'</div>');
1924                             }
1925                             $('#rm_external_id').val('').focus();
1926                         });
1927                     } else {
1928                         $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failed: Barcode matched more than one item '%s'").format(barcode)+'</div>');
1929                     }
1930                 });
1931                 itemReq.fail(function(data) {
1932                      $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failed: Item not found '%s'").format(barcode)+'</div>');
1933                     $('#rm_external_id').val('').focus();
1934
1935                 });
1936             });
1937
1938             $("#removeFromBundleModal").on("hidden.bs.modal", function(e){
1939                 if ( bundle_changed ) {
1940                     $('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload();
1941                 }
1942                 bundle_form_active = 0;
1943                 bundle_changed = 0;
1944             });
1945             // End bundle handling
1946             [% END %]
1947
1948             var table_names = [ 'holdings_table', 'otherholdings_table' ];
1949             var table_settings = [ [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %] ];
1950             var has_images = [ "[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]" ];
1951             table_names.forEach( function( table_name, index ) {
1952                 if ( !has_images[index] ) {
1953                     table_settings[index].columns.splice(1,1);
1954                 }
1955                 var dt_parameters = {
1956                     'sDom': 't',
1957                     'bPaginate': false,
1958                     'bAutoWidth': false,
1959                     "bKohaColumnsUseNames": true,
1960                     "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
1961                 };
1962                 var table = KohaTable( table_name, dt_parameters, table_settings[index], 'with_filters' );
1963
1964                 [% IF bundlesEnabled %]
1965                 // Add event listener for opening and closing bundle details
1966                 $('#' + table_name + ' tbody').on('click', 'button.details-control', function () {
1967                     var button = $(this);
1968                     var tr = button.closest('tr');
1969                     var dTable = button.closest('table').DataTable({ 'retrieve': true });
1970
1971                     var itemnumber = tr.data('itemnumber');
1972                     var duedate = tr.data('duedate');
1973                     var row = dTable.row( tr );
1974
1975                     if ( row.child.isShown() ) {
1976                         // This row is already open - close it
1977                         row.child.hide();
1978                         tr.removeClass('shown');
1979                         button.removeClass('active');
1980                     }
1981                     else {
1982                         // Open this row
1983                         createChild(row, itemnumber, duedate);
1984                         tr.addClass('shown');
1985                         button.addClass('active');
1986                     }
1987                 } );
1988                 [% END %]
1989             });
1990
1991             [% IF Koha.Preference('AcquisitionDetails') %]
1992                 var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
1993                 var acquisitiondetails_table = KohaTable("orders", {
1994                     "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
1995                     'bPaginate': false,
1996                     'bAutoWidth': false,
1997                     "aaSorting": [[ 4, "desc" ]],
1998                 }, table_settings);
1999             [% END %]
2000
2001             [% IF suggestions.count %]
2002                 $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
2003                     "aoColumnDefs": [
2004                         { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
2005                         { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
2006                     ],
2007                     "sPaginationType": "full"
2008                 }));
2009             [% END %]
2010
2011         });
2012
2013         function columnsInit(table) {
2014             activate_filters(table.id, false);
2015         }
2016
2017         [% IF found1 && Koha.Preference('RetainCatalogSearchTerms') %]
2018             $(document).ready(function() {
2019                 var search_index = localStorage.getItem("cat_search_pulldown_selection");
2020                 var search_value = localStorage.getItem("searchbox_value");
2021                 if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
2022                 if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
2023             });
2024         [% END %]
2025
2026         [% IF Koha.Preference('EnableItemGroups') %]
2027             // Load item groups table
2028             var itemGroupsTable = KohaTable("items-group-table", {
2029                 "bAutoWidth": false,
2030                 'sDom': '<"top pager"ilp>t<"bottom pager"ip>r',
2031                 "aoColumns": [
2032                     {
2033                         "mDataProp": function( oObj ) {
2034                             return oObj.display_order;
2035                         },
2036                     },
2037                     {
2038                         "mDataProp": function( oObj ) {
2039                             return oObj.description;
2040                         },
2041                     },
2042                     {
2043                         "mDataProp": function( oObj ) {
2044                             [% IF CAN_user_editcatalogue_manage_item_groups %]
2045                                 return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2046                                     <i class='fa fa-edit'></i> ${_("Edit")}
2047                                 </button>`
2048                                 + '&nbsp'
2049                                 + `<button class='item-group-delete btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2050                                     <i class='fa fa-trash'></i> ${('Delete')}
2051                                 </button>`;
2052                             [% ELSE %]
2053                                 return "";
2054                             [% END %]
2055                         },
2056                     },
2057                 ],
2058                 "bPaginate": false,
2059                 "bProcessing": true,
2060                 "bServerSide": false,
2061                 "sAjaxSource": `/api/v1/biblios/${biblionumber}/item_groups?_per_page=-1`,
2062                 "sAjaxDataProp": "",
2063                 "fnServerData": function ( sSource, aoData, fnCallback ) {
2064                     $.getJSON( sSource, aoData, function (json) {
2065                         fnCallback(json)
2066                     } );
2067                 },
2068             });
2069
2070             // Create new item groups
2071             $('.item-group-create').on('click', function(){
2072                 $('#modal-item-group-create-form-description').val("");
2073                 $('#modal-item-group-create-submit').removeAttr('disabled');
2074                 $('#modal-item-group-create').modal('show');
2075             });
2076
2077             $("#modal-item-group-create-form").validate({
2078                 submitHandler: function(form) {
2079                     $.ajax({
2080                         url: `/api/v1/biblios/${biblionumber}/item_groups`,
2081                         headers: { "x-koha-embed": "items" },
2082                         success: function(item_groups){
2083                             $('#modal-item-group-create-submit').attr('disabled', 'disabled');
2084
2085                             var settings = {
2086                               "url": `/api/v1/biblios/${biblionumber}/item_groups`,
2087                               "method": "POST",
2088                               "headers": {
2089                                 "Content-Type": "application/json"
2090                               },
2091                               "data": JSON.stringify(
2092                                   {
2093                                       "description": $("#modal-item-group-create-form-description").val(),
2094                                       "display_order": $("#modal-item-group-create-form-display_order").val(),
2095                                   }
2096                               ),
2097                             };
2098
2099                             $.ajax(settings)
2100                             .done(function (response) {
2101                                 $('#item-group-add-form-select').append($('<option>', {
2102                                     value: response.item_group_id,
2103                                     text: response.description
2104                                 }));
2105
2106                                 $('#modal-item-group-create').modal('hide');
2107                                 if ( item_groups.length == 0 ) {
2108                                     // This bib has no previous item groups, reload the page
2109                                     window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`);
2110                                 } else {
2111                                     // Has other item groups, just reload the table
2112                                     itemGroupsTable.api().ajax.reload();
2113                                 }
2114                             })
2115                             .fail(function(err) {
2116                                 var message = err.responseJSON.error;
2117                                 alert(message);
2118                             });
2119                         }
2120                     });
2121                 }
2122             });
2123
2124             $('#modal-item-group-create').on('shown.bs.modal', function () {
2125                 $('#modal-item-group-create-form-description').focus();
2126             })
2127
2128             // Edit existing item groups
2129             $('body').on( 'click', '.item-group-edit', function(){
2130                 const item_group_id = $(this).data('item-group-id');
2131                 const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`;
2132                 $.get( url, function( data ) {
2133                     $('#modal-item-group-edit-form-description').val( data.description );
2134                     $('#modal-item-group-edit-form-display_order').val( data.display_order );
2135                     $('#modal-item-group-edit-submit').data('item-group-id', item_group_id );
2136                     $('#modal-item-group-edit-submit').removeAttr('disabled');
2137                     $('#modal-item-group-edit').modal('show');
2138                 });
2139             });
2140
2141             $("#modal-item-group-edit-form").validate({
2142                 submitHandler: function(form) {
2143                     $('#modal-item-group-edit-submit').attr('disabled', 'disabled');
2144
2145                     const item_group_id = $('#modal-item-group-edit-submit').data('item-group-id');
2146                     const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`;
2147
2148                     var settings = {
2149                       "url": url,
2150                       "method": "PUT",
2151                       "headers": {
2152                         "Content-Type": "application/json"
2153                       },
2154                       "data": JSON.stringify(
2155                           {
2156                               "description": $("#modal-item-group-edit-form-description").val(),
2157                               "display_order": $("#modal-item-group-edit-form-display_order").val(),
2158                           }
2159                       ),
2160                     };
2161
2162                     $.ajax(settings)
2163                     .done(function (response) {
2164                         $('#modal-item-group-edit').modal('hide');
2165                         itemGroupsTable.api().ajax.reload();
2166                     })
2167                     .fail(function(err) {
2168                         var message = err.responseJSON.error;
2169                         alert(message);
2170                     });
2171                 }
2172             });
2173
2174             $('#modal-item-group-edit').on('shown.bs.modal', function () {
2175                 $('#modal-item-group-edit-form-description').focus();
2176             })
2177
2178             // Delete existing item groups
2179             $('body').on( 'click', '.item-group-delete', function(){
2180                 const item_group_id = $(this).data('item-group-id');
2181                 $('#modal-item-group-delete-submit').data('item-group-id', item_group_id );
2182                 $('#modal-item-group-delete-submit').removeAttr('disabled');
2183                 $('#modal-item-group-delete').modal('show');
2184             });
2185             $("#modal-item-group-delete-submit").on('click', function(){
2186                 $('#modal-item-group-delete-submit').attr('disabled', 'disabled');
2187                 const item_group_id = $("#modal-item-group-delete-submit").data('item-group-id');
2188
2189                 $.ajax({
2190                     url: `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`,
2191                     headers: { "x-koha-embed": "items" },
2192                     success: function(item_group_data){
2193                         $.ajax({
2194                           "url": `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`,
2195                           "method": "DELETE",
2196                         })
2197                         .done(function (response) {
2198                             $('#modal-item-group-delete').modal('hide');
2199                             $(`#item-group-add-form-select option[value='${item_group_id}']`).remove();
2200                             if ( item_group_data.items === null ) {
2201                                 // No items for this item group, we can just refresh the table
2202                                 itemGroupsTable.api().ajax.reload();
2203                             } else {
2204                                 // This item group had items attached to it, we need to reload the page
2205                                 window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`);
2206                             }
2207                         })
2208                         .fail(function(err) {
2209                             var message = err.responseJSON.error;
2210                             alert(message);
2211                         });
2212                     }
2213                 });
2214             });
2215
2216             // Add item(s) to a item group
2217             $('.itemselection_action_item_group_set').on('click', function(){
2218                 $('#modal-item-group-set').modal('show');
2219             });
2220
2221             $("#modal-item-group-set-form").validate({
2222                 submitHandler: function(form) {
2223                     $('#modal-item-group-set-submit').attr('disabled', 'disabled');
2224
2225                     const item_group_id = $('#item-group-add-form-select').val();
2226
2227                     let itemnumbers = new Array();
2228                     $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
2229                         const itemnumber = $(this).val();
2230                         itemnumbers.push( itemnumber );
2231                     });
2232                     if (itemnumbers.length > 0) {
2233                         let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_item_group';
2234                         url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2235                         url += '&biblionumber=[% biblionumber | uri %]';
2236                         url += `&item_group_id=${item_group_id}`;
2237
2238                         window.location.replace(url);
2239                     }
2240
2241                     $('#modal-item-group-set').modal('hide');
2242                 }
2243             });
2244
2245             // Remove item(s) from an item group
2246             $('.itemselection_action_item_group_unset').on('click', function(){
2247                 $('#modal-item-group-unset').modal('show');
2248             });
2249
2250             $("#modal-item-group-unset-submit").on('click', function(){
2251                 $('#modal-item-group-unset-submit').attr('disabled', 'disabled');
2252
2253                 let itemnumbers = new Array();
2254                 $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
2255                     const itemnumber = $(this).val();
2256                     itemnumbers.push( itemnumber );
2257                 });
2258                 if (itemnumbers.length > 0) {
2259                     let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_item_group';
2260                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2261                     url += '&biblionumber=[% biblionumber | uri %]';
2262
2263                     window.location.replace(url);
2264                 }
2265
2266                 $('#modal-item-group-unset').modal('hide');
2267
2268             });
2269         [% END %]
2270     </script>
2271 [% END %]
2272 [% INCLUDE 'intranet-bottom.inc' %]