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

(-)a/installer/data/mysql/atomicupdate/bug16954-Add_diff_view_authorities.sql (+71 lines)
Line 0 Link Here
1
INSERT INTO marc_matchers (code, description, record_type, threshold)
2
    VALUES ('100$a', 'Personal name', 'authority', 1000);
3
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Personal-name-heading', 1000 FROM marc_matchers;
4
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
5
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
6
    SELECT MAX(matchpoint_id), 1, '100', 'a' FROM matchpoints;
7
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
8
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
9
10
INSERT INTO marc_matchers (code, description, record_type, threshold)
11
    VALUES ('110$a', 'Corporate name', 'authority', 1000);
12
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Corporate-name-heading', 1000 FROM marc_matchers;
13
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
14
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
15
    SELECT MAX(matchpoint_id), 1, '110', 'a' FROM matchpoints;
16
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
17
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
18
19
INSERT INTO marc_matchers (code, description, record_type, threshold)
20
    VALUES ('111$a', 'Meeting name', 'authority', 1000);
21
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Meeting-name-heading', 1000 FROM marc_matchers;
22
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
23
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
24
    SELECT MAX(matchpoint_id), 1, '111', 'a' FROM matchpoints;
25
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
26
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
27
28
INSERT INTO marc_matchers (code, description, record_type, threshold)
29
    VALUES ('130$a', 'Uniform title', 'authority', 1000);
30
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Title-uniform-heading', 1000 FROM marc_matchers;
31
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
32
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
33
    SELECT MAX(matchpoint_id), 1, '130', 'a' FROM matchpoints;
34
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
35
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
36
37
INSERT INTO marc_matchers (code, description, record_type, threshold)
38
    VALUES ('148$a', 'Chronological term', 'authority', 1000);
39
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Chronological-term-heading', 1000 FROM marc_matchers;
40
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
41
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
42
    SELECT MAX(matchpoint_id), 1, '148', 'a' FROM matchpoints;
43
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
44
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
45
46
INSERT INTO marc_matchers (code, description, record_type, threshold)
47
    VALUES ('150$a', 'Topical term', 'authority', 1000);
48
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Subject-topical-heading', 1000 FROM marc_matchers;
49
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
50
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
51
    SELECT MAX(matchpoint_id), 1, '150', 'a' FROM matchpoints;
52
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
53
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
54
55
INSERT INTO marc_matchers (code, description, record_type, threshold)
56
    VALUES ('151$a', 'Geographic name', 'authority', 1000);
57
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Name-geographic-heading', 1000 FROM marc_matchers;
58
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
59
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
60
    SELECT MAX(matchpoint_id), 1, '151', 'a' FROM matchpoints;
61
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
62
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
63
64
INSERT INTO marc_matchers (code, description, record_type, threshold)
65
    VALUES ('155$a', 'Genre form', 'authority', 1000);
66
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Term-genre-form-heading', 1000 FROM marc_matchers;
67
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
68
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
69
    SELECT MAX(matchpoint_id), 1, '155', 'a' FROM matchpoints;
70
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
71
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
(-)a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql (+73 lines)
Lines 2-7 Link Here
2
-- Default MARC matching rules for Koha
2
-- Default MARC matching rules for Koha
3
--
3
--
4
-- Copyright (C) 2007 LiblimeA
4
-- Copyright (C) 2007 LiblimeA
5
-- Part copyright (C) 2016 Universidad de El Salvador
5
--
6
--
6
-- This file is part of Koha.
7
-- This file is part of Koha.
7
--
8
--
Lines 44-46 INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) Link Here
44
    SELECT MAX(matchpoint_id), 1, '999', 'c' FROM matchpoints;
45
    SELECT MAX(matchpoint_id), 1, '999', 'c' FROM matchpoints;
45
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
46
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
46
    SELECT MAX(matchpoint_component_id), 1, 'Biblionumber' FROM matchpoint_components;
47
    SELECT MAX(matchpoint_component_id), 1, 'Biblionumber' FROM matchpoint_components;
48
49
INSERT INTO marc_matchers (code, description, record_type, threshold)
50
    VALUES ('100$a', 'Personal name', 'authority', 1000);
51
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Personal-name-heading', 1000 FROM marc_matchers;
52
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
53
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
54
    SELECT MAX(matchpoint_id), 1, '100', 'a' FROM matchpoints;
55
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
56
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
57
58
INSERT INTO marc_matchers (code, description, record_type, threshold)
59
    VALUES ('110$a', 'Corporate name', 'authority', 1000);
60
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Corporate-name-heading', 1000 FROM marc_matchers;
61
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
62
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
63
    SELECT MAX(matchpoint_id), 1, '110', 'a' FROM matchpoints;
64
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
65
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
66
67
INSERT INTO marc_matchers (code, description, record_type, threshold)
68
    VALUES ('111$a', 'Meeting name', 'authority', 1000);
69
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Meeting-name-heading', 1000 FROM marc_matchers;
70
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
71
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
72
    SELECT MAX(matchpoint_id), 1, '111', 'a' FROM matchpoints;
73
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
74
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
75
76
INSERT INTO marc_matchers (code, description, record_type, threshold)
77
    VALUES ('130$a', 'Uniform title', 'authority', 1000);
78
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Title-uniform-heading', 1000 FROM marc_matchers;
79
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
80
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
81
    SELECT MAX(matchpoint_id), 1, '130', 'a' FROM matchpoints;
82
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
83
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
84
85
INSERT INTO marc_matchers (code, description, record_type, threshold)
86
    VALUES ('148$a', 'Chronological term', 'authority', 1000);
87
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Chronological-term-heading', 1000 FROM marc_matchers;
88
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
89
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
90
    SELECT MAX(matchpoint_id), 1, '148', 'a' FROM matchpoints;
91
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
92
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
93
94
INSERT INTO marc_matchers (code, description, record_type, threshold)
95
    VALUES ('150$a', 'Topical term', 'authority', 1000);
96
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Subject-topical-heading', 1000 FROM marc_matchers;
97
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
98
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
99
    SELECT MAX(matchpoint_id), 1, '150', 'a' FROM matchpoints;
100
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
101
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
102
103
INSERT INTO marc_matchers (code, description, record_type, threshold)
104
    VALUES ('151$a', 'Geographic name', 'authority', 1000);
105
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Name-geographic-heading', 1000 FROM marc_matchers;
106
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
107
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
108
    SELECT MAX(matchpoint_id), 1, '151', 'a' FROM matchpoints;
109
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
110
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
111
112
INSERT INTO marc_matchers (code, description, record_type, threshold)
113
    VALUES ('155$a', 'Genre form', 'authority', 1000);
114
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Term-genre-form-heading', 1000 FROM marc_matchers;
115
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
116
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
117
    SELECT MAX(matchpoint_id), 1, '155', 'a' FROM matchpoints;
118
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
119
    SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-1 / +1 lines)
Lines 121-127 $(document).ready(function(){ Link Here
121
            }
121
            }
122
            if (aData['diff_url']){
122
            if (aData['diff_url']){
123
                $('td:eq(5)', nRow).html(
123
                $('td:eq(5)', nRow).html(
124
                    '<a href="'+aData['diff_url']+'">View</a>'
124
                    '<a href="'+aData['diff_url']+'&recordtype=[%record_type%]">View</a>'
125
                );
125
                );
126
            }
126
            }
127
            $('td:eq(6)', nRow).html(
127
            $('td:eq(6)', nRow).html(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt (-3 / +3 lines)
Lines 31-40 Link Here
31
            <h1>Original</h1>
31
            <h1>Original</h1>
32
            [% IF ( ERROR_FORMATTED1 ) %]
32
            [% IF ( ERROR_FORMATTED1 ) %]
33
                <div class="dialog alert">
33
                <div class="dialog alert">
34
                    <p>The biblionumber <em>[% BIBLIONUMBER %]</em> doesn't match any existing record.</p>
34
                    <p>The id number <em>[% IDNUMBER %]</em> doesn't match any existing record.</p>
35
                </div>
35
                </div>
36
            [% ELSE %]
36
            [% ELSE %]
37
                <h2>[% BIBLIOTITLE %]</h2>
37
                <h2>[% RECORDDESCRIPT %]</h2>
38
                <pre>[% MARC_FORMATTED1 %]</pre>
38
                <pre>[% MARC_FORMATTED1 %]</pre>
39
            [% END %]
39
            [% END %]
40
        </div>
40
        </div>
Lines 45-51 Link Here
45
                    <p>The import id number <em>[% IMPORTID %]</em> doesn't match any existing record.</p>
45
                    <p>The import id number <em>[% IMPORTID %]</em> doesn't match any existing record.</p>
46
                </div>
46
                </div>
47
            [% ELSE %]
47
            [% ELSE %]
48
                <h2>[% IMPORTTITLE %]</h2>
48
                <h2>[% IMPORTDESCRIPT %]</h2>
49
                <pre>[% MARC_FORMATTED2 %] </pre>
49
                <pre>[% MARC_FORMATTED2 %] </pre>
50
            [% END %]
50
            [% END %]
51
        </div>
51
        </div>
(-)a/tools/showdiffmarc.pl (-19 / +23 lines)
Lines 22-29 Link Here
22
use Modern::Perl;
22
use Modern::Perl;
23
23
24
# standard or CPAN modules used
24
# standard or CPAN modules used
25
use CGI qw(:standard);
25
use CGI qw(:standard -utf8);
26
use DBI;
27
26
28
# Koha modules used
27
# Koha modules used
29
use C4::Context;
28
use C4::Context;
Lines 31-54 use C4::Output; Link Here
31
use C4::Auth;
30
use C4::Auth;
32
use C4::Biblio;
31
use C4::Biblio;
33
use C4::ImportBatch;
32
use C4::ImportBatch;
34
use XML::LibXSLT;
33
use C4::AuthoritiesMarc;
35
use XML::LibXML;
36
37
34
38
# Input params
35
# Input params
39
my $input        = new CGI;
36
my $input        = new CGI;
40
my $biblionumber = $input->param('id');
37
my $idnumber     = $input->param('id');
41
my $importid     = $input->param('importid');
38
my $importid     = $input->param('importid');
42
my $batchid      = $input->param('batchid');
39
my $batchid      = $input->param('batchid');
40
my $recordtype   = $input->param('recordtype');
43
41
44
42
if ( not $idnumber or not $importid ) {
45
if ( not $biblionumber or not $importid ) {
46
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
43
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
47
    exit;
44
    exit;
48
}
45
}
49
46
50
# Init vars
47
# Init vars
51
my ($recordBiblionumber, $recordImportid, $biblioTitle, $importTitle, $formatted1, $formatted2,
48
my ($recordBiblionumber, $recordAuthid, $recordImportid, $recordDescription, $importDescription, $formatted1, $formatted2,
52
    $errorFormatted1, $errorFormatted2);
49
    $errorFormatted1, $errorFormatted2);
53
50
54
51
Lines 65-75 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
65
);
62
);
66
63
67
64
68
$recordBiblionumber = GetMarcBiblio($biblionumber, 'embed_items');
65
$recordBiblionumber = GetMarcBiblio($idnumber, 'embed_items');
69
if( $recordBiblionumber ) {
66
$recordAuthid = GetAuthority($idnumber);
67
if( $recordtype =~ "biblio" ) {
70
    $formatted1 = $recordBiblionumber->as_formatted;
68
    $formatted1 = $recordBiblionumber->as_formatted;
71
    my $data = GetBiblioData($biblionumber);
69
    my $data = GetBiblioData($idnumber);
72
    $biblioTitle = $data->{title};
70
    $recordDescription = $data->{title};
71
} elsif( $recordtype =~ "auth" ) {
72
    $formatted1 = $recordAuthid->as_formatted;
73
    $recordDescription = C4::AuthoritiesMarc::GetAuthorizedHeading({ authid => $idnumber });
73
} else {
74
} else {
74
    $errorFormatted1 = 1;
75
    $errorFormatted1 = 1;
75
}
76
}
Lines 77-84 if( $recordBiblionumber ) { Link Here
77
if( $importid ) {
78
if( $importid ) {
78
    $recordImportid = C4::ImportBatch::GetRecordFromImportBiblio( $importid, 'embed_items' );
79
    $recordImportid = C4::ImportBatch::GetRecordFromImportBiblio( $importid, 'embed_items' );
79
    $formatted2 = $recordImportid->as_formatted;
80
    $formatted2 = $recordImportid->as_formatted;
80
    my $biblio = GetImportBiblios($importid);
81
    if( $recordtype =~ "biblio" ) {
81
    $importTitle = $biblio->[0]->{'title'};
82
        my $biblio = GetImportBiblios($importid);
83
        $importDescription = $biblio->[0]->{'title'};
84
    } elsif( $recordtype =~ "auth" ) {
85
        $importDescription = C4::AuthoritiesMarc::GetAuthorizedHeading({ record => $recordImportid });
86
    }
82
} else {
87
} else {
83
    $errorFormatted2 = 1;
88
    $errorFormatted2 = 1;
84
}
89
}
Lines 86-95 if( $importid ) { Link Here
86
91
87
$template->param(
92
$template->param(
88
    SCRIPT_NAME      => '/cgi-bin/koha/tools/showdiffmarc.pl',
93
    SCRIPT_NAME      => '/cgi-bin/koha/tools/showdiffmarc.pl',
89
    BIBLIONUMBER     => $biblionumber,
94
    IDNUMBER         => $idnumber,
90
    IMPORTID         => $importid,
95
    IMPORTID         => $importid,
91
    BIBLIOTITLE      => $biblioTitle,
96
    RECORDDESCRIPT   => $recordDescription,
92
    IMPORTTITLE      => $importTitle,
97
    IMPORTDESCRIPT   => $importDescription,
93
    MARC_FORMATTED1  => $formatted1,
98
    MARC_FORMATTED1  => $formatted1,
94
    MARC_FORMATTED2  => $formatted2,
99
    MARC_FORMATTED2  => $formatted2,
95
    ERROR_FORMATTED1 => $errorFormatted1,
100
    ERROR_FORMATTED1 => $errorFormatted1,
96
- 

Return to bug 16954