From bbdfc27043db1e506142915eacf679bfee6bb32a Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Tue, 26 Mar 2024 17:39:46 +0000 Subject: [PATCH] Bug 11300: (Fix) Z3950Server.pm, deleting Biblio.pm.rej and adding a new atomicupdate To test: 1. Apply the patch 2. Set the preference LinkerModule to Z39.50 Server 3. Set the preference LinkerZ3950Server to LIBRARY OF CONGRESS SUBJECTS 4. Set the preference LinkerOptions to local_first 5. Verify that your local authorities include 'Perl (Computer program language)' but do not include 'Scripting languages (Computer science)' 6. Cataloging > New record 7. In tab 6, field 650, paste Perl (Computer program language) in subfield a and click 'Link authorities automatically' - you should be told '650 - A matching authority was found in the local database.' which verifies that authority linking currently works at all. 8. Clear the 650 by clicking the 'Delete this tag' icon with the red X at the end of the tag description, and paste 'Scripting languages (Computer science)' in subfield a and click 'Link authorities automatically' ---> you should be told 'A matching authority record was found on the Z39.50 server and was imported locally.' ---> you should also find the imported authority in your local authorities This test is based on Subject field 650a it should also work with other field (100a, 110a ...) with a valid Z39.50 Server --- C4/Biblio.pm.rej | 20 ------------------- C4/Linker/Z3950Server.pm | 5 ++--- .../Bug11300_LinkerZ3950Server_syspef.sql | 9 --------- .../data/mysql/atomicupdate/bug_11300.pl | 14 +++++++++++++ 4 files changed, 16 insertions(+), 32 deletions(-) delete mode 100644 C4/Biblio.pm.rej delete mode 100644 installer/data/mysql/atomicupdate/Bug11300_LinkerZ3950Server_syspef.sql create mode 100644 installer/data/mysql/atomicupdate/bug_11300.pl diff --git a/C4/Biblio.pm.rej b/C4/Biblio.pm.rej deleted file mode 100644 index dc41b7d742..0000000000 --- a/C4/Biblio.pm.rej +++ /dev/null @@ -1,20 +0,0 @@ -diff a/C4/Biblio.pm b/C4/Biblio.pm (rejected hunks) -@@ -461,7 +462,7 @@ sub BiblioAutoLink { - - =head2 LinkBibHeadingsToAuthorities - -- my $num_headings_changed, %results = LinkBibHeadingsToAuthorities($linker, $marc, $frameworkcode, [$allowrelink, $verbose]); -+ my $num_headings_changed, %results = LinkBibHeadingsToAuthorities($linker, $marc, $frameworkcode, [$allowrelink, $verbose, $dont_auto_create]); - - Links bib headings to authority records by checking - each authority-controlled field in the C -@@ -484,7 +485,9 @@ sub LinkBibHeadingsToAuthorities { - my $frameworkcode = shift; - my $allowrelink = shift; - my $verbose = shift; -+ my $dont_auto_create = shift; - my %results; -+ my $linker_default=C4::Linker::Default->new(); - if (!$bib) { - carp 'LinkBibHeadingsToAuthorities called on undefined bib record'; - return ( 0, {}); diff --git a/C4/Linker/Z3950Server.pm b/C4/Linker/Z3950Server.pm index 5c2074012e..41a0ebf611 100644 --- a/C4/Linker/Z3950Server.pm +++ b/C4/Linker/Z3950Server.pm @@ -15,8 +15,7 @@ package C4::Linker::Z3950Server; # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use Carp; use MARC::Field; use MARC::Record; @@ -149,7 +148,7 @@ sub getZ3950Authority { if($server) { my $options = ZOOM::Options->new(); - $options->option('cclfile' => C4::Context->new()->{"serverinfo"}->{"authorityserver"}->{"ccl2rpn"}); + $options->option('cclfile' => C4::Context->new()->{"config"}->{"serverinfo"}->{"authorityserver"}->{"ccl2rpn"}); $options->option('elementSetName', 'F'); $options->option('async', 0); $options->option('databaseName', $server->{db}); diff --git a/installer/data/mysql/atomicupdate/Bug11300_LinkerZ3950Server_syspef.sql b/installer/data/mysql/atomicupdate/Bug11300_LinkerZ3950Server_syspef.sql deleted file mode 100644 index abbd51d951..0000000000 --- a/installer/data/mysql/atomicupdate/Bug11300_LinkerZ3950Server_syspef.sql +++ /dev/null @@ -1,9 +0,0 @@ -$DBversion = 'XXX'; -if ( CheckVersion( $DBversion ) ) { - $dbh->do(q{ - INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) - VALUES ('LinkerZ3950Server', '', NULL, 'Import authorities from this Z39.50 server when searching for authority links with the Z39.50 Server linker module', 'free') - ­}); - - NewVersion( $DBversion, 12446, "Add new system preference LinkerZ3950Server"); -} diff --git a/installer/data/mysql/atomicupdate/bug_11300.pl b/installer/data/mysql/atomicupdate/bug_11300.pl new file mode 100644 index 0000000000..ca59ccd38f --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_11300.pl @@ -0,0 +1,14 @@ +use Modern::Perl; + +return { + bug_number => "11300", + description => "Import authorities from this Z39.50 server when searching for authority links with the Z39.50 Server linker module", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('LinkerZ3950Server', '', NULL, 'Import authorities from this Z39.50 server when searching for authority links with the Z39.50 Server linker module', 'free') }); + + say $out "Added system preference 'LinkerZ3950Server'"; + }, +}; \ No newline at end of file -- 2.34.1