Bugzilla – Attachment 53613 Details for
Bug 16954
Add the diff view to authorities in staged MARC records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16954: Add the diff view to authorities in staged MARC records
Bug-16954-Add-the-diff-view-to-authorities-in-stag.patch (text/plain), 18.71 KB, created by
Héctor Eduardo Castro Avalos
on 2016-07-21 19:55:06 UTC
(
hide
)
Description:
Bug 16954: Add the diff view to authorities in staged MARC records
Filename:
MIME Type:
Creator:
Héctor Eduardo Castro Avalos
Created:
2016-07-21 19:55:06 UTC
Size:
18.71 KB
patch
obsolete
>From bea88526e8e0697ad735fcc371c983628dc7ac50 Mon Sep 17 00:00:00 2001 >From: Hector Castro <hector.hecaxmmx@gmail.com> >Date: Thu, 21 Jul 2016 13:49:19 -0600 >Subject: [PATCH] Bug 16954: Add the diff view to authorities in staged MARC > records > >To test: >-Update database: $ perl installer/data/mysql/updatedatabase.pl >-Go to Authorities and click in New from Z39.50 >-Copy the authors: (Maxwell Robert, L. | Tanenbaum, Andrew S.) from Library of Congress >-Copy the subjects: Water-supply, Watering troughs from Library of Congress >-Reindex zebra >-Download the file personal_test_auth.mrc above in attachments >-Go to Tools -> Stage MARC records for import and upload the file personal_test_auth.mrc > this file provide the same authors copied before with extra data. >-When upload progress is 100% chose: > "Record type -> Authorities" > "Record matching rule -> 100$a (Personal name)" >-Click in "Stage for import" >-In match details colum will match the two records, click in View and you'll see > the original record and the diff with the imported. >-Download the file subjects_test_auth.mrc above in attachments and stage the records >-When upload progress is 100% chose: > "Record type -> Authorities" > "Record matching rule -> 150$a (Topical term)" >-In match details colum will match the two records, click in View and you'll see > the original record and the diff with the imported. > >Extra test: >-Test with existing bib records. Verify that your records have ISBN 10 > Koha convert ISBN 13 to 10 and sometimes fails. > "Record type -> Bibliographic" > "Record matching rule -> ISBN (020$a)" >-See that diff view works as before > >Sponsored-by: Universidad de El Salvador >--- > .../bug16954-Add_diff_view_authorities.sql | 71 +++++++++++++++++++ > .../optional/marc21_default_matching_rules.sql | 73 ++++++++++++++++++++ > .../prog/en/modules/tools/manage-marc-import.tt | 2 +- > .../prog/en/modules/tools/showdiffmarc.tt | 6 +- > tools/showdiffmarc.pl | 41 ++++++----- > 5 files changed, 171 insertions(+), 22 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug16954-Add_diff_view_authorities.sql > >diff --git a/installer/data/mysql/atomicupdate/bug16954-Add_diff_view_authorities.sql b/installer/data/mysql/atomicupdate/bug16954-Add_diff_view_authorities.sql >new file mode 100644 >index 0000000..a713cd7 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug16954-Add_diff_view_authorities.sql >@@ -0,0 +1,71 @@ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('100$a', 'Personal name', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Personal-name-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '100', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('110$a', 'Corporate name', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Corporate-name-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '110', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('111$a', 'Meeting name', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Meeting-name-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '111', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('130$a', 'Uniform title', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Title-uniform-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '130', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('148$a', 'Chronological term', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Chronological-term-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '148', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('150$a', 'Topical term', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Subject-topical-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '150', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('151$a', 'Geographic name', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Name-geographic-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '151', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('155$a', 'Genre form', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Term-genre-form-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '155', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql >index 2e538a4..025eee0 100644 >--- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql >+++ b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql >@@ -2,6 +2,7 @@ > -- Default MARC matching rules for Koha > -- > -- Copyright (C) 2007 LiblimeA >+-- Part copyright (C) 2016 Universidad de El Salvador > -- > -- This file is part of Koha. > -- >@@ -44,3 +45,75 @@ INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) > SELECT MAX(matchpoint_id), 1, '999', 'c' FROM matchpoints; > INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) > SELECT MAX(matchpoint_component_id), 1, 'Biblionumber' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('100$a', 'Personal name', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Personal-name-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '100', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('110$a', 'Corporate name', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Corporate-name-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '110', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('111$a', 'Meeting name', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Meeting-name-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '111', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('130$a', 'Uniform title', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Title-uniform-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '130', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('148$a', 'Chronological term', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Chronological-term-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '148', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('150$a', 'Topical term', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Subject-topical-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '150', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('151$a', 'Geographic name', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Name-geographic-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '151', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >+ >+INSERT INTO marc_matchers (code, description, record_type, threshold) >+ VALUES ('155$a', 'Genre form', 'authority', 1000); >+INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'Term-genre-form-heading', 1000 FROM marc_matchers; >+INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints; >+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) >+ SELECT MAX(matchpoint_id), 1, '155', 'a' FROM matchpoints; >+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) >+ SELECT MAX(matchpoint_component_id), 1, '' FROM matchpoint_components; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt >index b846a4f..00264d7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt >@@ -121,7 +121,7 @@ $(document).ready(function(){ > } > if (aData['diff_url']){ > $('td:eq(5)', nRow).html( >- '<a href="'+aData['diff_url']+'">View</a>' >+ '<a href="'+aData['diff_url']+'&recordtype=[%record_type%]">View</a>' > ); > } > $('td:eq(6)', nRow).html( >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt >index 93edb39..8fa75ce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/showdiffmarc.tt >@@ -31,10 +31,10 @@ > <h1>Original</h1> > [% IF ( ERROR_FORMATTED1 ) %] > <div class="dialog alert"> >- <p>The biblionumber <em>[% BIBLIONUMBER %]</em> doesn't match any existing record.</p> >+ <p>The id number <em>[% IDNUMBER %]</em> doesn't match any existing record.</p> > </div> > [% ELSE %] >- <h2>[% BIBLIOTITLE %]</h2> >+ <h2>[% RECORDDESCRIPT %]</h2> > <pre>[% MARC_FORMATTED1 %]</pre> > [% END %] > </div> >@@ -45,7 +45,7 @@ > <p>The import id number <em>[% IMPORTID %]</em> doesn't match any existing record.</p> > </div> > [% ELSE %] >- <h2>[% IMPORTTITLE %]</h2> >+ <h2>[% IMPORTDESCRIPT %]</h2> > <pre>[% MARC_FORMATTED2 %] </pre> > [% END %] > </div> >diff --git a/tools/showdiffmarc.pl b/tools/showdiffmarc.pl >index 20abada..b0bd090 100755 >--- a/tools/showdiffmarc.pl >+++ b/tools/showdiffmarc.pl >@@ -22,8 +22,7 @@ > use Modern::Perl; > > # standard or CPAN modules used >-use CGI qw(:standard); >-use DBI; >+use CGI qw(:standard -utf8); > > # Koha modules used > use C4::Context; >@@ -31,24 +30,22 @@ use C4::Output; > use C4::Auth; > use C4::Biblio; > use C4::ImportBatch; >-use XML::LibXSLT; >-use XML::LibXML; >- >+use C4::AuthoritiesMarc; > > # Input params > my $input = new CGI; >-my $biblionumber = $input->param('id'); >+my $idnumber = $input->param('id'); > my $importid = $input->param('importid'); > my $batchid = $input->param('batchid'); >+my $recordtype = $input->param('recordtype'); > >- >-if ( not $biblionumber or not $importid ) { >+if ( not $idnumber or not $importid ) { > print $input->redirect("/cgi-bin/koha/errors/404.pl"); > exit; > } > > # Init vars >-my ($recordBiblionumber, $recordImportid, $biblioTitle, $importTitle, $formatted1, $formatted2, >+my ($recordBiblionumber, $recordAuthid, $recordImportid, $recordDescription, $importDescription, $formatted1, $formatted2, > $errorFormatted1, $errorFormatted2); > > >@@ -65,11 +62,15 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > ); > > >-$recordBiblionumber = GetMarcBiblio($biblionumber, 'embed_items'); >-if( $recordBiblionumber ) { >+$recordBiblionumber = GetMarcBiblio($idnumber, 'embed_items'); >+$recordAuthid = GetAuthority($idnumber); >+if( $recordtype =~ "biblio" ) { > $formatted1 = $recordBiblionumber->as_formatted; >- my $data = GetBiblioData($biblionumber); >- $biblioTitle = $data->{title}; >+ my $data = GetBiblioData($idnumber); >+ $recordDescription = $data->{title}; >+} elsif( $recordtype =~ "auth" ) { >+ $formatted1 = $recordAuthid->as_formatted; >+ $recordDescription = C4::AuthoritiesMarc::GetAuthorizedHeading({ authid => $idnumber }); > } else { > $errorFormatted1 = 1; > } >@@ -77,8 +78,12 @@ if( $recordBiblionumber ) { > if( $importid ) { > $recordImportid = C4::ImportBatch::GetRecordFromImportBiblio( $importid, 'embed_items' ); > $formatted2 = $recordImportid->as_formatted; >- my $biblio = GetImportBiblios($importid); >- $importTitle = $biblio->[0]->{'title'}; >+ if( $recordtype =~ "biblio" ) { >+ my $biblio = GetImportBiblios($importid); >+ $importDescription = $biblio->[0]->{'title'}; >+ } elsif( $recordtype =~ "auth" ) { >+ $importDescription = C4::AuthoritiesMarc::GetAuthorizedHeading({ record => $recordImportid }); >+ } > } else { > $errorFormatted2 = 1; > } >@@ -86,10 +91,10 @@ if( $importid ) { > > $template->param( > SCRIPT_NAME => '/cgi-bin/koha/tools/showdiffmarc.pl', >- BIBLIONUMBER => $biblionumber, >+ IDNUMBER => $idnumber, > IMPORTID => $importid, >- BIBLIOTITLE => $biblioTitle, >- IMPORTTITLE => $importTitle, >+ RECORDDESCRIPT => $recordDescription, >+ IMPORTDESCRIPT => $importDescription, > MARC_FORMATTED1 => $formatted1, > MARC_FORMATTED2 => $formatted2, > ERROR_FORMATTED1 => $errorFormatted1, >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16954
:
53610
|
53611
| 53613 |
53617