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 (-1 / +65 lines)
Lines 19-25 use strict; Link Here
19
use warnings;
19
use warnings;
20
20
21
use Test::NoWarnings;
21
use Test::NoWarnings;
22
use Test::More tests => 6;
22
use Test::More tests => 7;
23
23
24
use open qw/ :std :utf8 /;
24
use open qw/ :std :utf8 /;
25
25
Lines 403-405 subtest "authorities exact match tests" => sub { Link Here
403
    $schema->storage->txn_rollback;
403
    $schema->storage->txn_rollback;
404
404
405
};
405
};
406
407
subtest 'LinkerUseFrameworkAuthTypes' => sub {
408
    plan tests => 2;
409
410
    my $schema = Koha::Database->new->schema;
411
    my $cache  = Koha::Caches->get_instance;
412
    $schema->storage->txn_begin;
413
414
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
415
416
    subtest 'Preference disabled (default behavior)' => sub {
417
        plan tests => 1;
418
419
        t::lib::Mocks::mock_preference( 'LinkerUseFrameworkAuthTypes', 0 );
420
421
        my $field   = MARC::Field->new( '650', ' ', '0', a => 'Test subject' );
422
        my $heading = C4::Heading->new_from_field($field);
423
424
        is( $heading->auth_type(), 'TOPIC_TERM', 'Uses hardcoded TOPIC_TERM when preference disabled' );
425
    };
426
427
    subtest 'Preference enabled with framework override' => sub {
428
        plan tests => 1;
429
430
        t::lib::Mocks::mock_preference( 'LinkerUseFrameworkAuthTypes', 1 );
431
432
        # Ensure clean state
433
        $schema->resultset('MarcSubfieldStructure')->search(
434
            {
435
                frameworkcode => '',
436
                tagfield      => [ '650', '600', '651' ],
437
            }
438
        )->delete;
439
440
        # Create test data with all required fields
441
        $schema->resultset('MarcSubfieldStructure')->create(
442
            {
443
                frameworkcode => '',
444
                tagfield      => '650',
445
                tagsubfield   => 'a',
446
                authtypecode  => 'CUSTOM_TERM',
447
                liblibrarian  => 'Subject',
448
                libopac       => 'Subject',
449
                repeatable    => 0,
450
                mandatory     => 0,
451
                tab           => 6,
452
            }
453
        );
454
455
        # Clear all caches
456
        no warnings 'once';
457
        %C4::Heading::authority_type_cache = ();
458
        $cache->clear_from_cache("MarcSubfieldStructure-");
459
        $cache->clear_from_cache("MarcStructure-0-");
460
        $cache->clear_from_cache("MarcStructure-1-");
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(), 'CUSTOM_TERM', 'Uses framework authority type when enabled' );
466
    };
467
468
    $schema->storage->txn_rollback;
469
};
(-)a/t/db_dependent/Heading/MARC21.t (+112 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
25
BEGIN {
26
    use_ok( 'C4::Heading', qw( new_from_field ) );
27
}
28
29
t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
30
31
subtest 'Display and search forms' => sub {
32
    plan tests => 3;
33
34
    my $field   = MARC::Field->new( '650', ' ', '2', a => 'Uncles', x => 'Fiction' );
35
    my $heading = C4::Heading->new_from_field($field);
36
    is( $heading->display_form(), 'Uncles--Fiction',              'Display form generation' );
37
    is( $heading->search_form(),  'Uncles generalsubdiv Fiction', 'Search form generation' );
38
    is( $heading->{thesaurus},    'mesh',                         'Thesaurus generation' );
39
};
40
41
subtest 'Uniform titles' => sub {
42
    plan tests => 3;
43
44
    my $field   = MARC::Field->new( '830', ' ', '4', a => 'The dark is rising ;', v => '3' );
45
    my $heading = C4::Heading->new_from_field($field);
46
    is( $heading->display_form(), 'The dark is rising ;', 'Display form generation' );
47
    is( $heading->search_form(),  'The dark is rising',   'Search form generation' );
48
    ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields' );
49
};
50
51
subtest 'Personal names' => sub {
52
    plan tests => 3;
53
54
    my $field   = MARC::Field->new( '100', '1', '', a => 'Yankovic, Al', d => '1959-' );
55
    my $heading = C4::Heading->new_from_field($field);
56
    is( $heading->display_form(), 'Yankovic, Al 1959-', 'Display form generation' );
57
    is( $heading->search_form(),  'Yankovic, Al 1959',  'Search form generation' );
58
    ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields' );
59
};
60
61
subtest 'LinkerUseFrameworkAuthTypes' => sub {
62
    plan tests => 3;
63
64
    my $schema = Koha::Database->new->schema;
65
    my $cache  = Koha::Caches->get_instance;
66
    $schema->storage->txn_begin;
67
68
    # Test 1: Preference disabled uses hardcoded
69
    t::lib::Mocks::mock_preference( 'LinkerUseFrameworkAuthTypes', 0 );
70
    my $field   = MARC::Field->new( '650', ' ', '0', a => 'Test' );
71
    my $heading = C4::Heading->new_from_field($field);
72
    is( $heading->auth_type(), 'TOPIC_TERM', 'Uses hardcoded TOPIC_TERM when preference disabled' );
73
74
    # Test 2: Preference enabled with framework override
75
    t::lib::Mocks::mock_preference( 'LinkerUseFrameworkAuthTypes', 1 );
76
77
    $schema->resultset('MarcSubfieldStructure')->search(
78
        {
79
            frameworkcode => '',
80
            tagfield      => '650',
81
        }
82
    )->delete;
83
84
    $schema->resultset('MarcSubfieldStructure')->create(
85
        {
86
            frameworkcode => '',
87
            tagfield      => '650',
88
            tagsubfield   => 'a',
89
            authtypecode  => 'CUSTOM_TERM',
90
            liblibrarian  => 'Subject',
91
            libopac       => 'Subject',
92
            repeatable    => 0,
93
            mandatory     => 0,
94
            tab           => 6,
95
        }
96
    );
97
98
    no warnings 'once';
99
    %C4::Heading::authority_type_cache = ();
100
    $cache->clear_from_cache("MarcSubfieldStructure-");
101
102
    $field   = MARC::Field->new( '650', ' ', '0', a => 'Test' );
103
    $heading = C4::Heading->new_from_field($field);
104
    is( $heading->auth_type(), 'CUSTOM_TERM', 'Uses framework override when preference enabled' );
105
106
    # Test 3: Falls back to hardcoded for unconfigured tags
107
    $field   = MARC::Field->new( '600', ' ', '0', a => 'Person' );
108
    $heading = C4::Heading->new_from_field($field);
109
    is( $heading->auth_type(), 'PERSO_NAME', 'Falls back to hardcoded for unconfigured tags' );
110
111
    $schema->storage->txn_rollback;
112
};
(-)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