Bug 28854: (follow-up) Make 'Manage bundle' button a 'toggle'
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / detail.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE KohaPlugins %]
6 [% USE AuthorisedValues %]
7 [% USE Branches %]
8 [% USE Biblio %]
9 [% USE Price %]
10 [% USE TablesSettings %]
11 [% PROCESS 'i18n.inc' %]
12
13 [% IF Koha.Preference('AmazonAssocTag') %]
14     [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
15 [% ELSE %]
16     [% AmazonAssocTag = '' %]
17 [% END %]
18
19 [% ShowCourseReserves = 0 | html %]
20 [% IF UseCourseReserves %]
21     [% FOREACH item IN itemloop %]
22        [% IF item.course_reserves %]
23            [% FOREACH r IN item.course_reserves %]
24                [% IF r.course.enabled == 'yes' %]
25                    [% ShowCourseReserves = 1 | html %]
26                [% END %]
27            [% END %]
28         [% END %]
29     [% END %]
30 [% END %]
31
32 [% SET plugins_intranet_catalog_biblio_tabs = KohaPlugins.get_plugins_intranet_catalog_biblio_tab({ biblio => biblio, biblio_id => biblionumber }) %]
33
34 [% SET footerjs = 1 %]
35 [% INCLUDE 'doc-head-open.inc' %]
36 <title>
37   [% IF ( unknownbiblionumber ) %]
38     Unknown record
39   [% ELSE %]
40     Details for [% INCLUDE 'biblio-title-head.inc' %]
41   [% END %] &rsaquo; Catalog &rsaquo; Koha
42 </title>
43 [% INCLUDE 'doc-head-close.inc' %]
44 [% Asset.css("lib/Chocolat/css/chocolat.css") | $raw %]
45 </head>
46
47 <body id="catalog_detail" class="catalog">
48
49 [% INCLUDE 'header.inc' %]
50 [% INCLUDE 'cat-search.inc' %]
51
52 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
53     <ol>
54         <li>
55             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
56         </li>
57         <li>
58             <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
59         </li>
60
61         [% IF ( unknownbiblionumber ) %]
62             <li>
63                 <a href="#" aria-current="page">
64                     Unknown record
65                 </a>
66             </li>
67         [% ELSE %]
68             <li>
69                 [% INCLUDE 'biblio-title.inc' link = 1 %]
70             </li>
71             <li>
72                 <a href="#" aria-current="page">
73                     Details
74                 </a>
75             </li>
76         [% END %]
77     </ol>
78 </nav>
79
80 <div class="main container-fluid">
81     <div class="row">
82         <div class="col-sm-10 col-sm-push-2">
83             <main>
84                 <div class="row">
85
86 [% IF ( unknownbiblionumber ) %]
87   <div class="dialog message">The record you requested does not exist ([% biblionumber | html %]).</div>
88 [% ELSE %]
89
90 [% IntranetCoce    = Koha.Preference('IntranetCoce') %]
91 [% CoceProviders   = Koha.Preference('CoceProviders') %]
92 [% CoceHost        = Koha.Preference('CoceHost') %]
93 [% SyndeticsCovers = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') %]
94
95 [% INCLUDE 'cat-toolbar.inc' %]
96     [% IF decoding_error %]
97         <div>
98            <span class="biberror">
99             There is an error with this bibliographic record, the view may be degraded.</span>
100             <span class="error"><br/> Error: [% decoding_error | html %]</span>
101         </div>
102     [% END %]
103     [% IF analytics_error %]
104         <div>
105            <span class="analytics_error">
106             There was an error searching for analytic records, please see the logs for details.</span>
107         </div>
108     [% END %]
109     [% IF ( ocoins ) %]
110         <!-- COinS / OpenURL -->
111         <span class="Z3988" title="[% ocoins | html %]"></span>
112     [% END %]
113
114     [% IF ( AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
115         <div id="catalogue_detail_biblio" class="col-xs-9">
116     [% ELSE %]
117         <div id="catalogue_detail_biblio" class="col-xs-12">
118     [% END %]
119
120         [% XSLTBloc | $raw %]
121
122         [% IF shelves.count %]
123             <span class="results_summary"><span class="label">Lists that include this title: </span>
124             [% FOREACH s IN shelves %]
125                 <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a>
126                 [% IF ( loop.last ) %][% ELSE %]|[% END %]
127             [% END %]
128             </span>
129         [% END %]
130         [% IF ( TagsEnabled &&  TagsShowOnDetail &&  TagLoop ) %]
131                 <span class="results_summary"><span class="label">Tags:</span>
132                     [% FOREACH TagLoo IN TagLoop %]
133                         [% IF ( CAN_user_tools_moderate_tags ) %]
134                         <a href="/cgi-bin/koha/tags/list.pl?tag=[% TagLoo.term |uri %]">[% TagLoo.term | html %]</a>
135                         [% ELSE %]
136                         [% TagLoo.term | html %]
137                         [% END %]
138                         <span class="weight">([% TagLoo.weight_total | html %])</span>[% IF ( loop.last ) %][% ELSE %], [% END %]
139                     [% END %]
140                     </span>
141         [% END %]
142         <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber | uri %]&amp;viewas=html" title="MARC" class="previewMARC">Show</a></span>
143         [% IF !item_level_itypes ||  Koha.Preference("BiblioItemtypeInfo") %]
144            <span class="results_summary itemtype"><span class="label">Itemtype:</span>
145           [% IF ( !noItemTypeImages && imageurl ) %]
146               <img src="[% imageurl | html %]" alt="" />
147           [% END %]
148           [% IF ( description ) %]
149             [% description | html %]
150           [% ELSE %]
151             [% itemtype | html %]
152           [% END %]
153           </span>
154         [% END %]
155
156         [% IF ( holdcount ) %]
157             <span class="results_summary">
158                 <span class="label">Holds:</span>
159                 <span class="number_box">
160                     [% IF CAN_user_reserveforothers_place_holds %]
161                         <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblionumber | uri %]">[% holdcount | html %]</a>
162                     [% ELSE %]
163                         <span>[% holdcount | html %]</span>
164                     [% END %]
165                 </span>
166             </span>
167         [% END %]
168
169         [% IF illrequests.count %]
170             <span class="results_summary">
171                 <span class="label">ILL requests:</span>
172                 [% IF CAN_user_ill %]
173                     [% FOREACH ill IN illrequests %]
174                         <a href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% ill.illrequest_id | uri %]">Request [% ill.illrequest_id | html %]</a>[% IF ! loop.last %], [% END %]
175                     [% END %]
176                 [% ELSE %]
177                     [% FOREACH ill IN illrequests %]
178                         <span>Request [% ill.illrequest_id | html %]</span>[% IF ! loop.last %], [% END %]
179                     [% END %]
180                 [% END %]
181             </span>
182         [% END %]
183
184         [% IF ( article_requests_count = Biblio.ArticleRequestsActiveCount( biblionumber ) ) %]
185             <span class="results_summary">
186                 <span class="label">Article requests:</span>
187                 <span class="number_box">
188                     <a href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% biblionumber | uri %]">[% article_requests_count | html %]</a>
189                 </span>
190             </span>
191         [% END %]
192
193         [% IF course_reserves %]
194             <span class="results_summary"><span class="label">Courses that have reserved this title: </span>
195             [% FOREACH c IN course_reserves %]
196                 <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% c.course_id | uri %]">[% c.course.course_name | html %]</a>
197                 [% IF ( loop.last ) %][% ELSE %]|[% END %]
198             [% END %]
199             </span>
200         [% END %]
201
202         [% IF ( AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
203             </div>
204             <div class="col-xs-3 bookcoverimg">
205                 <div id="biblio-cover-slider" class="cover-slider">
206                     [% IF ( LocalCoverImages ) %]
207                         [% IF localimages.count %]
208                             [% FOREACH image IN localimages %]
209                                 <div class="cover-image local-coverimg">
210                                     <a href="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
211                                         <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
212                                     </a>
213                                     <div class="hint">Local cover image</div>
214                                 </div>
215                             [% END %]
216                         [% END %]
217                     [% END %]
218
219                     [% IF ( AmazonCoverImages && normalized_isbn) %]
220                         <div class="cover-image" id="amazon-bookcoverimg">
221                             <a href="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.LZZZZZZZ.jpg" title="Amazon cover image">
222                                 <img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.MZZZZZZZ.jpg" alt="Amazon cover image" data-link="http://www.amazon[% AmazonTld | uri %]/gp/reader/[% normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"/>
223                             </a>
224                             <div class="hint">Image from Amazon.com</div>
225                         </div>
226                     [% END %]
227
228                     [% IF ( IntranetCoce && CoceProviders && normalized_isbn ) %]
229                         [% coce_id = normalized_ean || normalized_isbn %]
230                         <div class="cover-image" 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 %]" data-duedate="[% item.datedue | html %]">
377                 [% IF (StaffDetailItemSelection) %]
378                     <td style="text-align:center;vertical-align:middle">
379                         <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
380                     </td>
381                 [% END %]
382                     [% IF Koha.Preference('LocalCoverImages') && ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
383                         <td class="cover">
384                             <div class="bookcoverimg">
385                                 <div class="cover-slider">
386                                     [% FOREACH image IN item.cover_images %]
387                                         <div class="cover-image local-coverimg">
388                                             <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
389                                                 <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% item.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
390                                             </a>
391                                         </div>
392                                     [% END %]
393                                 </div>
394                             </div>
395                         </td>
396                     [% END %]
397
398                     [% IF ( item_level_itypes ) %]
399                         <td class="itype">
400                             [% 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 ([% item.bundled | html %]|[% item.bundled_lost | html %])</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="addToBundleModal" tabindex="-1" role="dialog" aria-labelledby="addToBundleLabel">
1235         <form id="addToBundleForm" 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="addToBundleLabel">Add to bundle</h3>
1241                     </div>
1242                     <div class="modal-body">
1243                         <div id="addResult"></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
1263     <div class="modal" id="removeFromBundleModal" tabindex="-1" role="dialog" aria-labelledby="removeFromBundleLabel">
1264         <form id="removeFromBundleForm" action="">
1265             <div class="modal-dialog" role="document">
1266                 <div class="modal-content">
1267                     <div class="modal-header">
1268                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1269                         <h3 id="removeFromBundleLabel">Remove from bundle</h3>
1270                     </div>
1271                     <div class="modal-body">
1272                         <div id="removeResult"></div>
1273                         <fieldset class="rows">
1274                             <ol>
1275                                 <li>
1276                                     <label class="required" for="external_id">Item barcode: </label>
1277                                     <input type="text" id="rm_external_id" name="external_id" required="required">
1278                                     <span class="required">Required</span>
1279                                 </li>
1280                             </ol>
1281                         </fieldset>
1282                     </div>
1283                     <div class="modal-footer">
1284                         <button type="submit" class="btn btn-default">Submit</button>
1285                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
1286                     </div>
1287                 </div>
1288             </div>
1289         </form>
1290     </div>
1291     [% END %]
1292
1293 [% MACRO jsinclude BLOCK %]
1294     [% INCLUDE 'catalog-strings.inc' %]
1295     [% Asset.js("js/catalog.js") | $raw %]
1296     [% Asset.js("js/recalls.js") | $raw %]
1297     [% Asset.js("js/coce.js") | $raw %]
1298     [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
1299     <script>
1300         var interface = "[% interface | html %]";
1301         var theme = "[% theme | html %]";
1302         // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
1303         function verify_cover_images() {
1304             // Loop over each container in the template which contains covers
1305             $(".cover-slider").each(function(){
1306                 var lightbox_descriptions = [];
1307                 $(this).find(".cover-image").each( function( index ){
1308                     var div = $(this);
1309                     // Find the image in the container
1310                     var img = div.find("img")[0];
1311                     if( $(img).length > 0 ){
1312                         var description = "";
1313                         if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){
1314                             // No image loaded in the container. Remove the slide
1315                             div.remove();
1316                         } else {
1317                             // All slides start hidden. If this is the first one, show it.
1318                             if( index == 0 ){
1319                                 div.show();
1320                             }
1321                             // Check if Amazon image is present
1322                             if ( div.attr("id") == "amazon-bookcoverimg"  ) {
1323                                 w = img.width;
1324                                 h = img.height;
1325                                 if ((w == 1) || (h == 1)) {
1326                                     // Amazon returned single-pixel placeholder
1327                                     // Remove the container
1328                                     div.remove();
1329                                 } else {
1330                                     lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1331                                 }
1332                             } else if( div.attr("id") == "custom-coverimg" ){
1333                                 if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
1334                                     // No image was loaded via the CustomCoverImages system preference
1335                                     // Remove the container
1336                                     div.remove();
1337                                 } else {
1338                                     lightbox_descriptions.push("Custom cover image");
1339                                 }
1340                             } else if ( div.attr("id") == "syndetics-bookcoverimg" ){
1341                                     lightbox_descriptions.push(_("Syndetics cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
1342                             }
1343                             else if( div.attr("id") == "coce-coverimg" ){
1344                                 // Identify which service's image is being loaded by Coce
1345                                 var coce_description;
1346                                 if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
1347                                     coce_description = ("Coce image from Amazon.com");
1348                                 } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
1349                                     coce_description = _("Coce image from Google Books");
1350                                 } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
1351                                     coce_description = _("Coce image from Open Library");
1352                                 }
1353                                 div.find(".hint").html(coce_description);
1354                                 lightbox_descriptions.push(coce_description);
1355                             } else if ( div.attr("class") == "cover-image local-coverimg" ) {
1356                                 lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link')));
1357                             } else {
1358                                 lightbox_descriptions.push(_("Cover image source unknown"));
1359                             }
1360                         }
1361                     }
1362                 });
1363
1364                 // Lightbox for cover images
1365                 Chocolat(this.querySelectorAll('.cover-image a'), {
1366                     description: function(){
1367                         return lightbox_descriptions[this.settings.currentImageIndex];
1368                     }
1369                 });
1370
1371             });
1372
1373             $(".cover-slider").each(function(){
1374                 var coverSlide = this;
1375                 var coverImages = $(this).find(".cover-image");
1376                 if( coverImages.length > 1 ){
1377                     coverImages.each(function( index ){
1378                         // If more that one image is present, add a navigation link
1379                         // for activating the slide
1380                         var covernav = $("<a href=\"#\" data-num=\"" + index + "\" class=\"cover-nav\"></a>");
1381                         if( index == 0 ){
1382                             // Set the first navigation link as active
1383                             $(covernav).addClass("nav-active");
1384                         }
1385                         $(covernav).html("<i class=\"fa fa-circle\"></i>");
1386                         $(coverSlide).append( covernav );
1387                     });
1388                 }
1389
1390                 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
1391                     && $(coverSlide).find(".cover-image:visible").length < 1 ){
1392                     $(coverSlide).remove();
1393                 } else {
1394                     $(coverSlide).addClass("cover-slides");
1395                 }
1396             });
1397
1398             $("#editions img").each(function(i){
1399                 if ( this.src.indexOf('amazon.com') >= 0 ) {
1400                     w = this.width;
1401                     h = this.height;
1402                     if ((w == 1) || (h == 1)) {
1403                         this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1404                     } else if ( (this.complete != null) && (!this.complete) || this.naturalHeight == 0 ) {
1405                         this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
1406                     }
1407                 }
1408             });
1409         }
1410
1411         function removeLocalImage(imagenumber) {
1412             var thumbnail = $("#imagenumber-" + imagenumber );
1413             var copy = thumbnail.html();
1414             thumbnail.find("img").css("opacity", ".2");
1415             thumbnail.find("a.remove").html("<img style='display:inline-block' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' />");
1416             $.ajax({
1417                 url: "/cgi-bin/koha/svc/cover_images?action=delete&imagenumber=" + imagenumber,
1418                 success: function(data) {
1419                     $(data).each( function(i) {
1420                         if ( this.deleted == 1 ) {
1421                             thumbnail.remove();
1422                         } else {
1423                             thumbnail.html( copy );
1424                             alert(_("An error occurred on deleting this image"));
1425                         }
1426                         if ( $('ul.thumbnails > li').length == 0 ) {
1427                             showNoImageMessage();
1428                         }
1429                     });
1430                 },
1431                 error: function(data) {
1432                     thumbnail.html( copy );
1433                     alert(_("An error occurred on deleting this image"));
1434                 }
1435             });
1436         }
1437
1438         function showNoImageMessage() {
1439             var no_images_msg = _("No images have been uploaded for this bibliographic record yet.");
1440             no_images_msg = '<p>' + no_images_msg + '</p>';
1441             [% IF ( CAN_user_tools_upload_local_cover_images ) %]
1442                 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>");
1443                 no_images_msg += "<p id='upload_image'>" + please_upload + '</p>';
1444             [% END %]
1445             $('#images').html(no_images_msg);
1446         }
1447
1448         [% IF StaffDetailItemSelection %]
1449             function itemSelectionBuildDeleteLink(div) {
1450                 var itemnumbers = new Array();
1451                 $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() {
1452                     itemnumbers.push($(this).val());
1453                 });
1454                 if (itemnumbers.length > 0) {
1455                     var url = '/cgi-bin/koha/tools/batchMod.pl?op=show&del=1';
1456                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1457                     url += '&biblionumber=[% biblionumber | uri %]';
1458                     url += '&src=CATALOGUING';
1459                     $('a.itemselection_action_delete').attr('href', url);
1460                 } else {
1461                     return false;
1462                 }
1463                 return true
1464             }
1465
1466             function itemSelectionBuildModifyLink(div) {
1467                 var itemnumbers = new Array();
1468                 $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() {
1469                     itemnumbers.push($(this).val());
1470                 });
1471                 if (itemnumbers.length > 0) {
1472                     var url = '/cgi-bin/koha/tools/batchMod.pl?op=show';
1473                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1474                     url += '&biblionumber=[% biblionumber | uri %]';
1475                     url += '&src=CATALOGUING';
1476                     $('a.itemselection_action_modify').attr('href', url);
1477                 } else {
1478                     return false;
1479                 }
1480                 return true;
1481             }
1482
1483             function itemSelectionBuildActionLinks(tab) {
1484                 var div = $("#" + tab);
1485                 var delete_link_ok = itemSelectionBuildDeleteLink(div);
1486                 var modify_link_ok = itemSelectionBuildModifyLink(div);
1487                 if (modify_link_ok || delete_link_ok) {
1488                     $('.itemselection_actions', div).show();
1489                 } else {
1490                     $('.itemselection_actions', div).hide();
1491                 }
1492             }
1493
1494             $(document).ready(function() {
1495                 $('table.items_table').each(function() {
1496                     var div = $(this).parent().attr("id");
1497                     itemSelectionBuildActionLinks(div);
1498                 });
1499
1500                 $("input[name='itemnumber'][type='checkbox']").change(function() {
1501                     var div = $(this).parents('table').parent().parent().attr("id");
1502                     itemSelectionBuildActionLinks(div);
1503                 });
1504
1505                 $(".SelectAll").on("click",function(e){
1506                     e.preventDefault();
1507                     var tab = $(this).data("tab");
1508                     $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', true);
1509                     itemSelectionBuildActionLinks(tab);
1510                 });
1511
1512                 $(".ClearAll").on("click",function(e){
1513                     e.preventDefault();
1514                     var tab = $(this).data("tab");
1515                     $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false);
1516                     itemSelectionBuildActionLinks(tab);
1517                 });
1518             });
1519         [% END %]
1520
1521         $(document).ready(function() {
1522             // Pick details tab to display by default
1523             [% IF count == 0 %]
1524                 [% IF ( Koha.Preference('HTML5MediaEnabled') == 'staff' or Koha.Preference('HTML5MediaEnabled') == 'both' ) && HTML5MediaSets.size %]
1525                     $(".nav-tabs a[href='#html5media']").tab("show");
1526                 [% ELSIF ComponentParts && ComponentParts.size %]
1527                     $(".nav-tabs a[href='#components']").tab("show");
1528                 [% ELSE %]
1529                     $(".nav-tabs a[href='#holdings']").tab("show");
1530                 [% END %]
1531             [% ELSE %]
1532                 $(".nav-tabs a[href='#holdings']").tab("show");
1533             [% END %]
1534             $('#search-form').focus();
1535             $('.thumbnails > li > .remove').click(function() {
1536                 var result = confirm(_("Are you sure you want to delete this cover image?"));
1537
1538                 if ( result == true ) {
1539                     var imagenumber = $(this).parent().attr('id').split('-')[1];
1540                     removeLocalImage(imagenumber);
1541                 }
1542
1543                 return false;
1544             });
1545             [% IF ( IntranetCoce && CoceProviders ) %]
1546                 KOHA.coce.getURL('[% CoceHost | html %]', '[% CoceProviders | html %]');
1547             [% END %]
1548
1549             $("body").on("click",".previewMARC", function(e){
1550                 e.preventDefault();
1551                 var page = $(this).attr("href");
1552                 $("#marcPreview .modal-body").load(page + " table");
1553                 $('#marcPreview').modal({show:true});
1554             });
1555             $("#marcPreview").on("hidden.bs.modal", function(){
1556                 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1557             });
1558             [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
1559                 novSelect.loadContentForQuery({
1560                     ClientIdentifier : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
1561                     ISBN : '[% IF normalized_isbn %][% normalized_isbn | html %][% ELSE %][% normalized_upc | html %][% END %]',
1562                     version : '2.1'
1563                 },
1564                 '[% Koha.Preference('NovelistSelectStaffProfile') | html %]',
1565                 '[% Koha.Preference('NovelistSelectPassword') | html %]',
1566                 function(d){
1567                     if ( d.length > 0 ){ //If no content
1568                         $(".NovelistSelect").show();
1569                     }
1570                  });
1571              [% END %]
1572              $(".print-label").on("click", function(e){
1573                 e.preventDefault();
1574                 link = $(this).attr("href");
1575                 openWindow(link,"Print spine label",400,400);
1576              });
1577              $(".cover-slider").on("click",".cover-nav", function(e){
1578                  e.preventDefault();
1579                 var cover_slider = $(this).parent();
1580                 // Adding click handler for cover image navigation links
1581                 var num = $(this).data("num");
1582                 $(cover_slider).find(".cover-nav").removeClass("nav-active");
1583                 $(this).addClass("nav-active");
1584                 $(cover_slider).find(".cover-image").hide();
1585                 $(cover_slider).find(".cover-image").eq( num ).show();
1586              });
1587         });
1588
1589         $(window).load(function() {
1590             verify_cover_images();
1591         });
1592     </script>
1593     [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && ( normalized_isbn || normalized_upc ) ) %]
1594         <script src="https://imageserver.ebscohost.com/novelistselect/ns2init.js"></script>
1595     [% END %]
1596     [% INCLUDE 'datatables.inc' %]
1597     [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
1598     [% INCLUDE 'columns_settings.inc' %]
1599     [% INCLUDE 'js-date-format.inc' %]
1600     [% INCLUDE 'js-patron-format.inc' %]
1601     [% INCLUDE 'js-biblio-format.inc' %]
1602     [% Asset.js("js/browser.js") | $raw %]
1603     [% Asset.js("js/table_filters.js") | $raw %]
1604     <script>
1605         var browser;
1606         browser = KOHA.browser('[% searchid | html %]', parseInt(biblionumber, 10));
1607         browser.show();
1608
1609         [% IF bundlesEnabled %]
1610         var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1611         var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1612         [% END %]
1613         $(document).ready(function() {
1614
1615             [% IF bundlesEnabled %] // Bundle handling
1616             function createChild ( row, itemnumber, duedate ) {
1617
1618                 // Toolbar
1619                 var bundle_toolbar = $('<div id="toolbar" class="btn-toolbar"></div>');
1620                 bundle_toolbar.append('<a class="btn btn-default" data-toggle="modal" data-target="#addToBundleModal" data-item="' + itemnumber + '"><i class="fa fa-plus"></i> ' + _("Add to bundle") + '</a>');
1621                 bundle_toolbar.append('<a class="btn btn-default" data-toggle="modal" data-target="#removeFromBundleModal" data-item="' + itemnumber + '"><i class="fa fa-minus"></i> ' + _("Remove from bundle") + '</a>');
1622
1623                 // Disable management if there's a duedate
1624                 if(duedate) {
1625                     bundle_toolbar.children('.btn').addClass("disabled");
1626                 }
1627
1628                 // This is the table we'll convert into a DataTable
1629                 var bundles_table = $('<table class="display tbundle" data-itemnumber="'+itemnumber+'" id="bundle_table_'+itemnumber+'" width="100%"/>');
1630
1631                 // Display it the child row
1632                 row.child( bundle_toolbar.add(bundles_table), 'bundle' ).show();
1633
1634                 // Initialise as a DataTable
1635                 var bundle_table_url = "/api/v1/items/" + itemnumber + "/bundled_items?";
1636                 var bundle_table = bundles_table.kohaTable({
1637                     "ajax": {
1638                         "url": bundle_table_url
1639                     },
1640                     "header_filter": false,
1641                     "embed": [
1642                         "biblio",
1643                         "return_claim.patron"
1644                     ],
1645                     "order": [[ 1, "asc" ]],
1646                     "columnDefs": [ {
1647                         "targets": [0,1,2,3,4,5],
1648                         "render": function (data, type, row, meta) {
1649                             if ( data && type == 'display' ) {
1650                                 return data.escapeHtml();
1651                             }
1652                             return data;
1653                         }
1654                     } ],
1655                     "columns": [
1656                         {
1657                             "data": "biblio.title:biblio.subtitle:biblio.medium",
1658                             "title": _("Title"),
1659                             "searchable": true,
1660                             "orderable": true,
1661                             "render": function(data, type, row, meta) {
1662                                 return $biblio_to_html(row.biblio, { link: 1 });
1663                             }
1664                         },
1665                         {
1666                             "data": "biblio.author",
1667                             "title": _("Author"),
1668                             "searchable": true,
1669                             "orderable": true,
1670                         },
1671                         {
1672                             "data": "collection_code",
1673                             "title": _("Collection"),
1674                             "searchable": true,
1675                             "orderable": true,
1676                         },
1677                         {
1678                             "data": "item_type",
1679                             "title": _("Item type"),
1680                             "searchable": false,
1681                             "orderable": true,
1682                         },
1683                         {
1684                             "data": "callnumber",
1685                             "title": _("Callnumber"),
1686                             "searchable": true,
1687                             "orderable": true,
1688                         },
1689                         {
1690                             "data": "external_id",
1691                             "title": _("Barcode"),
1692                             "searchable": true,
1693                             "orderable": true,
1694                         },
1695                         {
1696                             "data": "lost_status:last_seen_date:return_claim.patron",
1697                             "title": _("Status"),
1698                             "searchable": false,
1699                             "orderable": true,
1700                             "render": function(data, type, row, meta) {
1701                                 if ( row.lost_status == bundle_lost_value ) {
1702                                     let out = '<span class="lost">' + _("Last seen") + ': ' + $date(row.last_seen_date) + '</span>';
1703                                     if ( row.return_claim ) {
1704                                         out = out + '<span class="claims_return">' + _("Claims returned by") + ': ' + $patron_to_html( row.return_claim.patron, { display_cardnumber: false, url: true } ) + '</span>';
1705                                     }
1706                                     return out;
1707                                 }
1708                                 else if ( row.lost_status !== 0 ) {
1709                                     return '<span class="lost">' + _("Lost") + ': ' + row.lost_status + '</span>';
1710                                 }
1711                                 return '<span class="available">' + _("Present") + '</span>';
1712                             }
1713                         },
1714                         {
1715                             "data": function( row, type, val, meta ) {
1716                                 var result;
1717                                 if (duedate) {
1718                                     result = '<button class="btn btn-default btn-xs remove disabled" role="button" data-itemnumber="'+row.item_id+'"><i class="fa fa-minus" aria-hidden="true"></i> '+_("Remove")+'</button>\n';
1719                                 } else {
1720                                     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';
1721                                 }
1722                                 return result;
1723                             },
1724                             "title": _("Actions"),
1725                             "searchable": false,
1726                             "orderable": false,
1727                             "class": "noExport"
1728                         }
1729                     ]
1730                 }, bundle_settings, 1);
1731                 $(".tbundle").on("click", ".remove:not(.disabled)", function(){
1732                     var bundle_table = $(this).closest('table');
1733                     var host_itemnumber = bundle_table.data('itemnumber');
1734                     var component_itemnumber = $(this).data('itemnumber');
1735                     var unlink_item_url = "/api/v1/items/" + host_itemnumber + "/bundled_items/" + component_itemnumber;
1736                     $.ajax({
1737                         type: "DELETE",
1738                         url: unlink_item_url,
1739                         success: function(){
1740                             bundle_table.DataTable({ 'retrieve': true }).draw(false);
1741                         }
1742                     });
1743                 });
1744
1745                 return;
1746             }
1747
1748             var bundle_changed;
1749             var bundle_form_active;
1750             $("#addToBundleModal").on("shown.bs.modal", function(e){
1751                 var button = $(e.relatedTarget);
1752                 var item_id = button.data('item');
1753                 $("#addResult").replaceWith('<div id="addResult"></div>');
1754                 $("#addToBundleForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items');
1755                 $("#external_id").focus();
1756                 bundle_changed = 0;
1757                 bundle_form_active = item_id;
1758             });
1759
1760             $("#addToBundleForm").submit(function(event) {
1761
1762                   /* stop form from submitting normally */
1763                   event.preventDefault();
1764
1765                   /* get the action attribute from the <form action=""> element */
1766                   var $form = $(this),
1767                   url = $form.attr('action');
1768
1769                   /* Send the data using post with external_id */
1770                   var posting = $.post({
1771                       url: url,
1772                       data: JSON.stringify({ external_id: $('#external_id').val()}),
1773                       contentType: "application/json; charset=utf-8",
1774                       dataType: "json"
1775                   });
1776
1777                   /* Report the results */
1778                   posting.done(function(data) {
1779                       var barcode = $('#external_id').val();
1780                       $('#addResult').replaceWith('<div id="addResult" class="alert alert-success">'+_("Success: Added '%s'").format(barcode)+'</div>');
1781                       $('#external_id').val('').focus();
1782                       bundle_changed = 1;
1783                   });
1784                   posting.fail(function(data) {
1785                       var barcode = $('#external_id').val();
1786                       if ( data.status === 409 ) {
1787                           var response = data.responseJSON;
1788                           if ( response.key === "PRIMARY" ) {
1789                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
1790                           } else {
1791                               $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' belongs to another bundle").format(barcode)+'</div>');
1792                           }
1793                       } else if ( data.status === 404 ) {
1794                           $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' not found").format(barcode)+'</div>');
1795                       } else {
1796                           $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Check the logs for details")+'</div>');
1797                       }
1798                       $('#external_id').val('').focus();
1799                   });
1800             });
1801
1802             $("#addToBundleModal").on("hidden.bs.modal", function(e){
1803                 if ( bundle_changed ) {
1804                     $('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload();
1805                 }
1806                 bundle_form_active = 0;
1807                 bundle_changed = 0;
1808             });
1809
1810             $("#removeFromBundleModal").on("shown.bs.modal", function(e){
1811                 var button = $(e.relatedTarget);
1812                 var item_id = button.data('item');
1813                 $("#removeResult").replaceWith('<div id="removeResult"></div>');
1814                 $("#removeFromBundleForm").attr('action', '/api/v1/items/' + item_id + '/bundled_items/');
1815                 $("#rm_external_id").focus();
1816                 bundle_changed = 0;
1817                 bundle_form_active = item_id;
1818             });
1819
1820             $("#removeFromBundleForm").submit(function(event) {
1821
1822                 /* stop form from submitting normally */
1823                 event.preventDefault();
1824
1825                 /* get the action attribute from the <form action=""> element */
1826                 var $form = $(this),
1827                 url = $form.attr('action');
1828
1829                 var barcode = $('#rm_external_id').val();
1830
1831                 /* Fetch itemnumber using rm_external_id */
1832                 var itemReq = $.get('/api/v1/items', { q: JSON.stringify({
1833                     external_id: barcode
1834                 }) }, null, "json");
1835
1836                 var itemnumber;
1837                 itemReq.done(function(data) {
1838                     if (data.length === 1) {
1839                         itemnumber = data[0].item_id;
1840
1841                         /* Remove link using fetch itemnumber */
1842                         var deleteReq = $.ajax( url + itemnumber, {
1843                             type : 'DELETE'
1844                         });
1845
1846                         /* Report the results */
1847                         deleteReq.done(function(data) {
1848                             var barcode = $('#rm_external_id').val();
1849                             $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-success">'+_("Success: Removed '%s'").format(barcode)+'</div>');
1850                             $('#rm_external_id').val('').focus();
1851                             bundle_changed = 1;
1852                         });
1853                         deleteReq.fail(function(data) {
1854                             var barcode = $('#rm_external_id').val();
1855                             if ( data.status === 409 ) {
1856                                 var response = data.responseJSON;
1857                                 if ( response.key === "PRIMARY" ) {
1858                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-warning">'+_("Warning: Item '%s' already attached").format(barcode)+'</div>');
1859                                 } else {
1860                                     $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Item '%s' belongs to another bundle").format(barcode)+'</div>');
1861                                 }
1862                             } else if ( data.status === 404 ) {
1863                                 $('#addResult').replaceWith('<div id="addResult" class="alert alert-danger">'+_("Failure: Item '%s' not found").format(barcode)+'</div>');
1864                             } else {
1865                                 $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failure: Check the logs for details")+'</div>');
1866                             }
1867                             $('#rm_external_id').val('').focus();
1868                         });
1869                     } else {
1870                         $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failed: Barcode matched more than one item '%s'").format(barcode)+'</div>');
1871                     }
1872                 });
1873                 itemReq.fail(function(data) {
1874                      $('#removeResult').replaceWith('<div id="removeResult" class="alert alert-danger">'+_("Failed: Item not found '%s'").format(barcode)+'</div>');
1875                     $('#rm_external_id').val('').focus();
1876
1877                 });
1878             });
1879
1880             $("#removeFromBundleModal").on("hidden.bs.modal", function(e){
1881                 if ( bundle_changed ) {
1882                     $('#bundle_table_'+bundle_form_active).DataTable({ 'retrieve': true }).ajax.reload();
1883                 }
1884                 bundle_form_active = 0;
1885                 bundle_changed = 0;
1886             });
1887             // End bundle handling
1888             [% END %]
1889
1890             var table_names = [ 'holdings_table', 'otherholdings_table' ];
1891             var table_settings = [ [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %] ];
1892             var has_images = [ "[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]" ];
1893             table_names.forEach( function( table_name, index ) {
1894                 if ( !has_images[index] ) {
1895                     table_settings[index].columns.splice(1,1);
1896                 }
1897                 var dt_parameters = {
1898                     'sDom': 't',
1899                     'bPaginate': false,
1900                     'bAutoWidth': false,
1901                     "bKohaColumnsUseNames": true,
1902                     "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
1903                 };
1904                 var table = KohaTable( table_name, dt_parameters, table_settings[index], 'with_filters' );
1905
1906                 [% IF bundlesEnabled %]
1907                 // Add event listener for opening and closing bundle details
1908                 $('#' + table_name + ' tbody').on('click', 'button.details-control', function () {
1909                     var button = $(this);
1910                     var tr = button.closest('tr');
1911                     var dTable = button.closest('table').DataTable({ 'retrieve': true });
1912
1913                     var itemnumber = tr.data('itemnumber');
1914                     var duedate = tr.data('duedate');
1915                     var row = dTable.row( tr );
1916
1917                     if ( row.child.isShown() ) {
1918                         // This row is already open - close it
1919                         row.child.hide();
1920                         tr.removeClass('shown');
1921                         button.removeClass('active');
1922                     }
1923                     else {
1924                         // Open this row
1925                         createChild(row, itemnumber, duedate);
1926                         tr.addClass('shown');
1927                         button.addClass('active');
1928                     }
1929                 } );
1930                 [% END %]
1931             });
1932
1933             [% IF Koha.Preference('AcquisitionDetails') %]
1934                 var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
1935                 var acquisitiondetails_table = KohaTable("orders", {
1936                     "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
1937                     'bPaginate': false,
1938                     'bAutoWidth': false,
1939                     "aaSorting": [[ 4, "desc" ]],
1940                 }, table_settings);
1941             [% END %]
1942
1943             [% IF suggestions.count %]
1944                 $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
1945                     "aoColumnDefs": [
1946                         { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
1947                         { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
1948                     ],
1949                     "sPaginationType": "full"
1950                 }));
1951             [% END %]
1952
1953         });
1954
1955         [% IF (found1) %]
1956             $(document).ready(function() {
1957                 var search_index = localStorage.getItem("cat_search_pulldown_selection");
1958                 var search_value = localStorage.getItem("searchbox_value");
1959                 if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
1960                 if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
1961             });
1962         [% END %]
1963
1964         [% IF Koha.Preference('EnableItemGroups') %]
1965             // Load item groups table
1966             var itemGroupsTable = KohaTable("items-group-table", {
1967                 "bAutoWidth": false,
1968                 'sDom': '<"top pager"ilp>t<"bottom pager"ip>r',
1969                 "aoColumns": [
1970                     {
1971                         "mDataProp": function( oObj ) {
1972                             return oObj.display_order;
1973                         },
1974                     },
1975                     {
1976                         "mDataProp": function( oObj ) {
1977                             return oObj.description;
1978                         },
1979                     },
1980                     {
1981                         "mDataProp": function( oObj ) {
1982                             [% IF CAN_user_editcatalogue_manage_item_groups %]
1983                                 return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
1984                                     <i class='fa fa-edit'></i> ${_("Edit")}
1985                                 </button>`
1986                                 + '&nbsp'
1987                                 + `<button class='item-group-delete btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
1988                                     <i class='fa fa-trash'></i> ${('Delete')}
1989                                 </button>`;
1990                             [% ELSE %]
1991                                 return "";
1992                             [% END %]
1993                         },
1994                     },
1995                 ],
1996                 "bPaginate": false,
1997                 "bProcessing": true,
1998                 "bServerSide": false,
1999                 "sAjaxSource": `/api/v1/biblios/${biblionumber}/item_groups?_per_page=-1`,
2000                 "sAjaxDataProp": "",
2001                 "fnServerData": function ( sSource, aoData, fnCallback ) {
2002                     $.getJSON( sSource, aoData, function (json) {
2003                         fnCallback(json)
2004                     } );
2005                 },
2006             });
2007
2008             // Create new item groups
2009             $('.item-group-create').on('click', function(){
2010                 $('#modal-item-group-create-form-description').val("");
2011                 $('#modal-item-group-create-submit').removeAttr('disabled');
2012                 $('#modal-item-group-create').modal('show');
2013             });
2014
2015             $("#modal-item-group-create-form").validate({
2016                 submitHandler: function(form) {
2017                     $.ajax({
2018                         url: `/api/v1/biblios/${biblionumber}/item_groups`,
2019                         headers: { "x-koha-embed": "items" },
2020                         success: function(item_groups){
2021                             $('#modal-item-group-create-submit').attr('disabled', 'disabled');
2022
2023                             var settings = {
2024                               "url": `/api/v1/biblios/${biblionumber}/item_groups`,
2025                               "method": "POST",
2026                               "headers": {
2027                                 "Content-Type": "application/json"
2028                               },
2029                               "data": JSON.stringify(
2030                                   {
2031                                       "description": $("#modal-item-group-create-form-description").val(),
2032                                       "display_order": $("#modal-item-group-create-form-display_order").val(),
2033                                   }
2034                               ),
2035                             };
2036
2037                             $.ajax(settings)
2038                             .done(function (response) {
2039                                 $('#item-group-add-form-select').append($('<option>', {
2040                                     value: response.item_group_id,
2041                                     text: response.description
2042                                 }));
2043
2044                                 $('#modal-item-group-create').modal('hide');
2045                                 if ( item_groups.length == 0 ) {
2046                                     // This bib has no previous item groups, reload the page
2047                                     window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`);
2048                                 } else {
2049                                     // Has other item groups, just reload the table
2050                                     itemGroupsTable.api().ajax.reload();
2051                                 }
2052                             })
2053                             .fail(function(err) {
2054                                 var message = err.responseJSON.error;
2055                                 alert(message);
2056                             });
2057                         }
2058                     });
2059                 }
2060             });
2061
2062             $('#modal-item-group-create').on('shown.bs.modal', function () {
2063                 $('#modal-item-group-create-form-description').focus();
2064             })
2065
2066             // Edit existing item groups
2067             $('body').on( 'click', '.item-group-edit', function(){
2068                 const item_group_id = $(this).data('item-group-id');
2069                 const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`;
2070                 $.get( url, function( data ) {
2071                     $('#modal-item-group-edit-form-description').val( data.description );
2072                     $('#modal-item-group-edit-form-display_order').val( data.display_order );
2073                     $('#modal-item-group-edit-submit').data('item-group-id', item_group_id );
2074                     $('#modal-item-group-edit-submit').removeAttr('disabled');
2075                     $('#modal-item-group-edit').modal('show');
2076                 });
2077             });
2078
2079             $("#modal-item-group-edit-form").validate({
2080                 submitHandler: function(form) {
2081                     $('#modal-item-group-edit-submit').attr('disabled', 'disabled');
2082
2083                     const item_group_id = $('#modal-item-group-edit-submit').data('item-group-id');
2084                     const url = `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`;
2085
2086                     var settings = {
2087                       "url": url,
2088                       "method": "PUT",
2089                       "headers": {
2090                         "Content-Type": "application/json"
2091                       },
2092                       "data": JSON.stringify(
2093                           {
2094                               "description": $("#modal-item-group-edit-form-description").val(),
2095                               "display_order": $("#modal-item-group-edit-form-display_order").val(),
2096                           }
2097                       ),
2098                     };
2099
2100                     $.ajax(settings)
2101                     .done(function (response) {
2102                         $('#modal-item-group-edit').modal('hide');
2103                         itemGroupsTable.api().ajax.reload();
2104                     })
2105                     .fail(function(err) {
2106                         var message = err.responseJSON.error;
2107                         alert(message);
2108                     });
2109                 }
2110             });
2111
2112             $('#modal-item-group-edit').on('shown.bs.modal', function () {
2113                 $('#modal-item-group-edit-form-description').focus();
2114             })
2115
2116             // Delete existing item groups
2117             $('body').on( 'click', '.item-group-delete', function(){
2118                 const item_group_id = $(this).data('item-group-id');
2119                 $('#modal-item-group-delete-submit').data('item-group-id', item_group_id );
2120                 $('#modal-item-group-delete-submit').removeAttr('disabled');
2121                 $('#modal-item-group-delete').modal('show');
2122             });
2123             $("#modal-item-group-delete-submit").on('click', function(){
2124                 $('#modal-item-group-delete-submit').attr('disabled', 'disabled');
2125                 const item_group_id = $("#modal-item-group-delete-submit").data('item-group-id');
2126
2127                 $.ajax({
2128                     url: `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`,
2129                     headers: { "x-koha-embed": "items" },
2130                     success: function(item_group_data){
2131                         $.ajax({
2132                           "url": `/api/v1/biblios/${biblionumber}/item_groups/${item_group_id}`,
2133                           "method": "DELETE",
2134                         })
2135                         .done(function (response) {
2136                             $('#modal-item-group-delete').modal('hide');
2137                             $(`#item-group-add-form-select option[value='${item_group_id}']`).remove();
2138                             if ( item_group_data.items === null ) {
2139                                 // No items for this item group, we can just refresh the table
2140                                 itemGroupsTable.api().ajax.reload();
2141                             } else {
2142                                 // This item group had items attached to it, we need to reload the page
2143                                 window.location.replace(`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${biblionumber}`);
2144                             }
2145                         })
2146                         .fail(function(err) {
2147                             var message = err.responseJSON.error;
2148                             alert(message);
2149                         });
2150                     }
2151                 });
2152             });
2153
2154             // Add item(s) to a item group
2155             $('.itemselection_action_item_group_set').on('click', function(){
2156                 $('#modal-item-group-set').modal('show');
2157             });
2158
2159             $("#modal-item-group-set-form").validate({
2160                 submitHandler: function(form) {
2161                     $('#modal-item-group-set-submit').attr('disabled', 'disabled');
2162
2163                     const item_group_id = $('#item-group-add-form-select').val();
2164
2165                     let itemnumbers = new Array();
2166                     $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
2167                         const itemnumber = $(this).val();
2168                         itemnumbers.push( itemnumber );
2169                     });
2170                     if (itemnumbers.length > 0) {
2171                         let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_item_group';
2172                         url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2173                         url += '&biblionumber=[% biblionumber | uri %]';
2174                         url += `&item_group_id=${item_group_id}`;
2175
2176                         window.location.replace(url);
2177                     }
2178
2179                     $('#modal-item-group-set').modal('hide');
2180                 }
2181             });
2182
2183             // Remove item(s) from an item group
2184             $('.itemselection_action_item_group_unset').on('click', function(){
2185                 $('#modal-item-group-unset').modal('show');
2186             });
2187
2188             $("#modal-item-group-unset-submit").on('click', function(){
2189                 $('#modal-item-group-unset-submit').attr('disabled', 'disabled');
2190
2191                 let itemnumbers = new Array();
2192                 $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
2193                     const itemnumber = $(this).val();
2194                     itemnumbers.push( itemnumber );
2195                 });
2196                 if (itemnumbers.length > 0) {
2197                     let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_item_group';
2198                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2199                     url += '&biblionumber=[% biblionumber | uri %]';
2200
2201                     window.location.replace(url);
2202                 }
2203
2204                 $('#modal-item-group-unset').modal('hide');
2205
2206             });
2207         [% END %]
2208     </script>
2209 [% END %]
2210 [% INCLUDE 'intranet-bottom.inc' %]