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