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

(-)a/catalogue/detail.pl (-2 lines)
Lines 173-180 my $fw = GetFrameworkCode($biblionumber); Link Here
173
my $showallitems = $query->param('showallitems');
173
my $showallitems = $query->param('showallitems');
174
my $marcflavour  = C4::Context->preference("marcflavour");
174
my $marcflavour  = C4::Context->preference("marcflavour");
175
175
176
$template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
177
178
$template->param( ocoins => !$invalid_marc_record ? $biblio->get_coins : undef );
176
$template->param( ocoins => !$invalid_marc_record ? $biblio->get_coins : undef );
179
177
180
# some useful variables for enhanced content;
178
# 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: "me.holding_library_id",
428
                    data: "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 1277-1286 Link Here
1277
        [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1277
        [% Asset.js("js/modals/add_catalog_concern.js") | $raw %]
1278
    [% END %]
1278
    [% END %]
1279
    [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
1279
    [% IF ( ( Koha.Preference('CatalogConcerns') || Koha.Preference('OpacCatalogConcerns') ) && CAN_user_editcatalogue_edit_catalogue ) %]
1280
        <script>
1281
            var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'concerns', 'table_concerns', 'json' ) | $raw %];
1282
            const biblio_id = "[% biblionumber | html %]";
1283
        </script>
1284
1280
        <script>
1285
        <script>
1281
            $(document).ready(function() {
1286
            $(document).ready(function() {
1282
                $("#bibliodetails a:first").tab("show");
1287
                $("#bibliodetails a:first").tab("show");
1283
                var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'concerns', 'table_concerns', 'json' ) | $raw %];
1284
1288
1285
                let additional_filters = {
1289
                let additional_filters = {
1286
                    resolved_date: function(){
1290
                    resolved_date: function(){
Lines 1291-1297 Link Here
1291
                        }
1295
                        }
1292
                    },
1296
                    },
1293
                    source: 'catalog',
1297
                    source: 'catalog',
1294
                    biblio_id: [% biblionumber | uri %]
1298
                    biblio_id,
1295
                };
1299
                };
1296
                let external_filter_nodes = {
1300
                let external_filter_nodes = {
1297
                    hide_resolved_concerns: "#hide_resolved_concerns",
1301
                    hide_resolved_concerns: "#hide_resolved_concerns",
Lines 1724-1729 Link Here
1724
    [% IF Koha.Preference('EnableBooking') %]
1728
    [% IF Koha.Preference('EnableBooking') %]
1725
        [% Asset.js("js/modals/place_booking.js") | $raw %]
1729
        [% Asset.js("js/modals/place_booking.js") | $raw %]
1726
    [% END %]
1730
    [% END %]
1731
1727
    <script>
1732
    <script>
1728
        var browser;
1733
        var browser;
1729
        browser = KOHA.browser("[% searchid | html %]", parseInt(biblionumber, 10));
1734
        browser = KOHA.browser("[% searchid | html %]", parseInt(biblionumber, 10));
Lines 1731-1751 Link Here
1731
1736
1732
        [% IF bundlesEnabled %]
1737
        [% IF bundlesEnabled %]
1733
            var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1738
            var bundle_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','bundle_tables','json') | $raw %];
1734
            var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1735
        [% END %]
1739
        [% END %]
1736
1740
1741
        addPrefs({
1742
            AlwaysShowHoldingsTableFilters: [% Koha.Preference('AlwaysShowHoldingsTableFilters') ? 1 : 0 | html %],
1743
            bundlesEnabled: [% Koha.Preference('bundlesEnabled') ? 1 : 0 | html %],
1744
            BundleLostValue: "[% Koha.Preference('BundleLostValue') | html %]",
1745
        });
1746
1747
        addPermissions({
1748
            CAN_user_editcatalogue_manage_item_groups: [% CAN_user_editcatalogue_manage_item_groups ? 1 : 0 | html %],
1749
        });
1750
    </script>
1751
1752
    <script>
1737
        let items_tab_ids = [ 'holdings', 'otherholdings' ];
1753
        let items_tab_ids = [ 'holdings', 'otherholdings' ];
1738
        items_tab_ids.forEach( function( tab_id, index ) {
1754
        items_tab_ids.forEach( function( tab_id, index ) {
1739
1755
1740
            // Early return if the tab is not shown (ie. no table)
1756
            // Early return if the tab is not shown (ie. no table)
1741
            if (!$("#%s_table".format(tab_id)).length) return;
1757
            if (!$("#%s_table".format(tab_id)).length) return;
1742
            [% IF Koha.Preference('AlwaysShowHoldingsTableFilters') %]
1758
            if (prefs.AlwaysShowHoldingsTableFilters){
1743
                build_items_table(tab_id, true, {}, build_items_table_drawncallback);
1759
                build_items_table(tab_id, true, {}, build_items_table_drawncallback);
1744
            [% ELSE %]
1760
            } else {
1745
                build_items_table(tab_id, false, {}, build_items_table_drawncallback);
1761
                build_items_table(tab_id, false, {}, build_items_table_drawncallback);
1746
            [% END %]
1762
            }
1747
1763
1748
            [% IF bundlesEnabled %]
1764
            if (prefs.bundlesEnabled){
1749
                // Add event listener for opening and closing bundle details
1765
                // Add event listener for opening and closing bundle details
1750
                $('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
1766
                $('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
1751
                    var button = $(this);
1767
                    var button = $(this);
Lines 1769-1778 Link Here
1769
                        button.addClass('active');
1785
                        button.addClass('active');
1770
                    }
1786
                    }
1771
                });
1787
                });
1772
            [% END # /IF bundlesEnabled %]
1788
            }
1773
        });
1789
        });
1774
1790
1775
        [% IF bundlesEnabled %] // Bundle handling
1791
        if (bundlesEnabled){ // Bundle handling
1776
            function createChild ( row, itemnumber, duedate ) {
1792
            function createChild ( row, itemnumber, duedate ) {
1777
                // Toolbar
1793
                // Toolbar
1778
                var bundle_toolbar = $('<div id="toolbar" class="btn-toolbar"></div>');
1794
                var bundle_toolbar = $('<div id="toolbar" class="btn-toolbar"></div>');
Lines 1850-1856 Link Here
1850
                            "searchable": false,
1866
                            "searchable": false,
1851
                            "orderable": false,
1867
                            "orderable": false,
1852
                            "render": function(data, type, row, meta) {
1868
                            "render": function(data, type, row, meta) {
1853
                                if ( row.lost_status == bundle_lost_value ) {
1869
                                if ( row.lost_status == prefs.BundleLostValue ) {
1854
                                    let out = '<span class="lost">' + _("Last seen") + ': ' + $date(row.last_seen_date) + '</span>';
1870
                                    let out = '<span class="lost">' + _("Last seen") + ': ' + $date(row.last_seen_date) + '</span>';
1855
                                    if ( row.return_claim ) {
1871
                                    if ( row.return_claim ) {
1856
                                        out = out + '<span class="claims_return">' + _("Claims returned by") + ': ' + $patron_to_html( row.return_claim.patron, { display_cardnumber: false, url: true } ) + '</span>';
1872
                                        out = out + '<span class="claims_return">' + _("Claims returned by") + ': ' + $patron_to_html( row.return_claim.patron, { display_cardnumber: false, url: true } ) + '</span>';
Lines 2080-2090 Link Here
2080
                bundle_changed = 0;
2096
                bundle_changed = 0;
2081
            });
2097
            });
2082
            // End bundle handling
2098
            // End bundle handling
2083
        [% END # /IF bundlesEnabled %]
2099
        }
2100
    </script>
2084
2101
2085
        $(document).ready(function() {
2102
    [% IF Koha.Preference('AcquisitionDetails') %]
2086
            [% IF Koha.Preference('AcquisitionDetails') %]
2103
        <script>
2087
                var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
2104
            var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
2105
        </script>
2106
2107
        <script>
2108
            $(document).ready(function() {
2088
                var acquisitiondetails_table = $("#orders").kohaTable(
2109
                var acquisitiondetails_table = $("#orders").kohaTable(
2089
                    {
2110
                    {
2090
                        dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
2111
                        dom: 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
Lines 2094-2109 Link Here
2094
                    },
2115
                    },
2095
                    table_settings
2116
                    table_settings
2096
                );
2117
                );
2097
            [% END %]
2118
            });
2119
        </script>
2120
    [% END %]
2098
2121
2099
            [% IF suggestions.count %]
2122
    [% IF suggestions.count %]
2123
        <script>
2124
            $(document).ready(function() {
2100
                $("#suggestions").kohaTable({
2125
                $("#suggestions").kohaTable({
2101
                    pagingType: "full",
2126
                    pagingType: "full",
2102
                });
2127
                });
2103
            [% END %]
2128
            });
2129
        </script>
2130
    [% END %]
2131
2132
    [% IF ( reviews ) %]
2133
        <script>
2134
            var comment_table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'comments-table', 'json') | $raw %];
2135
        </script>
2136
2137
        <script>
2138
            $(document).ready(function() {
2104
2139
2105
            [% IF ( reviews ) %]
2106
                var comment_table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'comments-table', 'json') | $raw %];
2107
                var comments_table = $("#comments_table").kohaTable(
2140
                var comments_table = $("#comments_table").kohaTable(
2108
                    {
2141
                    {
2109
                        paging: false,
2142
                        paging: false,
Lines 2112-2130 Link Here
2112
                    },
2145
                    },
2113
                    comment_table_settings
2146
                    comment_table_settings
2114
                );
2147
                );
2115
            [% END %]
2148
            });
2116
        });
2149
        </script>
2150
    [% END %]
2117
2151
2118
        [% IF found1 && Koha.Preference('RetainCatalogSearchTerms') %]
2152
    [% IF found1 && Koha.Preference('RetainCatalogSearchTerms') %]
2153
        <script>
2119
            $(document).ready(function() {
2154
            $(document).ready(function() {
2120
                var search_index = localStorage.getItem("cat_search_pulldown_selection");
2155
                var search_index = localStorage.getItem("cat_search_pulldown_selection");
2121
                var search_value = localStorage.getItem("searchbox_value");
2156
                var search_value = localStorage.getItem("searchbox_value");
2122
                if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
2157
                if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
2123
                if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
2158
                if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
2124
            });
2159
            });
2125
        [% END %]
2160
        </script>
2161
    [% END %]
2162
2163
    [% IF Koha.Preference('EnableItemGroups') %]
2164
        <script>
2165
            $(document).ready(function() {
2126
2166
2127
        [% IF Koha.Preference('EnableItemGroups') %]
2128
            // Load item groups table
2167
            // Load item groups table
2129
            var itemGroupsTable = $("#items-group-table").kohaTable({
2168
            var itemGroupsTable = $("#items-group-table").kohaTable({
2130
                autoWidth: false,
2169
                autoWidth: false,
Lines 2144-2150 Link Here
2144
                    },
2183
                    },
2145
                    {
2184
                    {
2146
                        data: function( oObj ) {
2185
                        data: function( oObj ) {
2147
                            [% IF CAN_user_editcatalogue_manage_item_groups %]
2186
                            if (permissions.CAN_user_editcatalogue_manage_item_groups){
2148
                                return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2187
                                return `<button class='item-group-edit btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2149
                                    <i class="fa-solid fa-pencil" aria-hidden="true"></i> ${_("Edit")}
2188
                                    <i class="fa-solid fa-pencil" aria-hidden="true"></i> ${_("Edit")}
2150
                                </button>`
2189
                                </button>`
Lines 2152-2160 Link Here
2152
                                + `<button class='item-group-delete btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2191
                                + `<button class='item-group-delete btn btn-default btn-xs' data-item-group-id='${oObj.item_group_id}'>
2153
                                    <i class='fa fa-trash-can'></i> ${('Delete')}
2192
                                    <i class='fa fa-trash-can'></i> ${('Delete')}
2154
                                </button>`;
2193
                                </button>`;
2155
                            [% ELSE %]
2194
                            } else {
2156
                                return "";
2195
                                return "";
2157
                            [% END %]
2196
                            }
2158
                        },
2197
                        },
2159
                        searchable: false,
2198
                        searchable: false,
2160
                        orderable: false,
2199
                        orderable: false,
Lines 2329-2335 Link Here
2329
                    if (itemnumbers.length > 0) {
2368
                    if (itemnumbers.length > 0) {
2330
                        let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_item_group';
2369
                        let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_item_group';
2331
                        url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2370
                        url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2332
                        url += '&biblionumber=[% biblionumber | uri %]';
2371
                        url += '&biblionumber=' + biblionumber;
2333
                        url += `&item_group_id=${item_group_id}`;
2372
                        url += `&item_group_id=${item_group_id}`;
2334
2373
2335
                        window.location.replace(url);
2374
                        window.location.replace(url);
Lines 2355-2361 Link Here
2355
                if (itemnumbers.length > 0) {
2394
                if (itemnumbers.length > 0) {
2356
                    let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_item_group';
2395
                    let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_item_group';
2357
                    url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2396
                    url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
2358
                    url += '&biblionumber=[% biblionumber | uri %]';
2397
                    url += '&biblionumber=' + biblionumber;
2359
2398
2360
                    window.location.replace(url);
2399
                    window.location.replace(url);
2361
                }
2400
                }
Lines 2363-2370 Link Here
2363
                $('#modal-item-group-unset').modal('hide');
2402
                $('#modal-item-group-unset').modal('hide');
2364
            });
2403
            });
2365
2404
2366
        [% END # /IF EnableItemGroups %]
2405
        });
2406
        </script>
2407
    [% END # /IF EnableItemGroups %]
2367
2408
2409
    <script>
2368
        $(".delete-comment").on("click", function(){
2410
        $(".delete-comment").on("click", function(){
2369
            return confirm( _("Are you sure you want to delete this comment?") );
2411
            return confirm( _("Are you sure you want to delete this comment?") );
2370
        });
2412
        });
2371
- 

Return to bug 41566