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