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

(-)a/catalogue/detail.pl (-11 / +7 lines)
Lines 342-366 if ( C4::Context->preference('SeparateHoldings') ) { Link Here
342
    my @all_search_groups = Koha::Library::Groups->get_search_groups( { interface => 'staff' } );
342
    my @all_search_groups = Koha::Library::Groups->get_search_groups( { interface => 'staff' } );
343
343
344
    if ( C4::Context->preference('SeparateHoldingsByGroup') ) {
344
    if ( C4::Context->preference('SeparateHoldingsByGroup') ) {
345
        my @libs_in_group;
345
        my @lib_groups;
346
        foreach my $search_group (@all_search_groups) {
346
        foreach my $search_group (@all_search_groups) {
347
            while ( my $group = $search_group->next ) {
347
            while ( my $group = $search_group->next ) {
348
                my @all_libs = $group->all_libraries;
348
                my @all_libs = $group->all_libraries;
349
                if ( grep { $_->branchcode eq $branchcode } @all_libs ) {
349
                if ( grep { $_->branchcode eq $branchcode } @all_libs ) {
350
                    foreach my $lib (@all_libs) {
350
                    push @lib_groups, $group;
351
                        if ( $lib->branchcode ne $branchcode ) {
352
                            push @libs_in_group, $lib->branchcode;
353
                        }
354
                    }
355
                }
351
                }
356
            }
352
            }
357
        }
353
        }
358
354
        foreach my $group (@lib_groups) {
359
        my $group_holdings_count =
355
#    warn 'LIBRARY_GROUP' . Data::Dumper::Dumper($group->title);
360
            $items_to_display->search( { $SeparateHoldingsBranch => { -in => \@libs_in_group } } )->count;
356
        }
357
#        warn Data::Dumper::Dumper(\@lib_groups);
361
        $template->param(
358
        $template->param(
362
            libs_in_group        => \@libs_in_group,
359
            library_groups  => \@lib_groups
363
            group_holdings_count => $group_holdings_count,
364
        );
360
        );
365
    }
361
    }
366
362
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (-2 / +5 lines)
Lines 308-319 Link Here
308
            }
308
            }
309
            let default_filters = {};
309
            let default_filters = {};
310
            [% IF Koha.Preference('SeparateHoldings') %]
310
            [% IF Koha.Preference('SeparateHoldings') %]
311
                console.log(tab_id.includes('group_holdings'));
312
                console.log(tab_id);
311
                [% SET SeparateHoldingsBranch = Koha.Preference('SeparateHoldingsBranch') || 'homebranch' %];
313
                [% SET SeparateHoldingsBranch = Koha.Preference('SeparateHoldingsBranch') || 'homebranch' %];
312
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
314
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
313
                if ( tab_id == 'holdings' ) {
315
                if ( tab_id == 'holdings' ) {
314
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
316
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
315
                } else if ( tab_id == 'group_holdings') {
317
                } else if ( tab_id.includes('group_holdings') ) {
316
                    default_filters[branch] = [ [% FOREACH branchcode IN libs_in_group %]"[% branchcode | html %]"[% UNLESS loop.last %], [% END%][% END %] ];
318
                    console.log(tab_id);
319
                  // default_filters[branch] = [ [% FOREACH branchcode IN libs_in_group %]"[% branchcode | html %]"[% UNLESS loop.last %], [% END%][% END %] ];
317
                } else {
320
                } else {
318
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
321
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
319
                }
322
                }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-4 / +8 lines)
Lines 332-340 Link Here
332
                        <span>Other holdings ([% other_holdings_count || 0 | html %])</span>
332
                        <span>Other holdings ([% other_holdings_count || 0 | html %])</span>
333
                    [% END %]
333
                    [% END %]
334
                [% END %]
334
                [% END %]
335
                [% IF group_holdings_count %]
335
                [% IF library_groups && library_groups.size > 0  %]
336
                    [% WRAPPER tab_item tabname= "group_holdings" %]
336
                    [% FOREACH group IN library_groups %]
337
                        <span>Group holdings ([% group_holdings_count || 0 | html %])</span>
337
                        [% USE Dumper %]
338
                        groups: [% Dumper.dump_html(group.unblessed) %]
339
                        [% SET group_id_tab = "group_holdings_" _ group.id %]
340
                        [% WRAPPER tab_item tabname=group_id_tab %]
341
                            <span>[% group.title | html  %] Group ()</span>
342
                        [% END %]
338
                    [% END %]
343
                    [% END %]
339
                [% END %]
344
                [% END %]
340
            [% ELSE %]
345
            [% ELSE %]
341
- 

Return to bug 35211