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