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