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