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

(-)a/catalogue/detail.pl (+30 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-341 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
    my $branchcode        = C4::Context->userenv->{branch};
342
    my @all_search_groups = Koha::Library::Groups->get_search_groups( { interface => 'staff' } );
343
344
    if ( C4::Context->preference('SeparateHoldingsByGroup') ) {
345
        my @libs_in_group;
346
        foreach my $search_group (@all_search_groups) {
347
            while ( my $group = $search_group->next ) {
348
                my @all_libs = $group->all_libraries;
349
                if ( grep { $_->branchcode eq $branchcode } @all_libs ) {
350
                    foreach my $lib (@all_libs) {
351
                        if ( $lib->branchcode ne $branchcode ) {
352
                            push @libs_in_group, $lib->branchcode;
353
                        }
354
                    }
355
                }
356
            }
357
        }
358
359
        my $group_holdings_count =
360
            $items_to_display->search( { $SeparateHoldingsBranch => { -in => \@libs_in_group } } )->count;
361
        $template->param(
362
            libs_in_group        => \@libs_in_group,
363
            group_holdings_count => $group_holdings_count,
364
        );
365
    }
366
338
}
367
}
368
339
$template->param(
369
$template->param(
340
    count                  => $all_items->count,         # FIXME 'count' is used in catalog-strings.inc
370
    count                  => $all_items->count,         # FIXME 'count' is used in catalog-strings.inc
341
                                                         # But it's not a meaningful variable, we should rename it there
371
                                                         # But it's not a meaningful variable, we should rename it there
(-)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 library groups','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 734-739 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
734
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
734
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
735
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
735
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
736
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
736
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
737
('SeparateHoldingsByGroup','0',NULL,'Separate current branch holdings and holdings from libraries in the same library groups','YesNo'),
737
('SerialsDefaultEmailAddress', '', NULL, 'Default email address used as reply-to for notices sent by the serials module.', 'Free'),
738
('SerialsDefaultEmailAddress', '', NULL, 'Default email address used as reply-to for notices sent by the serials module.', 'Free'),
738
('SerialsDefaultReplyTo', '', NULL, 'Default email address that serials notices are sent from.', 'Free'),
739
('SerialsDefaultReplyTo', '', NULL, 'Default email address that serials notices are sent from.', 'Free'),
739
('SerialsSearchResultsLimit', NULL, NULL, 'Serials search results limit', 'integer'),
740
('SerialsSearchResultsLimit', NULL, NULL, 'Serials search results limit', 'integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (-1 / +5 lines)
Lines 285-294 Link Here
285
            otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %],
285
            otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json')  | $raw %],
286
        };
286
        };
287
287
288
        let user_colvis = {holdings: {}, otherholdings: {}};
288
        let user_colvis = {holdings: {}, otherholdings: {}, group_holdings: {}};
289
        let table_nodes = {
289
        let table_nodes = {
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
            group_holdings: "[% PROCESS 'build_table' tab="group_holdings" | collapse | $tojson %]",
293
292
        };
294
        };
293
        function build_items_table (tab_id, add_filters, dt_options, drawcallback) {
295
        function build_items_table (tab_id, add_filters, dt_options, drawcallback) {
294
296
Lines 310-315 Link Here
310
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
312
                let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]';
311
                if ( tab_id == 'holdings' ) {
313
                if ( tab_id == 'holdings' ) {
312
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
314
                    default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]';
315
                } else if ( tab_id == 'group_holdings') {
316
                    default_filters[branch] = [ [% FOREACH branchcode IN libs_in_group %]"[% branchcode | html %]"[% UNLESS loop.last %], [% END%][% END %] ];
313
                } else {
317
                } else {
314
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
318
                    default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html  %]' };
315
                }
319
                }
(-)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 (-1 / +46 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 group_holdings_count %]
336
                    [% WRAPPER tab_item tabname= "group_holdings" %]
337
                        <span>Group holdings ([% group_holdings_count || 0 | html %])</span>
338
                    [% END %]
339
                [% END %]
335
            [% ELSE %]
340
            [% ELSE %]
336
                [% WRAPPER tab_item tabname= "holdings" %]
341
                [% WRAPPER tab_item tabname= "holdings" %]
337
                    <span>Holdings ([% items_to_display_count || 0 | html %])</span>
342
                    <span>Holdings ([% items_to_display_count || 0 | html %])</span>
Lines 472-477 Link Here
472
            [% END # /tab_panel %]
477
            [% END # /tab_panel %]
473
478
474
            [% IF Koha.Preference('SeparateHoldings') %]
479
            [% IF Koha.Preference('SeparateHoldings') %]
480
                [% WRAPPER tab_panel tabname="group_holdings" %]
481
                    [% PROCESS items_table tab="group_holdings" %]
482
                [% END #/tab_panel %]
475
                [% WRAPPER tab_panel tabname="otherholdings" %]
483
                [% WRAPPER tab_panel tabname="otherholdings" %]
476
                    [% PROCESS items_table tab="otherholdings" %]
484
                    [% PROCESS items_table tab="otherholdings" %]
477
                [% END # /tab_panel %]
485
                [% END # /tab_panel %]
Lines 2079-2084 Link Here
2079
                // End bundle handling
2087
                // End bundle handling
2080
            [% END # /IF bundlesEnabled %]
2088
            [% END # /IF bundlesEnabled %]
2081
2089
2090
            let items_tab_ids = [ 'holdings', 'otherholdings', 'group_holdings' ];
2091
            items_tab_ids.forEach( function( tab_id, index ) {
2092
2093
                // Early return if the tab is not shown (ie. no table)
2094
                if (!$("#%s-tab".format(tab_id)).length) return;
2095
                [% IF Koha.Preference('AlwaysShowHoldingsTableFilters') %]
2096
                    build_items_table(tab_id, true, {}, build_items_table_drawncallback);
2097
                [% ELSE %]
2098
                    build_items_table(tab_id, false, {}, build_items_table_drawncallback);
2099
                [% END %]
2100
2101
                [% IF bundlesEnabled %]
2102
                    // Add event listener for opening and closing bundle details
2103
                    $('#' + tab_id + '_table tbody').on('click', 'button.details-control', function () {
2104
                        var button = $(this);
2105
                        var tr = button.closest('tr');
2106
                        var dTable = button.closest('table').DataTable({ 'retrieve': true });
2107
2108
                        let row = dTable.row( tr );
2109
                        let data = row.data();
2110
                        let itemnumber = data.item_id;
2111
                        let duedate = (data.checkout&&data.checkout.due_date) || null;
2112
2113
                        if ( row.child.isShown() ) {
2114
                            // This row is already open - close it
2115
                            row.child.hide();
2116
                            tr.removeClass('shown');
2117
                            button.removeClass('active');
2118
                        } else {
2119
                            // Open this row
2120
                            createChild(row, itemnumber, duedate);
2121
                            tr.addClass('shown');
2122
                            button.addClass('active');
2123
                        }
2124
                    });
2125
                [% END # /IF bundlesEnabled %]
2126
            });
2127
2082
            [% IF Koha.Preference('AcquisitionDetails') %]
2128
            [% IF Koha.Preference('AcquisitionDetails') %]
2083
                var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
2129
                var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') | $raw %];
2084
                var acquisitiondetails_table = $("#orders").kohaTable(
2130
                var acquisitiondetails_table = $("#orders").kohaTable(
2085
- 

Return to bug 35211