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

(-)a/catalogue/detail.pl (+40 lines)
Lines 60-65 use Koha::Reviews; Link Here
60
use Koha::SearchEngine::Search;
60
use Koha::SearchEngine::Search;
61
use Koha::SearchEngine::QueryBuilder;
61
use Koha::SearchEngine::QueryBuilder;
62
use Koha::Serial::Items;
62
use Koha::Serial::Items;
63
use Koha::Library::Group;
64
use Koha::Library::Groups;
63
65
64
my $query = CGI->new();
66
my $query = CGI->new();
65
67
Lines 335-340 if ( C4::Context->preference('SeparateHoldings') ) { Link Here
335
    my $other_holdings_count =
337
    my $other_holdings_count =
336
        $items_to_display->search( { $SeparateHoldingsBranch => { '!=' => C4::Context->userenv->{branch} } } )->count;
338
        $items_to_display->search( { $SeparateHoldingsBranch => { '!=' => C4::Context->userenv->{branch} } } )->count;
337
    $template->param( other_holdings_count => $other_holdings_count );
339
    $template->param( other_holdings_count => $other_holdings_count );
340
341
    if ( C4::Context->preference('SeparateHoldingsByGroup') ) {
342
        my $branchcode        = C4::Context->userenv->{branch};
343
        my @all_search_groups = Koha::Library::Groups->get_search_groups( { interface => 'staff' } );
344
        my @lib_groups;
345
        my %branchcode_hash;
346
347
        foreach my $search_group (@all_search_groups) {
348
            while ( my $group = $search_group->next ) {
349
                my @all_libs = $group->all_libraries;
350
351
                # Check if library is in group
352
                if ( grep { $_->branchcode eq $branchcode } @all_libs ) {
353
354
                    # Get other libraries in group
355
                    my @other_libs = grep { $_->branchcode ne $branchcode } @all_libs;
356
                    my @libs_branchcodes;
357
358
                    foreach my $lib (@other_libs) {
359
                        push @libs_branchcodes, $lib->branchcode;
360
                    }
361
362
                    # Push logged in branchcode
363
                    push @libs_branchcodes, $branchcode;
364
365
                    # Build group branchcode hash
366
                    $branchcode_hash{ $group->id } = \@libs_branchcodes;
367
368
                    push @lib_groups, $group;
369
                }
370
            }
371
        }
372
373
        $template->param(
374
            lib_groups  => \@lib_groups,
375
            branchcodes => \%branchcode_hash,
376
        );
377
    }
338
}
378
}
339
$template->param(
379
$template->param(
340
    count                  => $all_items->count,         # FIXME 'count' is used in catalog-strings.inc
380
    count                  => $all_items->count,         # FIXME 'count' is used in catalog-strings.inc
(-)a/installer/data/mysql/atomicupdate/bug_35211_separate_holdings_by_group.pl (+22 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "35211",
6
    description => "",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        # Do you stuffs here
12
        $dbh->do(
13
            q{
14
                INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
15
                VALUES ('SeparateHoldingsByGroup',NULL,'','Separate current branch holdings and holdings from libraries in the same group','YesNo')
16
                }
17
        );
18
19
        # Other information
20
        say_success( $out, "Added new system preference 'SeparateHoldingsByGroup'" );
21
    },
22
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 733-738 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
733
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
733
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
734
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
734
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
735
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
735
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
736
('SeparateHoldingsByGroup','0',NULL,'Separate current branch holdings and holdings from libraries in the same library groups','YesNo'),
736
('SerialsDefaultEmailAddress', '', NULL, 'Default email address used as reply-to for notices sent by the serials module.', 'Free'),
737
('SerialsDefaultEmailAddress', '', NULL, 'Default email address used as reply-to for notices sent by the serials module.', 'Free'),
737
('SerialsDefaultReplyTo', '', NULL, 'Default email address that serials notices are sent from.', 'Free'),
738
('SerialsDefaultReplyTo', '', NULL, 'Default email address that serials notices are sent from.', 'Free'),
738
('SerialsSearchResultsLimit', NULL, NULL, 'Serials search results limit', 'integer'),
739
('SerialsSearchResultsLimit', NULL, NULL, 'Serials search results limit', 'integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (+19 lines)
Lines 290-295 Link Here
290
            holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]",
290
            holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]",
291
            otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]",
291
            otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]",
292
        };
292
        };
293
294
            const branchcodes = {
295
          [% FOREACH key IN branchcodes.keys %]
296
            "[% key | html %]": [
297
              [% FOREACH code IN branchcodes.$key %]
298
                "[% code | html %]"[% UNLESS loop.last %], [% END %]
299
              [% END %]
300
            ][% UNLESS loop.last %], [% END %]
301
          [% END %]
302
        };
303
293
        function build_items_table (tab_id, add_filters, dt_options, drawcallback) {
304
        function build_items_table (tab_id, add_filters, dt_options, drawcallback) {
294
305
295
            let table_dt;
306
            let table_dt;
Lines 310-315 Link Here
310
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
321
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
311
                if ( tab_id == 'holdings' ) {
322
                if ( tab_id == 'holdings' ) {
312
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
323
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
324
                } else if ( tab_id.includes('group_holdings') ) {
325
                    user_colvis[tab_id] = {};
326
                    items_table_settings[tab_id] = [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %];
327
328
                    const id = tab_id.replace("group_holdings_", "");
329
330
                    default_filters[branch] = branchcodes[id];
331
313
                } else {
332
                } else {
314
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
333
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
315
                }
334
                }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (-1 / +6 lines)
Lines 301-306 Cataloging: Link Here
301
                homebranch: 'home library'
301
                homebranch: 'home library'
302
                holdingbranch: 'holding library'
302
                holdingbranch: 'holding library'
303
            - "is the logged in user's library. The second tab will contain all other items."
303
            - "is the logged in user's library. The second tab will contain all other items."
304
            - pref: SeparateHoldingsByGroup
305
              choices:
306
                  1: Separate
307
                  0: "Don't separate"
308
            - "holdings by library group in a third tab."
304
        -
309
        -
305
            - pref: AlwaysShowHoldingsTableFilters
310
            - pref: AlwaysShowHoldingsTableFilters
306
              choices:
311
              choices:
Lines 408-411 Cataloging: Link Here
408
            - "<br/>"
413
            - "<br/>"
409
            - "All values of repeating tags and subfields will be printed with the given RIS tag."
414
            - "All values of repeating tags and subfields will be printed with the given RIS tag."
410
            - "<br/>"
415
            - "<br/>"
411
            - "Use of TY ( record type ) as a key will <em>replace</em> the default TY with the field value of your choosing."
416
            - "Use of TY ( record type ) as a key will <em>replace</em> the default TY with the field value of your choosing."
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +18 lines)
Lines 332-337 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 lib_groups %]
336
                    [% FOREACH group IN lib_groups %]
337
                        [% WRAPPER tab_item tabname="group_holdings_" _ group.id %]
338
                            <span>[% group.title | html %] - Group ()</span>
339
                        [% END %]
340
                    [% END %]
341
                [% END %]
335
            [% ELSE %]
342
            [% ELSE %]
336
                [% WRAPPER tab_item tabname= "holdings" %]
343
                [% WRAPPER tab_item tabname= "holdings" %]
337
                    <span>Holdings ([% items_to_display_count || 0 | html %])</span>
344
                    <span>Holdings ([% items_to_display_count || 0 | html %])</span>
Lines 475-480 Link Here
475
                [% WRAPPER tab_panel tabname="otherholdings" %]
482
                [% WRAPPER tab_panel tabname="otherholdings" %]
476
                    [% PROCESS items_table tab="otherholdings" %]
483
                    [% PROCESS items_table tab="otherholdings" %]
477
                [% END # /tab_panel %]
484
                [% END # /tab_panel %]
485
                [% FOREACH group IN lib_groups %]
486
                    [% SET group_tab = "group_holdings_" _ group.id %]
487
                    [% WRAPPER tab_panel tabname=group_tab %]
488
                        [% PROCESS items_table tab=group_tab %]
489
                    [% END # /tab_panel %]
490
                [% END %]
478
            [% END %]
491
            [% END %]
479
492
480
            [% IF ( MARCNOTES ) %]
493
            [% IF ( MARCNOTES ) %]
Lines 1730-1736 Link Here
1730
            var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1743
            var bundle_lost_value = [% Koha.Preference('BundleLostValue') | html %];
1731
        [% END %]
1744
        [% END %]
1732
1745
1733
        let items_tab_ids = [ 'holdings', 'otherholdings' ];
1746
        let items_tab_ids = [ 'holdings', 'otherholdings'
1747
            [% FOREACH group IN lib_groups %]
1748
            , 'group_holdings_[% group.id | html %]'
1749
            [% END %]
1750
        ];
1734
        items_tab_ids.forEach( function( tab_id, index ) {
1751
        items_tab_ids.forEach( function( tab_id, index ) {
1735
1752
1736
            // Early return if the tab is not shown (ie. no table)
1753
            // Early return if the tab is not shown (ie. no table)
1737
- 

Return to bug 35211