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