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

(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 78-84 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
78
('AuthoritiesLog','1',NULL,'If ON, log edit/create/delete actions on authorities.','YesNo'),
78
('AuthoritiesLog','1',NULL,'If ON, log edit/create/delete actions on authorities.','YesNo'),
79
('AuthorityControlledIndicators','# PERSO_NAME  100 600 696 700 796 800 896\nmarc21, 100, ind1:auth1\nmarc21, 600, ind1:auth1, ind2:thesaurus\nmarc21, 696, ind1:auth1\nmarc21, 700, ind1:auth1\nmarc21, 796, ind1:auth1\nmarc21, 800, ind1:auth1\nmarc21, 896, ind1:auth1\n# CORPO_NAME  110 610 697 710 797 810 897\nmarc21, 110, ind1:auth1\nmarc21, 610, ind1:auth1, ind2:thesaurus\nmarc21, 697, ind1:auth1\nmarc21, 710, ind1:auth1\nmarc21, 797, ind1:auth1\nmarc21, 810, ind1:auth1\nmarc21, 897, ind1:auth1\n# MEETI_NAME    111 611 698 711 798 811 898\nmarc21, 111, ind1:auth1\nmarc21, 611, ind1:auth1, ind2:thesaurus\nmarc21, 698, ind1:auth1\nmarc21, 711, ind1:auth1\nmarc21, 798, ind1:auth1\nmarc21, 811, ind1:auth1\nmarc21, 898, ind1:auth1\n# UNIF_TITLE        130 440 630 699 730 799 830 899\nmarc21, 130, ind1:auth2\nmarc21, 240, , ind2:auth2\nmarc21, 440, , ind2:auth2\nmarc21, 630, ind1:auth2, ind2:thesaurus\nmarc21, 699, ind1:auth2\nmarc21, 730, ind1:auth2\nmarc21, 799, ind1:auth2\nmarc21, 830, , ind2:auth2\nmarc21, 899, ind1:auth2\n# CHRON_TERM    648 \nmarc21, 648, , ind2:thesaurus\n# TOPIC_TERM      650 654 656 657 658 690\nmarc21, 650, , ind2:thesaurus\n# GEOGR_NAME   651 662 691\nmarc21, 651, , ind2:thesaurus\n# GENRE/FORM    655 \nmarc21, 655, , ind2:thesaurus\n\n# UNIMARC: Always copy the indicators from the authority\nunimarc, *, ind1:auth1, ind2:auth2',NULL,'Authority controlled indicators per biblio field','Free'),
79
('AuthorityControlledIndicators','# PERSO_NAME  100 600 696 700 796 800 896\nmarc21, 100, ind1:auth1\nmarc21, 600, ind1:auth1, ind2:thesaurus\nmarc21, 696, ind1:auth1\nmarc21, 700, ind1:auth1\nmarc21, 796, ind1:auth1\nmarc21, 800, ind1:auth1\nmarc21, 896, ind1:auth1\n# CORPO_NAME  110 610 697 710 797 810 897\nmarc21, 110, ind1:auth1\nmarc21, 610, ind1:auth1, ind2:thesaurus\nmarc21, 697, ind1:auth1\nmarc21, 710, ind1:auth1\nmarc21, 797, ind1:auth1\nmarc21, 810, ind1:auth1\nmarc21, 897, ind1:auth1\n# MEETI_NAME    111 611 698 711 798 811 898\nmarc21, 111, ind1:auth1\nmarc21, 611, ind1:auth1, ind2:thesaurus\nmarc21, 698, ind1:auth1\nmarc21, 711, ind1:auth1\nmarc21, 798, ind1:auth1\nmarc21, 811, ind1:auth1\nmarc21, 898, ind1:auth1\n# UNIF_TITLE        130 440 630 699 730 799 830 899\nmarc21, 130, ind1:auth2\nmarc21, 240, , ind2:auth2\nmarc21, 440, , ind2:auth2\nmarc21, 630, ind1:auth2, ind2:thesaurus\nmarc21, 699, ind1:auth2\nmarc21, 730, ind1:auth2\nmarc21, 799, ind1:auth2\nmarc21, 830, , ind2:auth2\nmarc21, 899, ind1:auth2\n# CHRON_TERM    648 \nmarc21, 648, , ind2:thesaurus\n# TOPIC_TERM      650 654 656 657 658 690\nmarc21, 650, , ind2:thesaurus\n# GEOGR_NAME   651 662 691\nmarc21, 651, , ind2:thesaurus\n# GENRE/FORM    655 \nmarc21, 655, , ind2:thesaurus\n\n# UNIMARC: Always copy the indicators from the authority\nunimarc, *, ind1:auth1, ind2:auth2',NULL,'Authority controlled indicators per biblio field','Free'),
80
('AuthorityMergeLimit','50',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','Integer'),
80
('AuthorityMergeLimit','50',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','Integer'),
81
('LinkerUseFrameworkAuthTypes','0',NULL,'Use authority types defined in MARC bibliographic frameworks when linking headings to authorities (MARC21 only). When enabled, the authority type configured in the Default framework will be used instead of the hardcoded MARC21 defaults.','YesNo'),
82
('AuthorityMergeMode','loose','loose|strict','Authority merge mode','Choice'),
81
('AuthorityMergeMode','loose','loose|strict','Authority merge mode','Choice'),
83
('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'),
82
('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'),
84
('AuthorityXSLTDetailsDisplay','',NULL,'Enable XSL stylesheet control over authority details page display on intranet','Free'),
83
('AuthorityXSLTDetailsDisplay','',NULL,'Enable XSL stylesheet control over authority details page display on intranet','Free'),
Lines 399-404 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
399
('LinkerModule','Default','Default|FirstMatch|LastMatch','Chooses which linker module to use (see documentation).','Choice'),
398
('LinkerModule','Default','Default|FirstMatch|LastMatch','Chooses which linker module to use (see documentation).','Choice'),
400
('LinkerOptions','',NULL,'A pipe-separated list of options for the linker.','free'),
399
('LinkerOptions','',NULL,'A pipe-separated list of options for the linker.','free'),
401
('LinkerRelink','1',NULL,'If ON the authority linker will relink headings that have previously been linked every time it runs.','YesNo'),
400
('LinkerRelink','1',NULL,'If ON the authority linker will relink headings that have previously been linked every time it runs.','YesNo'),
401
('LinkerUseFrameworkAuthTypes','0',NULL,'Use authority types defined in MARC bibliographic frameworks when linking headings to authorities (MARC21 only). When enabled, the authority type configured in the Default framework will be used instead of the hardcoded MARC21 defaults.','YesNo'),
402
('ListOwnerDesignated', '', NULL, 'Designated list owner at patron deletion', 'Free'),
402
('ListOwnerDesignated', '', NULL, 'Designated list owner at patron deletion', 'Free'),
403
('ListOwnershipUponPatronDeletion', 'delete', 'delete|transfer|transfer_public', 'Defines the action on their public or shared lists when patron is deleted', 'Choice'),
403
('ListOwnershipUponPatronDeletion', 'delete', 'delete|transfer|transfer_public', 'Defines the action on their public or shared lists when patron is deleted', 'Choice'),
404
('LoadCheckoutsTableDelay','0',NULL,'Delay before auto-loading checkouts table on checkouts screen','Integer'),
404
('LoadCheckoutsTableDelay','0',NULL,'Delay before auto-loading checkouts table on checkouts screen','Integer'),
(-)a/t/db_dependent/Heading.t (-4 / +68 lines)
Lines 1-5 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
#
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
5
# Koha is free software; you can redistribute it and/or modify it
5
# Koha is free software; you can redistribute it and/or modify it
Lines 15-29 Link Here
15
# You should have received a copy of the GNU General Public License
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <https://www.gnu.org/licenses>.
16
# along with Koha; if not, see <https://www.gnu.org/licenses>.
17
17
18
use strict;
18
use Modern::Perl;
19
use warnings;
20
19
21
use Test::NoWarnings;
20
use Test::NoWarnings;
22
use Test::More tests => 6;
21
use Test::More tests => 7;
23
22
24
use open qw/ :std :utf8 /;
23
use open qw/ :std :utf8 /;
25
24
26
use t::lib::Mocks;
25
use t::lib::Mocks;
26
use t::lib::TestBuilder;
27
27
use Test::MockModule;
28
use Test::MockModule;
28
29
29
use MARC::Record;
30
use MARC::Record;
Lines 31-36 use MARC::Field; Link Here
31
use utf8;
32
use utf8;
32
use C4::AuthoritiesMarc qw/ AddAuthority /;
33
use C4::AuthoritiesMarc qw/ AddAuthority /;
33
34
35
use Koha::Caches;
36
use Koha::MarcSubfieldStructures;
37
34
BEGIN {
38
BEGIN {
35
    use_ok('C4::Heading');
39
    use_ok('C4::Heading');
36
}
40
}
Lines 403-405 subtest "authorities exact match tests" => sub { Link Here
403
    $schema->storage->txn_rollback;
407
    $schema->storage->txn_rollback;
404
408
405
};
409
};
410
411
subtest 'LinkerUseFrameworkAuthTypes' => sub {
412
    plan tests => 2;
413
414
    my $schema  = Koha::Database->new->schema;
415
    my $cache   = Koha::Caches->get_instance;
416
    my $builder = t::lib::TestBuilder->new;
417
    $schema->storage->txn_begin;
418
419
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
420
421
    subtest 'Preference disabled (default behavior)' => sub {
422
        plan tests => 1;
423
424
        t::lib::Mocks::mock_preference( 'LinkerUseFrameworkAuthTypes', 0 );
425
426
        my $field   = MARC::Field->new( '650', ' ', '0', a => 'Test subject' );
427
        my $heading = C4::Heading->new_from_field($field);
428
429
        is( $heading->auth_type(), 'TOPIC_TERM', 'Uses hardcoded TOPIC_TERM when preference disabled' );
430
    };
431
432
    subtest 'Preference enabled with framework override' => sub {
433
434
        plan tests => 1;
435
436
        t::lib::Mocks::mock_preference( 'LinkerUseFrameworkAuthTypes', 1 );
437
438
        # Delete any existing 650$a in default framework to avoid unique constraint violation
439
        Koha::MarcSubfieldStructures->search(
440
            {
441
                frameworkcode => '',
442
                tagfield      => '650',
443
                tagsubfield   => 'a',
444
            }
445
        )->delete;
446
447
        # Create marc_subfield_structure entry using TestBuilder
448
        my $mss = $builder->build_object(
449
            {
450
                class => 'Koha::MarcSubfieldStructures',
451
                value => {
452
                    frameworkcode => '',
453
                    tagfield      => '650',
454
                    tagsubfield   => 'a',
455
                }
456
            }
457
        );
458
459
        # Clear all caches
460
        Koha::Caches->get_instance->flush_all;
461
462
        my $field   = MARC::Field->new( '650', ' ', '0', a => 'Test subject' );
463
        my $heading = C4::Heading->new_from_field($field);
464
465
        is( $heading->auth_type(), $mss->authtypecode, 'Uses framework authority type when enabled' );
466
    };
467
468
    $schema->storage->txn_rollback;
469
};
(-)a/t/db_dependent/Heading/MARC21.t (+117 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <https://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::NoWarnings;
21
use Test::More tests => 6;
22
23
use t::lib::Mocks;
24
use t::lib::TestBuilder;
25
26
use Koha::Caches;
27
use Koha::MarcSubfieldStructures;
28
29
BEGIN {
30
    use_ok( 'C4::Heading', qw( new_from_field ) );
31
}
32
33
my $schema  = Koha::Database->new->schema;
34
my $builder = t::lib::TestBuilder->new;
35
36
t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
37
38
subtest 'Display and search forms' => sub {
39
    plan tests => 3;
40
41
    my $field   = MARC::Field->new( '650', ' ', '2', a => 'Uncles', x => 'Fiction' );
42
    my $heading = C4::Heading->new_from_field($field);
43
    is( $heading->display_form(), 'Uncles--Fiction',              'Display form generation' );
44
    is( $heading->search_form(),  'Uncles generalsubdiv Fiction', 'Search form generation' );
45
    is( $heading->{thesaurus},    'mesh',                         'Thesaurus generation' );
46
};
47
48
subtest 'Uniform titles' => sub {
49
    plan tests => 3;
50
51
    my $field   = MARC::Field->new( '830', ' ', '4', a => 'The dark is rising ;', v => '3' );
52
    my $heading = C4::Heading->new_from_field($field);
53
    is( $heading->display_form(), 'The dark is rising ;', 'Display form generation' );
54
    is( $heading->search_form(),  'The dark is rising',   'Search form generation' );
55
    ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields' );
56
};
57
58
subtest 'Personal names' => sub {
59
    plan tests => 3;
60
61
    my $field   = MARC::Field->new( '100', '1', '', a => 'Yankovic, Al', d => '1959-' );
62
    my $heading = C4::Heading->new_from_field($field);
63
    is( $heading->display_form(), 'Yankovic, Al 1959-', 'Display form generation' );
64
    is( $heading->search_form(),  'Yankovic, Al 1959',  'Search form generation' );
65
    ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields' );
66
};
67
68
subtest 'LinkerUseFrameworkAuthTypes' => sub {
69
    plan tests => 3;
70
71
    $schema->storage->txn_begin;
72
73
    # Test 1: Preference disabled uses hardcoded
74
    t::lib::Mocks::mock_preference( 'LinkerUseFrameworkAuthTypes', 0 );
75
    my $field   = MARC::Field->new( '650', ' ', '0', a => 'Test' );
76
    my $heading = C4::Heading->new_from_field($field);
77
    is( $heading->auth_type(), 'TOPIC_TERM', 'Uses hardcoded TOPIC_TERM when preference disabled' );
78
79
    # Test 2: Preference enabled with framework override
80
    t::lib::Mocks::mock_preference( 'LinkerUseFrameworkAuthTypes', 1 );
81
82
    # Delete any existing 650$a in default framework to avoid unique constraint violation
83
    Koha::MarcSubfieldStructures->search(
84
        {
85
            frameworkcode => '',
86
            tagfield      => '650',
87
            tagsubfield   => 'a',
88
        }
89
    )->delete;
90
91
    # Create marc_subfield_structure entry using TestBuilder
92
    my $mss = $builder->build_object(
93
        {
94
            class => 'Koha::MarcSubfieldStructures',
95
            value => {
96
                frameworkcode => '',
97
                tagfield      => '650',
98
                tagsubfield   => 'a',
99
            }
100
        }
101
    );
102
103
    no warnings 'once';
104
    %C4::Heading::authority_type_cache = ();
105
    Koha::Caches->get_instance->flush_all;
106
107
    $field   = MARC::Field->new( '650', ' ', '0', a => 'Test' );
108
    $heading = C4::Heading->new_from_field($field);
109
    is( $heading->auth_type(), $mss->authtypecode, 'Uses framework override when preference enabled' );
110
111
    # Test 3: Falls back to hardcoded for unconfigured tags
112
    $field   = MARC::Field->new( '600', ' ', '0', a => 'Person' );
113
    $heading = C4::Heading->new_from_field($field);
114
    is( $heading->auth_type(), 'PERSO_NAME', 'Falls back to hardcoded for unconfigured tags' );
115
116
    $schema->storage->txn_rollback;
117
};
(-)a/t/db_dependent/Heading_MARC21.t (-38 lines)
Lines 1-37 Link Here
1
#!/usr/bin/perl
2
#
3
# This Koha test module is a stub!
4
# Add more tests here!!!
5
6
use strict;
7
use warnings;
8
9
use Test::NoWarnings;
10
use Test::More tests => 11;
11
use C4::Context;
12
13
BEGIN {
14
    use_ok( 'C4::Heading', qw( new_from_field ) );
15
}
16
17
SKIP: {
18
    skip "MARC21 heading tests not applicable to UNIMARC", 2 if C4::Context->preference('marcflavour') eq 'UNIMARC';
19
    my $field   = MARC::Field->new( '650', ' ', '2', a => 'Uncles', x => 'Fiction' );
20
    my $heading = C4::Heading->new_from_field($field);
21
    is( $heading->display_form(), 'Uncles--Fiction',              'Display form generation' );
22
    is( $heading->search_form(),  'Uncles generalsubdiv Fiction', 'Search form generation' );
23
    is( $heading->{thesaurus},    'mesh',                         'Thesaurus generation' );
24
25
    $field   = MARC::Field->new( '830', ' ', '4', a => 'The dark is rising ;', v => '3' );
26
    $heading = C4::Heading->new_from_field($field);
27
    is( $heading->display_form(), 'The dark is rising ;', 'Display form generation' );
28
    is( $heading->search_form(),  'The dark is rising',   'Search form generation' );
29
    ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields' );
30
31
    $field   = MARC::Field->new( '100', '1', '', a => 'Yankovic, Al', d => '1959-' );
32
    $heading = C4::Heading->new_from_field($field);
33
    is( $heading->display_form(), 'Yankovic, Al 1959-', 'Display form generation' );
34
    is( $heading->search_form(),  'Yankovic, Al 1959',  'Search form generation' );
35
    ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields' );
36
37
}
38
- 

Return to bug 41714