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

(-)a/installer/data/mysql/atomicupdate/bug31503.pl (-7 / +1 lines)
Lines 2-8 use Modern::Perl; Link Here
2
2
3
return {
3
return {
4
    bug_number  => 31503,
4
    bug_number  => 31503,
5
    description => "Change patron_consent.type, add pref OPACCustomConsentTypes",
5
    description => "Change patron_consent.type",
6
    up          => sub {
6
    up          => sub {
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
Lines 11-21 return { Link Here
11
            q{ALTER TABLE `patron_consent` MODIFY `type` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'consent type, could be custom type'}
11
            q{ALTER TABLE `patron_consent` MODIFY `type` tinytext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'consent type, could be custom type'}
12
        );
12
        );
13
        say $out "Changed column 'patron_consent.type'";
13
        say $out "Changed column 'patron_consent.type'";
14
15
        $dbh->do(
16
            q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
17
('OPACCustomConsentTypes', '0', NULL, 'If enabled, custom consent types can be registered on account page', 'YesNo')}
18
        );
19
        say $out "Addedd preference 'OPACCustomConsentTypes'";
20
    },
14
    },
21
};
15
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 lines)
Lines 445-451 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
445
('OpacCloud','0',NULL,'If ON, enables subject cloud on OPAC','YesNo'),
445
('OpacCloud','0',NULL,'If ON, enables subject cloud on OPAC','YesNo'),
446
('OpacAdditionalStylesheet','','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'),
446
('OpacAdditionalStylesheet','','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'),
447
('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'),
447
('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'),
448
('OPACCustomConsentTypes', '0', NULL, 'If enabled, custom consent types can be registered on account page', 'YesNo'),
449
('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'),
448
('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'),
450
('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
449
('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'),
451
('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'),
450
('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-9 lines)
Lines 551-565 OPAC: Link Here
551
                  summary: "in user summary box on OPAC homepage (the system preference <em>OPACUserSummary</em> must be enabled)"
551
                  summary: "in user summary box on OPAC homepage (the system preference <em>OPACUserSummary</em> must be enabled)"
552
                  user: "on patron's 'your summary' page"
552
                  user: "on patron's 'your summary' page"
553
            - ". Note that displayed savings may be inaccurate if checkout history is anonymized."
553
            - ". Note that displayed savings may be inaccurate if checkout history is anonymized."
554
        -
555
            - pref: OPACCustomConsentTypes
556
              default: 0
557
              choices:
558
                  1: Allow
559
                  0: "Don't allow"
560
            - "users to register consents for custom (plugin based) consent types on the user account page."
561
            - '<br><strong>NOTE</strong>: The consents tab is also visible when <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PrivacyPolicyConsent">PrivacyPolicyConsent</a> is enabled.'
562
563
    OpenURL:
554
    OpenURL:
564
        -
555
        -
565
            - 'Complete URL of OpenURL resolver (starting with <code>http://</code> or <code>https://</code>):'
556
            - 'Complete URL of OpenURL resolver (starting with <code>http://</code> or <code>https://</code>):'
(-)a/t/db_dependent/Koha/Patron/Consents.t (-8 / +6 lines)
Lines 54-59 subtest 'Method available_types' => sub { Link Here
54
    plan tests => 7;
54
    plan tests => 7;
55
    $schema->storage->txn_begin;
55
    $schema->storage->txn_begin;
56
56
57
    t::lib::Mocks::mock_preference( 'PrivacyPolicyConsent',   'Enforced' );
58
    my $types = Koha::Patron::Consents->available_types;
59
    is( keys %$types, 1, 'Expect one type for privacy policy' );
60
57
    # Mock get_enabled_plugins
61
    # Mock get_enabled_plugins
58
    my $plugins        = [];
62
    my $plugins        = [];
59
    my $plugins_module = Test::MockModule->new('Koha::Plugins');
63
    my $plugins_module = Test::MockModule->new('Koha::Plugins');
Lines 66-81 subtest 'Method available_types' => sub { Link Here
66
    $plugin_2->mock( 'patron_consent_type', sub { return $data_2; } );
70
    $plugin_2->mock( 'patron_consent_type', sub { return $data_2; } );
67
    $plugins = [ $plugin_1, $plugin_2 ];
71
    $plugins = [ $plugin_1, $plugin_2 ];
68
72
69
    t::lib::Mocks::mock_preference( 'PrivacyPolicyConsent',   'Enforced' );
70
    t::lib::Mocks::mock_preference( 'OPACCustomConsentTypes', 0 );
71
    my $types = Koha::Patron::Consents->available_types;
72
    is( keys %$types, 1, 'Expect one plugin for privacy policy' );
73
    t::lib::Mocks::mock_preference( 'OPACCustomConsentTypes', 1 );
74
    $types = Koha::Patron::Consents->available_types;
73
    $types = Koha::Patron::Consents->available_types;
75
    is( keys %$types, 3, 'Expect three plugins when allowing custom consents' );
74
    is( keys %$types, 3, 'Expect three types when plugins installed and enabled' );
76
    t::lib::Mocks::mock_preference( 'PrivacyPolicyConsent', '' );
75
    t::lib::Mocks::mock_preference( 'PrivacyPolicyConsent', '' );
77
    $types = Koha::Patron::Consents->available_types;
76
    $types = Koha::Patron::Consents->available_types;
78
    is( keys %$types,              2,     'Expect two plugins, when pref disabled' );
77
    is( keys %$types,              2,     'Expect two types, when plugins enabled but PrivacyPolicyConsent disabled' );
79
    is( $types->{GDPR_PROCESSING}, undef, 'GDPR key should not be found' );
78
    is( $types->{GDPR_PROCESSING}, undef, 'GDPR key should not be found' );
80
    is_deeply( $types->{plugin_2}, $data_2->[1], 'Check type hash' );
79
    is_deeply( $types->{plugin_2}, $data_2->[1], 'Check type hash' );
81
80
82
- 

Return to bug 31503