View | Details | Raw Unified | Return to bug 41566
Collapse All | Expand All

(-)a/catalogue/detail.pl (-2 lines)
Lines 174-181 my $fw = GetFrameworkCode($biblionumber); Link Here
174
my $showallitems = $query->param('showallitems');
174
my $showallitems = $query->param('showallitems');
175
my $marcflavour  = C4::Context->preference("marcflavour");
175
my $marcflavour  = C4::Context->preference("marcflavour");
176
176
177
$template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
178
179
$template->param( ocoins => !$invalid_marc_record ? $biblio->get_coins : undef );
177
$template->param( ocoins => !$invalid_marc_record ? $biblio->get_coins : undef );
180
178
181
# some useful variables for enhanced content;
179
# some useful variables for enhanced content;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (-133 / +156 lines)
Lines 42-48 Link Here
42
                [% IF Koha.Preference('EasyAnalyticalRecords') %]<th id="[% tab | html %]_hostrecord" data-colname="hostrecord">Host records</th>[% END %]
42
                [% IF Koha.Preference('EasyAnalyticalRecords') %]<th id="[% tab | html %]_hostrecord" data-colname="hostrecord">Host records</th>[% END %]
43
                [% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="usedin">Used in</th><th></th>[% END %]
43
                [% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="usedin">Used in</th><th></th>[% END %]
44
                [% IF Koha.Preference('UseCourseReserves') %]<th id="[% tab | html %]_course_reserves" data-colname="course_reserves">Course reserves</th>[% END %]
44
                [% IF Koha.Preference('UseCourseReserves') %]<th id="[% tab | html %]_course_reserves" data-colname="course_reserves">Course reserves</th>[% END %]
45
                [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="spinelabel" class="no-sort">Spine label</th>[% END %]
45
                [% IF Koha.Preference('SpineLabelShowPrintOnBibDetails') %]<th id="[% tab | html %]_spinelabel" data-colname="spinelabel" class="no-sort">Spine label</th>[% END %]
46
                [% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="actions" class="no-sort no-export">&nbsp;</th>[% END %]
46
                [% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="actions" class="no-sort no-export">&nbsp;</th>[% END %]
47
            </tr>
47
            </tr>
48
        </thead>
48
        </thead>
Lines 95-101 Link Here
95
[% BLOCK build_items_table_js %]
95
[% BLOCK build_items_table_js %]
96
    <script>
96
    <script>
97
        let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %];
97
        let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %];
98
        const all_libraries = [% To.json(Branches.all) | $raw %].map(e => {
99
                    e["_id"] = e["branchcode"];
100
                    e["_str"] = e["branchname"];
101
                    return e;
102
                });
103
        const libraries_names = new Map(all_libraries.map( l => [l.branchcode, l.branchname] ));
104
        const all_item_types = [% To.json(ItemTypes.Get) | $raw %].map(e => {
105
                    e["_id"] = e["itemtype"];
106
                    e["_str"] = e["translated_description"];
107
                    return e;
108
                });
109
        const item_types_notforloan = new Map(all_item_types.map( it => [it.itemtype, it.notforloan] ));
110
111
        const can_edit_items_from = [% To.json(can_edit_items_from || []) | $raw %];
112
        const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %];
113
        const av_loc = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.location' })) | $raw %].map( av => [av.lib, av.authorised_value]));
114
        const av_lost = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.itemlost' })) | $raw %].map( av => [av.authorised_value, av.lib]));
115
        const av_withdrawn = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.withdrawn' })) | $raw %].map( av => [av.authorised_value, av.lib]));
116
        const av_damaged = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.damaged' })) | $raw %].map( av => [av.authorised_value, av.lib]));
117
        const av_not_for_loan= new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.notforloan' })) | $raw %].map( av => [av.authorised_value, av.lib]));
118
        const av_restricted = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.restricted' })) | $raw %].map( av => [av.authorised_value, av.lib]));
119
        [% IF Koha.Preference('UseCourseReserves') %]
120
            const av_courses_term = new Map([% To.json(AuthorisedValues.Get('TERM')) | $raw %].map( av => [av.authorised_value, av.lib]));
121
        [% END %]
122
        const av_ccode = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.ccode' })) | $raw %].map( av => [av.lib, av.authorised_value]));
123
124
        [% IF Koha.Preference('URLLinkText') %]
125
            const url_link_text = "[% Koha.Preference('URLLinkText') | html %]";
126
        [% ELSE %]
127
            const url_link_text = _("Link to resource");
128
        [% END %]
98
129
130
        var biblionumber = [% biblio.biblionumber | html %];
131
        const is_serial = [% biblio.serial ? 1 : 0 | html %];
132
        const analyze = [% analyze ? 1 : 0 | html %];
133
        const hidden_count = [% hidden_count ? 1 : 0 | html %];
134
        const bundlesEnabled = [% bundlesEnabled ? 1 : 0 | html %];
135
        addPrefs({
136
            LocalCoverImages: [% Koha.Preference('LocalCoverImages') ? 1 : 0 | html %],
137
            OPACLocalCoverImages: [% Koha.Preference('OPACLocalCoverImages') ? 1 : 0 | html %],
138
            EnableItemGroups: [% Koha.Preference('EnableItemGroups') ? 1 : 0 | html %],
139
            UseRecalls: [% Koha.Preference('UseRecalls') ? 1 : 0 | html %],
140
            UseCourseReserves: [% Koha.Preference('UseCourseReserves') ? 1 : 0 | html %],
141
            ClaimReturnedLostValue: [% Koha.Preference('ClaimReturnedLostValue') | html %],
142
            EasyAnalyticalRecords: [% Koha.Preference('EasyAnalyticalRecords') ? 1 : 0| html %],
143
            SeparateHoldings: [% Koha.Preference('SeparateHoldings') ? 1 : 0 | html %],
144
            SeparateHoldingsBranch: "[% Koha.Preference('SeparateHoldingsBranch') || 'homebranch' | html %]",
145
            item_level_itypes: [% item_level_itypes ? 1 : 0 | html %],
146
            noItemTypeImages: [% Koha.Preference('noItemTypeImages') ? 1 : 0 | html %],
147
            DisplayPublishedDate: [% Koha.Preference('DisplayPublishedDate') ? 1 : 0 | html %],
148
            canreservefromotherbranches: [% Koha.Preference('canreservefromotherbranches') ? 1 : 0 | html %],
149
            SpineLabelShowPrintOnBibDetails: [% Koha.Preference('SpineLabelShowPrintOnBibDetails') ? 1 : 0 | html %],
150
        });
151
        addPermissions({
152
            CAN_user_editcatalogue_edit_items: [% CAN_user_editcatalogue_edit_items ? 1 : 0 | html %],
153
        });
154
        const logged_in_branchcode = '[% Branches.GetLoggedInBranchcode() | html %]';
155
156
        var items_table_settings = {
157
            holdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %],
158
            otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %],
159
        };
160
161
        let table_nodes = {
162
            holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]",
163
            otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]",
164
        };
165
166
    </script>
167
168
    <script>
99
        let items_selection = {};
169
        let items_selection = {};
100
170
101
        function _itemSelectionBuildLink(tab_id, link_class) {
171
        function _itemSelectionBuildLink(tab_id, link_class) {
Lines 205-243 Link Here
205
            });
275
            });
206
        });
276
        });
207
277
208
        const all_libraries = [% To.json(Branches.all) | $raw %].map(e => {
209
                    e["_id"] = e["branchcode"];
210
                    e["_str"] = e["branchname"];
211
                    return e;
212
                });
213
        const libraries_names = new Map(all_libraries.map( l => [l.branchcode, l.branchname] ));
214
        const all_item_types = [% To.json(ItemTypes.Get) | $raw %].map(e => {
215
                    e["_id"] = e["itemtype"];
216
                    e["_str"] = e["translated_description"];
217
                    return e;
218
                });
219
        const item_types_notforloan = new Map(all_item_types.map( it => [it.itemtype, it.notforloan] ));
220
221
        const statuses = {checked_out: _("Checked out"), local_use: _("On-site checkout"), in_transit: _("In transit"), lost: _("Lost"), withdrawn: _("Withdrawn"), damaged:_("Damaged"), not_for_loan: _("Not for loan"), on_hold: _("On hold"), recalled: _("Recalled"), available: _("Available"), restricted: _("Restricted"), in_bundle: _("In bundle")};
278
        const statuses = {checked_out: _("Checked out"), local_use: _("On-site checkout"), in_transit: _("In transit"), lost: _("Lost"), withdrawn: _("Withdrawn"), damaged:_("Damaged"), not_for_loan: _("Not for loan"), on_hold: _("On hold"), recalled: _("Recalled"), available: _("Available"), restricted: _("Restricted"), in_bundle: _("In bundle")};
222
        const all_statuses = Object.keys(statuses).map(k => {return {_id: k, _str: statuses[k]}});
279
        const all_statuses = Object.keys(statuses).map(k => {return {_id: k, _str: statuses[k]}});
223
280
224
        const can_edit_items_from = [% To.json(can_edit_items_from || []) | $raw %];
225
        const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %];
226
        const av_loc = new Map([% To.json(AuthorisedValues.Get('LOC')) | $raw %].map( av => [av.authorised_value, av.lib]));
227
        const av_lost = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.itemlost' })) | $raw %].map( av => [av.authorised_value, av.lib]));
228
        const av_withdrawn = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.withdrawn' })) | $raw %].map( av => [av.authorised_value, av.lib]));
229
        const av_damaged = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.damaged' })) | $raw %].map( av => [av.authorised_value, av.lib]));
230
        const av_not_for_loan= new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.notforloan' })) | $raw %].map( av => [av.authorised_value, av.lib]));
231
        const av_restricted = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.restricted' })) | $raw %].map( av => [av.authorised_value, av.lib]));
232
        [% IF Koha.Preference('UseCourseReserves') %]
233
            const av_courses_term = new Map([% To.json(AuthorisedValues.Get('TERM')) | $raw %].map( av => [av.authorised_value, av.lib]));
234
        [% END %]
235
236
        var coded_values = {
281
        var coded_values = {
237
            library: new Map(all_libraries.map( l => [l.branchname, l.branchcode] )),
282
            library: new Map(all_libraries.map( l => [l.branchname, l.branchcode] )),
238
            item_type: new Map(all_item_types.map( i => [i.translated_description, i.itemtype] )),
283
            item_type: new Map(all_item_types.map( i => [i.translated_description, i.itemtype] )),
239
            collection_code: new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.ccode' })) | $raw %].map( av => [av.lib, av.authorised_value])),
284
            collection_code: av_ccode,
240
            location: new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.location' })) | $raw %].map( av => [av.lib, av.authorised_value])),
285
            location: av_loc,
241
        };
286
        };
242
287
243
        let filters_options = {
288
        let filters_options = {
Lines 247-301 Link Here
247
            statuses: all_statuses,
292
            statuses: all_statuses,
248
        };
293
        };
249
294
250
        [% IF Koha.Preference('URLLinkText') %]
295
        // FIXME The X-Base-Total-Count will be the number of items of the biblios
251
            const url_link_text = "[% Koha.Preference('URLLinkText') | html %]";
296
        // In case or SeparateHoldings we may need to display the number of biblios in each tab
252
        [% ELSE %]
297
        // Do we need separate/new endpoints or do we hack the somewhere client-side?
253
            const url_link_text = _("Link to resource");
298
        let item_table_url = `/api/v1/biblios/${biblionumber}/items?`;
254
        [% END %]
255
        [%# FIXME The X-Base-Total-Count will be the number of items of the biblios %]
256
        [%# In case or SeparateHoldings we may need to display the number of biblios in each tab %]
257
        [%# Do we need separate/new endpoints or do we hack the somewhere client-side? %]
258
        let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?";
259
        let embed = ["+strings,_status,home_library,holding_library,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"];
299
        let embed = ["+strings,_status,home_library,holding_library,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"];
260
        [% IF Koha.Preference('LocalCoverImages') %]
300
        if (prefs.LocalCoverImages){
261
            embed.push('cover_image_ids');
301
            embed.push('cover_image_ids');
262
        [% END %]
302
        }
263
        [% IF Koha.Preference('EnableItemGroups') %]
303
        if (prefs.EnableItemGroups){
264
            embed.push('item_group_item.item_group.description');
304
            embed.push('item_group_item.item_group.description');
265
        [% END %]
305
        }
266
        [% IF biblio.serial %]
306
        if (is_serial){
267
            embed.push('serial_item.serial');
307
            embed.push('serial_item.serial');
268
        [% END %]
308
        }
269
        [% IF Koha.Preference('UseRecalls') %]
309
        if (prefs.UseRecalls){
270
            embed.push('recall', 'recall+strings', 'recall.patron')
310
            embed.push('recall', 'recall+strings', 'recall.patron')
271
        [% END %]
311
        }
272
        embed.push('in_bundle', 'bundle_host', 'bundle_host.biblio', 'bundle_items_lost+count', 'bundle_items_not_lost+count');
312
        embed.push('in_bundle', 'bundle_host', 'bundle_host.biblio', 'bundle_items_lost+count', 'bundle_items_not_lost+count');
273
        [% IF Koha.Preference('UseCourseReserves') %]
313
        if (prefs.UseCourseReserves){
274
            embed.push('course_item.course_reserves.course');
314
            embed.push('course_item.course_reserves.course');
275
        [% END %]
315
        }
276
        [% IF Koha.Preference('ClaimReturnedLostValue') %]
316
        if (prefs.ClaimReturnedLostValue){
277
            embed.push('return_claims');
317
            embed.push('return_claims');
278
        [% END %]
318
        }
279
319
280
        [% IF Koha.Preference('EasyAnalyticalRecords') %]
320
        if (prefs.EasyAnalyticalRecords){
281
            // For host records
321
            // For host records
282
            embed.push('biblio.title');
322
            embed.push('biblio.title');
283
        [% END %]
323
        }
284
324
285
        [% IF analyze %]
325
        if (analyze){
286
            embed.push('analytics_count');
326
            embed.push('analytics_count');
287
        [% END %]
327
        }
288
289
        var items_table_settings = {
290
            holdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %],
291
            otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %],
292
        };
293
328
294
        let user_colvis = {holdings: {}, otherholdings: {}};
329
        let user_colvis = {holdings: {}, otherholdings: {}};
295
        let table_nodes = {
296
            holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]",
297
            otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]",
298
        };
299
        function build_items_table (tab_id, add_filters, dt_options, drawcallback) {
330
        function build_items_table (tab_id, add_filters, dt_options, drawcallback) {
300
331
301
            let table_dt;
332
            let table_dt;
Lines 311-329 Link Here
311
                user_colvis[tab_id] = user_colvis_bak;
342
                user_colvis[tab_id] = user_colvis_bak;
312
            }
343
            }
313
            let default_filters = {};
344
            let default_filters = {};
314
            [% IF Koha.Preference('SeparateHoldings') %]
345
            if (prefs.SeparateHoldings){
315
                [% SET SeparateHoldingsBranch = Koha.Preference('SeparateHoldingsBranch') || 'homebranch' %];
346
                let branch = prefs.SeparateHoldingsBranch == 'homebranch' ? 'me.home_library_id' : 'me.holding_library_id';
316
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
317
                if ( tab_id == 'holdings' ) {
347
                if ( tab_id == 'holdings' ) {
318
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
348
                    default_filters[branch] = logged_in_branchcode;
319
                } else {
349
                } else {
320
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
350
                    default_filters[branch] = { '!=': logged_in_branchcode };
321
                }
351
                }
322
            [% END %]
352
            }
323
353
324
            [% IF hidden_count %]
354
            if (hidden_count){
325
                default_filters.lost_status = "0";
355
                default_filters.lost_status = "0";
326
            [% END %]
356
            }
327
            if ( !items_selection.hasOwnProperty(tab_id) ){
357
            if ( !items_selection.hasOwnProperty(tab_id) ){
328
                items_selection[tab_id] = [];
358
                items_selection[tab_id] = [];
329
            }
359
            }
Lines 332-344 Link Here
332
                return $("#" + tab_id + "_status select").val();
362
                return $("#" + tab_id + "_status select").val();
333
            };
363
            };
334
364
335
            var items_table = $("#" + tab_id + '_table').kohaTable({
365
var columns = [
336
                ajax: { url: item_table_url },
337
                order: [],
338
                embed,
339
                autoWidth: false,
340
                bKohaColumnsUseNames: true,
341
                columns: [
342
                {
366
                {
343
                    data: "me.item_id",
367
                    data: "me.item_id",
344
                    searchable: false,
368
                    searchable: false,
Lines 355-362 Link Here
355
                        }
379
                        }
356
                    }
380
                    }
357
                },
381
                },
358
                [% IF Koha.Preference('LocalCoverImages') %]
382
                ...(prefs.LocalCoverImages ?
359
                {
383
                [{
360
                    data: "",
384
                    data: "",
361
                    className: "cover",
385
                    className: "cover",
362
                    searchable: false,
386
                    searchable: false,
Lines 378-387 Link Here
378
                        node += '</div>';
402
                        node += '</div>';
379
                        return node;
403
                        return node;
380
                    }
404
                    }
381
                },
405
                }] : []),
382
                [% END %]
406
                ...(prefs.item_level_itypes ?
383
                [% IF ( item_level_itypes ) %]
407
                [{
384
                {
385
                    data: "me.item_type_id", // FIXME Cannot filter by biblioitem.itemtype
408
                    data: "me.item_type_id", // FIXME Cannot filter by biblioitem.itemtype
386
                    datatype: "coded_value:item_type",
409
                    datatype: "coded_value:item_type",
387
                    dataFilter: "item_types",
410
                    dataFilter: "item_types",
Lines 391-407 Link Here
391
                    render: function (data, type, row, meta) {
414
                    render: function (data, type, row, meta) {
392
                        let node = '';
415
                        let node = '';
393
                        let item_type_description = row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id;
416
                        let item_type_description = row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id;
394
                        [% UNLESS noItemTypeImages %]
417
                        if (prefs.noItemTypeImages){
395
                            let image_location = item_type_image_locations[row.item_type_id];
418
                            let image_location = item_type_image_locations[row.item_type_id];
396
                            node += image_location
419
                            node += image_location
397
                                ? '<img class="itemtype-image" src="%s" alt="" /> '.format(escape_str(image_location), escape_str(item_type_description), escape_str(item_type_description))
420
                                ? '<img class="itemtype-image" src="%s" alt="" /> '.format(escape_str(image_location), escape_str(item_type_description), escape_str(item_type_description))
398
                                : '';
421
                                : '';
399
                        [% END %]
422
                        }
400
                        node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(item_type_description));
423
                        node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(item_type_description));
401
                        return node;
424
                        return node;
402
                    }
425
                    }
403
                },
426
                }] : []),
404
                [% END %]
405
                {
427
                {
406
                    data: "holding_library.name:me.holding_library_id",
428
                    data: "holding_library.name:me.holding_library_id",
407
                    datatype: "coded_value:library",
429
                    datatype: "coded_value:library",
Lines 431-439 Link Here
431
                    orderable: true,
453
                    orderable: true,
432
                    render: function (data, type, row, meta) {
454
                    render: function (data, type, row, meta) {
433
                        let nodes = '<span class="shelvingloc">';
455
                        let nodes = '<span class="shelvingloc">';
434
                        [%# If permanent location is defined, show description or code and             %]
456
                        // If permanent location is defined, show description or code and
435
                        [%# display current location in parentheses. If not, display current location. %]
457
                        // display current location in parentheses. If not, display current location.
436
                        [%# Note that permanent location is a code, and location may be an authval.    %]
458
                        // Note that permanent location is a code, and location may be an authval.
437
                        let loc_str = row._strings.location ? row._strings.location.str : row.location;
459
                        let loc_str = row._strings.location ? row._strings.location.str : row.location;
438
                        if ( row.permanent_location && row.permanent_location != row.location ) {
460
                        if ( row.permanent_location && row.permanent_location != row.location ) {
439
                            let permanent_loc_str = av_loc.get(row.permanent_location);
461
                            let permanent_loc_str = av_loc.get(row.permanent_location);
Lines 454-461 Link Here
454
                        return escape_str(row._strings.collection_code ? row._strings.collection_code.str : row.collection_code);
476
                        return escape_str(row._strings.collection_code ? row._strings.collection_code.str : row.collection_code);
455
                    }
477
                    }
456
                },
478
                },
457
                [% IF Koha.Preference('EnableItemGroups') %]
479
                ...(prefs.EnableItemGroups ?
458
                {
480
                [{
459
                    data: "item_group_item.item_group.description",
481
                    data: "item_group_item.item_group.description",
460
                    className: "item_group",
482
                    className: "item_group",
461
                    searchable: true,
483
                    searchable: true,
Lines 467-474 Link Here
467
                            return "";
489
                            return "";
468
                        }
490
                        }
469
                    }
491
                    }
470
                },
492
                }] : []),
471
                [% END %]
472
                {
493
                {
473
                    data: "me.callnumber",
494
                    data: "me.callnumber",
474
                    className: "itemcallnumber",
495
                    className: "itemcallnumber",
Lines 486-492 Link Here
486
                    orderable: true,
507
                    orderable: true,
487
                    render: function (data, type, row, meta) {
508
                    render: function (data, type, row, meta) {
488
                        let nodes = "";
509
                        let nodes = "";
489
                        [%# FIXME Previously we displayed the column if at least one item of the biblio had an enumchron/serial_issue_number. Now it's only if one item of the ones displayed on the current page, how is that bad? How can it be fixed in an elegant way? Should we display the column only if biblio.serial? %]
510
                        // FIXME Previously we displayed the column if at least one item of the biblio had an enumchron/serial_issue_number. Now it's only if one item of the ones displayed on the current page, how is that bad? How can it be fixed in an elegant way? Should we display the column only if biblio.serial?
490
                        let serial = row.serial_item ? row.serial_item.serial : null;
511
                        let serial = row.serial_item ? row.serial_item.serial : null;
491
                        if ( row.serial_issue_number && serial && serial.serialseq ) {
512
                        if ( row.serial_issue_number && serial && serial.serialseq ) {
492
                            nodes += '<span class="enum">%s</span>'.format(escape_str(row.serial_issue_number));
513
                            nodes += '<span class="enum">%s</span>'.format(escape_str(row.serial_issue_number));
Lines 499-509 Link Here
499
                        } else if ( serial && serial.serialseq ) {
520
                        } else if ( serial && serial.serialseq ) {
500
                            nodes += '<span class="serialseq">%s</span>'.format(escape_str(serial.serialseq));
521
                            nodes += '<span class="serialseq">%s</span>'.format(escape_str(serial.serialseq));
501
                        }
522
                        }
502
                        [% IF Koha.Preference('DisplayPublishedDate') %]
523
                        if (prefs.DisplayPublishedDate){
503
                            if ( serial && serial.publisheddate ) {
524
                            if ( serial && serial.publisheddate ) {
504
                                nodes += ' <span class="pubdate">(%s)</span>'.format($date(serial.publisheddate));
525
                                nodes += ' <span class="pubdate">(%s)</span>'.format($date(serial.publisheddate));
505
                            }
526
                            }
506
                        [% END %]
527
                        }
507
                        return nodes;
528
                        return nodes;
508
                    }
529
                    }
509
                },
530
                },
Lines 519-525 Link Here
519
                            if ( status == 'checked_out' || status == 'local_use') {
540
                            if ( status == 'checked_out' || status == 'local_use') {
520
                                nodes += '<span>';
541
                                nodes += '<span>';
521
542
522
                                [%# Hacky for patron_to_html in case we simply want to display the patron's library name %]
543
                                // Hacky for patron_to_html in case we simply want to display the patron's library name
523
                                row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) };
544
                                row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) };
524
                                let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name });
545
                                let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name });
525
546
Lines 574-606 Link Here
574
                                    } else {
595
                                    } else {
575
                                        nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s since %s.").format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date)));
596
                                        nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s since %s.").format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date)));
576
                                    }
597
                                    }
577
                                    [% IF Koha.Preference('canreservefromotherbranches') %]
598
                                    if (prefs.canreservefromotherbranches){
578
                                        if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) {
599
                                        if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) {
579
                                            [%# Hacky for patron_to_html in case we simply want to display the patron's library name %]
600
                                            // Hacky for patron_to_html in case we simply want to display the patron's library name
580
                                            row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) };
601
                                            row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) };
581
602
582
                                            let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name });
603
                                            let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name });
583
                                            nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html));
604
                                            nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html));
584
                                        }
605
                                        }
585
                                    [% END %]
606
                                    }
586
                                } else {
607
                                } else {
587
                                    nodes += ' <span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority));
608
                                    nodes += ' <span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority));
588
                                }
609
                                }
589
                            }
610
                            }
590
611
591
                        [% IF Koha.Preference('UseRecalls') %]
612
                        if (prefs.UseRecalls){
592
                            if ( row.recall && ( row.item_id === row.recall.item_id ) ) {
613
                            if ( row.recall && ( row.item_id === row.recall.item_id ) ) {
593
                                if ( row.recall.waiting_date ) {
614
                                if ( row.recall.waiting_date ) {
594
                                    nodes += '<span class="holding_status recallwaiting">%s</span>'.format(_("Waiting recall at %s since %s").format(escape_str(row.recall._strings.pickup_library_id.str), $date(row.recall.waiting_date)));
615
                                    nodes += '<span class="holding_status recallwaiting">%s</span>'.format(_("Waiting recall at %s since %s").format(escape_str(row.recall._strings.pickup_library_id.str), $date(row.recall.waiting_date)));
595
                                } else {
616
                                } else {
596
                                    [%# Hacky for patron_to_html in case we simply want to display the patron's library name %]
617
                                    // Hacky for patron_to_html in case we simply want to display the patron's library name
597
                                    row.recall.patron.library = { name: libraries_names.get(row.recall.patron.library_id) };
618
                                    row.recall.patron.library = { name: libraries_names.get(row.recall.patron.library_id) };
598
619
599
                                    let patron_to_html = $patron_to_html(row.recall.patron, {url: true, display_cardnumber: true, hide_patron_name });
620
                                    let patron_to_html = $patron_to_html(row.recall.patron, {url: true, display_cardnumber: true, hide_patron_name });
600
                                    nodes += '<span class="holding_status recalledby">%s</span>'.format(_("Recalled by %s on %s").format(patron_to_html, $date(row.recall.created_date)))
621
                                    nodes += '<span class="holding_status recalledby">%s</span>'.format(_("Recalled by %s on %s").format(patron_to_html, $date(row.recall.created_date)))
601
                                }
622
                                }
602
                            }
623
                            }
603
                        [% END %]
624
                        }
604
                            if ( status == 'available' ) {
625
                            if ( status == 'available' ) {
605
                                nodes += ' <span>%s</span>'.format(_("Available"))
626
                                nodes += ' <span>%s</span>'.format(_("Available"))
606
                            }
627
                            }
Lines 759-777 Link Here
759
                        return escape_str(row.internal_notes);
780
                        return escape_str(row.internal_notes);
760
                    }
781
                    }
761
                },
782
                },
762
                [% IF Koha.Preference('EasyAnalyticalRecords') %]
783
                ...(prefs.EasyAnalyticalRecords?
763
                {
784
                [{
764
                    data: "biblio.title",
785
                    data: "biblio.title",
765
                    searchable: false,
786
                    searchable: false,
766
                    orderable: true,
787
                    orderable: true,
767
                    render: function (data, type, row, meta) {
788
                    render: function (data, type, row, meta) {
768
                        if ( row.biblio_id == [% biblio.biblionumber | html %] ) return "";
789
                        if ( row.biblio_id == biblionumber ) return "";
769
                        return '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=%s">%s</a>'.format(row.biblio_id, row.biblio.title);
790
                        return '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=%s">%s</a>'.format(row.biblio_id, row.biblio.title);
770
                    }
791
                    }
771
                },
792
                }]:[]),
772
                [% END %]
793
                ...(analyze ?
773
                [% IF analyze %]
794
                [{
774
                {
775
                    data: "analytics_count",
795
                    data: "analytics_count",
776
                    searchable: false,
796
                    searchable: false,
777
                    orderable: false,
797
                    orderable: false,
Lines 787-796 Link Here
787
                    render: function (data, type, row, meta) {
807
                    render: function (data, type, row, meta) {
788
                        return '<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=%s&amp;hostitemnumber=%s">%s</a>'.format(row.biblio_id, row.item_id, _("Create analytics"));
808
                        return '<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=%s&amp;hostitemnumber=%s">%s</a>'.format(row.biblio_id, row.item_id, _("Create analytics"));
789
                    }
809
                    }
790
                },
810
                }]:[]),
791
                [% END %]
811
                ...(prefs.UseCourseReserves?
792
                [% IF Koha.Preference('UseCourseReserves') %]
812
                [{
793
                {
794
                    data: "course_item.course_reserves.course.course_name",
813
                    data: "course_item.course_reserves.course.course_name",
795
                    searchable: true,
814
                    searchable: true,
796
                    orderable: true,
815
                    orderable: true,
Lines 813-858 Link Here
813
                        });
832
                        });
814
                        return nodes;
833
                        return nodes;
815
                    }
834
                    }
816
                },
835
                }]:[]),
817
                [% END %]
836
                ...(prefs.SpineLabelShowPrintOnBibDetails?
818
                [% IF ( SpineLabelShowPrintOnBibDetails ) %]
837
                [{
819
                {
820
                    data: "",
838
                    data: "",
821
                    searchable: false,
839
                    searchable: false,
822
                    orderable: false,
840
                    orderable: false,
823
                    render: function (data, type, row, meta) {
841
                    render: function (data, type, row, meta) {
824
                        return '<a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=%s"><i class="fa fa-print"></i> Print label</a>'.format(escape_str(row.external_id));
842
                        return '<a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=%s"><i class="fa fa-print"></i> Print label</a>'.format(escape_str(row.external_id));
825
                    }
843
                    }
826
                },
844
                }]:[]),
827
                [% END %]
845
                ...(permissions.CAN_user_editcatalogue_edit_items ?
828
                [% IF CAN_user_editcatalogue_edit_items %]
846
                [{
829
                {
830
                    data: function( row, type, val, meta ) {
847
                    data: function( row, type, val, meta ) {
831
                        let nodes = '';
848
                        let nodes = '';
832
                        if ( can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length ){
849
                        if ( can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length ){
833
                            [% IF Koha.Preference('LocalCoverImages') OR Koha.Preference('OPACLocalCoverImages') %]
850
                            if (prefs.LocalCoverImages || prefs.OPACLocalCoverImages){
834
                                nodes += '<div class="btn-group dropup">';
851
                                nodes += '<div class="btn-group dropup">';
835
                                nodes += ' <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a><a class="btn btn-default btn-xs dropdown-toggle" data-bs-toggle="dropdown"><span class="caret"></span></a>'.format(row.biblio_id, row.item_id, _("Edit"));
852
                                nodes += ' <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a><a class="btn btn-default btn-xs dropdown-toggle" data-bs-toggle="dropdown"><span class="caret"></span></a>'.format(row.biblio_id, row.item_id, _("Edit"));
836
                                nodes += ' <ul class="dropdown-menu">';
853
                                nodes += ' <ul class="dropdown-menu">';
837
                                nodes += '  <li><a class="dropdown-item" href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=%s&amp;filetype=image"><i class="fa fa-upload"></i> %s</a></li>'.format(row.item_id, _("Upload image"));
854
                                nodes += '  <li><a class="dropdown-item" href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=%s&amp;filetype=image"><i class="fa fa-upload"></i> %s</a></li>'.format(row.item_id, _("Upload image"));
838
                                nodes += ' </ul>';
855
                                nodes += ' </ul>';
839
                                nodes += '</div>';
856
                                nodes += '</div>';
840
                            [% ELSE %]
857
                            } else {
841
                                nodes += '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a>'.format(row.biblio_id, row.item_id, _("Edit"));
858
                                nodes += '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a>'.format(row.biblio_id, row.item_id, _("Edit"));
842
                            [% END %]
859
                            }
843
                        }
860
                        }
844
                        [% IF bundlesEnabled %]
861
                        if (bundlesEnabled){
845
                            nodes += '<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> %s</button>'.format(_("Manage bundle (%s|%s)").format(row.bundle_items_not_lost_count, row.bundle_items_lost_count));
862
                            nodes += '<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> %s</button>'.format(_("Manage bundle (%s|%s)").format(row.bundle_items_not_lost_count, row.bundle_items_lost_count));
846
                        [% END %]
863
                        }
847
864
848
                        return nodes;
865
                        return nodes;
849
                    },
866
                    },
850
                    className: "actions",
867
                    className: "actions",
851
                    searchable: false,
868
                    searchable: false,
852
                    orderable: false
869
                    orderable: false
853
                }
870
                }]:[])
854
                [% END %]
871
                ];
855
                ],
872
            var items_table = $("#" + tab_id + '_table').kohaTable({
873
                ajax: { url: item_table_url },
874
                order: [],
875
                embed,
876
                autoWidth: false,
877
                bKohaColumnsUseNames: true,
878
                columns,
856
                initComplete: function( settings, json ){
879
                initComplete: function( settings, json ){
857
                    itemSelectionBuildActionLinks(tab_id);
880
                    itemSelectionBuildActionLinks(tab_id);
858
                },
881
                },
Lines 885-897 Link Here
885
                        container.find(".bottom.pager").remove();
908
                        container.find(".bottom.pager").remove();
886
                    }
909
                    }
887
910
888
                    [% IF ( SpineLabelShowPrintOnBibDetails ) %]
911
                    if (prefs.SpineLabelShowPrintOnBibDetails){
889
                         $(".print-label").on("click", function(e){
912
                         $(".print-label").on("click", function(e){
890
                            e.preventDefault();
913
                            e.preventDefault();
891
                            link = $(this).attr("href");
914
                            link = $(this).attr("href");
892
                            openWindow(link,"Print spine label",400,400);
915
                            openWindow(link,"Print spine label",400,400);
893
                        });
916
                        });
894
                    [% END %]
917
                    }
895
918
896
                    if ( api.data().length ) {
919
                    if ( api.data().length ) {
897
                        update_columns_visibility(api, items_table_settings[tab_id], user_colvis[tab_id]);
920
                        update_columns_visibility(api, items_table_settings[tab_id], user_colvis[tab_id]);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-31 / +72 lines)
Lines 1290-1299 Link Here
1290
        [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1290
        [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1291
    [% END %]
1291
    [% END %]
1292
    [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
1292
    [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
1293
        <script>
1294
            var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'concerns', 'table_concerns', 'json' ) | $raw %];
1295
            const biblio_id = "[% biblionumber | html %]";
1296
        </script>
1297
1293
        <script>
1298
        <script>
1294
            $(document).ready(function() {
1299
            $(document).ready(function() {
1295
                $("#bibliodetails a:first").tab("show");
1300
                $("#bibliodetails a:first").tab("show");
1296
                var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'concerns', 'table_concerns', 'json' ) | $raw %];
1297
1301
1298
                let additional_filters = {
1302
                let additional_filters = {
1299
                    resolved_date: function(){
1303
                    resolved_date: function(){
Lines 1304-1310 Link Here
1304
                        }
1308
                        }
1305
                    },
1309
                    },
1306
                    source: 'catalog',
1310
                    source: 'catalog',
1307
                    biblio_id: [% biblionumber | uri %]
1311
                    biblio_id,
1308
                };
1312
                };
1309
                let external_filter_nodes = {
1313
                let external_filter_nodes = {
1310
                    hide_resolved_concerns: "#hide_resolved_concerns",
1314
                    hide_resolved_concerns: "#hide_resolved_concerns",
Lines 1737-1742 Link Here
1737
    [% IF Koha.Preference('EnableBooking') %]
1741
    [% IF Koha.Preference('EnableBooking') %]
1738
        [% Asset.js("js/modals/place_booking.js") | $raw %]
1742
        [% Asset.js("js/modals/place_booking.js") | $raw %]
1739
    [% END %]
1743
    [% END %]
1744
1740
    <script>
1745
    <script>
1741
        var browser;
1746
        var browser;
1742
        browser = KOHA.browser("[% searchid | html %]", parseInt(biblionumber, 10));
1747
        browser = KOHA.browser("[% searchid | html %]", parseInt(biblionumber, 10));
Lines 1744-1764 Link Here
1744
1749
1745
        [% IF bundlesEnabled %]
1750
        [% IF bundlesEnabled %]
1746
            var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1751
            var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1747
            var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1748
        [% END %]
1752
        [% END %]
1749
1753
1754
        addPrefs({
1755
            AlwaysShowHoldingsTableFilters: [% Koha.Preference('AlwaysShowHoldingsTableFilters') ? 1 : 0 | html %],
1756
            bundlesEnabled: [% Koha.Preference('bundlesEnabled') ? 1 : 0 | html %],
1757
            BundleLostValue: "[% Koha.Preference('BundleLostValue') | html %]",
1758
        });
1759
1760
        addPermissions({
1761
            CAN_user_editcatalogue_manage_item_groups: [% CAN_user_editcatalogue_manage_item_groups ? 1 : 0 | html %],
1762
        });
1763
    </script>
1764
1765
    <script>
1750
        let items_tab_ids = [ 'holdings', 'otherholdings' ];
1766
        let items_tab_ids = [ 'holdings', 'otherholdings' ];
1751
        items_tab_ids.forEach( function( tab_id, index ) {
1767
        items_tab_ids.forEach( function( tab_id, index ) {
1752
1768
1753
            // Early return if the tab is not shown (ie. no table)
1769
            // Early return if the tab is not shown (ie. no table)
1754
            if (!$("#%s_table".format(tab_id)).length) return;
1770
            if (!$("#%s_table".format(tab_id)).length) return;
1755
            [% IF Koha.Preference('AlwaysShowHoldingsTableFilters') %]
1771
            if (prefs.AlwaysShowHoldingsTableFilters){
1756
                build_items_table(tab_id, true, {}, build_items_table_drawncallback);
1772
                build_items_table(tab_id, true, {}, build_items_table_drawncallback);
1757
            [% ELSE %]
1773
            } else {
1758
                build_items_table(tab_id, false, {}, build_items_table_drawncallback);
1774
                build_items_table(tab_id, false, {}, build_items_table_drawncallback);
1759
            [% END %]
1775
            }
1760
1776
1761
            [% IF bundlesEnabled %]
1777
            if (prefs.bundlesEnabled){
1762
                // Add event listener for opening and closing bundle details
1778
                // Add event listener for opening and closing bundle details
1763
                $('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
1779
                $('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
1764
                    var button = $(this);
1780
                    var button = $(this);
Lines 1782-1791 Link Here
1782
                        button.addClass('active');
1798
                        button.addClass('active');
1783
                    }
1799
                    }
1784
                });
1800
                });
1785
            [% END # /IF bundlesEnabled %]
1801
            }
1786
        });
1802
        });
1787
1803
1788
        [% IF bundlesEnabled %] // Bundle handling
1804
        if (bundlesEnabled){ // Bundle handling
1789
            function createChild ( row, itemnumber, duedate ) {
1805
            function createChild ( row, itemnumber, duedate ) {
1790
                // Toolbar
1806
                // Toolbar
1791
                var bundle_toolbar = $('<div id="toolbar" class="btn-toolbar"></div>');
1807
                var bundle_toolbar = $('<div id="toolbar" class="btn-toolbar"></div>');
Lines 1863-1869 Link Here
1863
                            "searchable": false,
1879
                            "searchable": false,
1864
                            "orderable": false,
1880
                            "orderable": false,
1865
                            "render": function(data, type, row, meta) {
1881
                            "render": function(data, type, row, meta) {
1866
                                if ( row.lost_status == bundle_lost_value ) {
1882
                                if ( row.lost_status == prefs.BundleLostValue ) {
1867
                                    let out = '<span class="lost">' + _("Last seen") + ': ' + $date(row.last_seen_date) + '</span>';
1883
                                    let out = '<span class="lost">' + _("Last seen") + ': ' + $date(row.last_seen_date) + '</span>';
1868
                                    if ( row.return_claim ) {
1884
                                    if ( row.return_claim ) {
1869
                                        out = out + '<span class="claims_return">' + _("Claims returned by") + ': ' + $patron_to_html( row.return_claim.patron, { display_cardnumber: false, url: true } ) + '</span>';
1885
                                        out = out + '<span class="claims_return">' + _("Claims returned by") + ': ' + $patron_to_html( row.return_claim.patron, { display_cardnumber: false, url: true } ) + '</span>';
Lines 2093-2103 Link Here
2093
                bundle_changed = 0;
2109
                bundle_changed = 0;
2094
            });
2110
            });
2095
            // End bundle handling
2111
            // End bundle handling
2096
        [% END # /IF bundlesEnabled %]
2112
        }
2113
    </script>
2097
2114
2098
        $(document).ready(function() {
2115
    [% IF Koha.Preference('AcquisitionDetails') %]
2099
            [% IF Koha.Preference('AcquisitionDetails') %]
2116
        <script>
2100
                var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
2117
            var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
2118
        </script>
2119
2120
        <script>
2121
            $(document).ready(function() {
2101
                var acquisitiondetails_table = $("#orders").kohaTable(
2122
                var acquisitiondetails_table = $("#orders").kohaTable(
2102
                    {
2123
                    {
2103
                        dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
2124
                        dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
Lines 2107-2122 Link Here
2107
                    },
2128
                    },
2108
                    table_settings
2129
                    table_settings
2109
                );
2130
                );
2110
            [% END %]
2131
            });
2132
        </script>
2133
    [% END %]
2111
2134
2112
            [% IF suggestions.count %]
2135
    [% IF suggestions.count %]
2136
        <script>
2137
            $(document).ready(function() {
2113
                $("#suggestions").kohaTable({
2138
                $("#suggestions").kohaTable({
2114
                    pagingType: "full",
2139
                    pagingType: "full",
2115
                });
2140
                });
2116
            [% END %]
2141
            });
2142
        </script>
2143
    [% END %]
2144
2145
    [% IF ( reviews ) %]
2146
        <script>
2147
            var comment_table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'comments-table', 'json') | $raw %];
2148
        </script>
2149
2150
        <script>
2151
            $(document).ready(function() {
2117
2152
2118
            [% IF ( reviews ) %]
2119
                var comment_table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'comments-table', 'json') | $raw %];
2120
                var comments_table = $("#comments_table").kohaTable(
2153
                var comments_table = $("#comments_table").kohaTable(
2121
                    {
2154
                    {
2122
                        paging: false,
2155
                        paging: false,
Lines 2125-2143 Link Here
2125
                    },
2158
                    },
2126
                    comment_table_settings
2159
                    comment_table_settings
2127
                );
2160
                );
2128
            [% END %]
2161
            });
2129
        });
2162
        </script>
2163
    [% END %]
2130
2164
2131
        [% IF found1 && Koha.Preference('RetainCatalogSearchTerms') %]
2165
    [% IF found1 && Koha.Preference('RetainCatalogSearchTerms') %]
2166
        <script>
2132
            $(document).ready(function() {
2167
            $(document).ready(function() {
2133
                var search_index = localStorage.getItem("cat_search_pulldown_selection");
2168
                var search_index = localStorage.getItem("cat_search_pulldown_selection");
2134
                var search_value = localStorage.getItem("searchbox_value");
2169
                var search_value = localStorage.getItem("searchbox_value");
2135
                if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
2170
                if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
2136
                if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
2171
                if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
2137
            });
2172
            });
2138
        [% END %]
2173
        </script>
2174
    [% END %]
2175
2176
    [% IF Koha.Preference('EnableItemGroups') %]
2177
        <script>
2178
            $(document).ready(function() {
2139
2179
2140
        [% IF Koha.Preference('EnableItemGroups') %]
2141
            // Load item groups table
2180
            // Load item groups table
2142
            var itemGroupsTable = $("#items-group-table").kohaTable({
2181
            var itemGroupsTable = $("#items-group-table").kohaTable({
2143
                autoWidth: false,
2182
                autoWidth: false,
Lines 2157-2163 Link Here
2157
                    },
2196
                    },
2158
                    {
2197
                    {
2159
                        data: function( oObj ) {
2198
                        data: function( oObj ) {
2160
                            [% IF CAN_user_editcatalogue_manage_item_groups %]
2199
                            if (permissions.CAN_user_editcatalogue_manage_item_groups){
2161
                                return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2200
                                return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2162
                                    <i class="fa-solid fa-pencil" aria-hidden="true"></i> ${_("Edit")}
2201
                                    <i class="fa-solid fa-pencil" aria-hidden="true"></i> ${_("Edit")}
2163
                                </button>`
2202
                                </button>`
Lines 2165-2173 Link Here
2165
                                + `<button class='item-group-delete btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2204
                                + `<button class='item-group-delete btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2166
                                    <i class='fa fa-trash-can'></i> ${('Delete')}
2205
                                    <i class='fa fa-trash-can'></i> ${('Delete')}
2167
                                </button>`;
2206
                                </button>`;
2168
                            [% ELSE %]
2207
                            } else {
2169
                                return "";
2208
                                return "";
2170
                            [% END %]
2209
                            }
2171
                        },
2210
                        },
2172
                        searchable: false,
2211
                        searchable: false,
2173
                        orderable: false,
2212
                        orderable: false,
Lines 2342-2348 Link Here
2342
                    if (itemnumbers.length > 0) {
2381
                    if (itemnumbers.length > 0) {
2343
                        let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_item_group';
2382
                        let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_item_group';
2344
                        url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2383
                        url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2345
                        url += '&biblionumber=[% biblionumber | uri %]';
2384
                        url += '&biblionumber=' + biblionumber;
2346
                        url += `&item_group_id=${item_group_id}`;
2385
                        url += `&item_group_id=${item_group_id}`;
2347
2386
2348
                        window.location.replace(url);
2387
                        window.location.replace(url);
Lines 2368-2374 Link Here
2368
                if (itemnumbers.length > 0) {
2407
                if (itemnumbers.length > 0) {
2369
                    let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_item_group';
2408
                    let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_item_group';
2370
                    url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2409
                    url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2371
                    url += '&biblionumber=[% biblionumber | uri %]';
2410
                    url += '&biblionumber=' + biblionumber;
2372
2411
2373
                    window.location.replace(url);
2412
                    window.location.replace(url);
2374
                }
2413
                }
Lines 2376-2383 Link Here
2376
                $('#modal-item-group-unset').modal('hide');
2415
                $('#modal-item-group-unset').modal('hide');
2377
            });
2416
            });
2378
2417
2379
        [% END # /IF EnableItemGroups %]
2418
        });
2419
        </script>
2420
    [% END # /IF EnableItemGroups %]
2380
2421
2422
    <script>
2381
        $(".delete-comment").on("click", function(){
2423
        $(".delete-comment").on("click", function(){
2382
            return confirm( _("Are you sure you want to delete this comment?") );
2424
            return confirm( _("Are you sure you want to delete this comment?") );
2383
        });
2425
        });
2384
- 

Return to bug 41566