Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Summary: Add a new authority linker which searches for authority links on a Z39.50 ser...
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement with 30 votes (vote)
Assignee: Blou
QA Contact: Testopia
URL:
Keywords:
Depends on: 11299
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-25 19:37 UTC by Frédérick Capovilla
Modified: 2024-03-27 19:42 UTC (History)
26 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server. (20.32 KB, patch)
2013-11-25 19:37 UTC, Frédérick Capovilla
Details | Diff | Splinter Review
Bug 11300 - Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server (20.97 KB, patch)
2015-04-15 20:32 UTC, Blou
Details | Diff | Splinter Review
Bug 11300 - Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server (20.78 KB, patch)
2015-04-16 16:03 UTC, Blou
Details | Diff | Splinter Review
Bug 11300 - correcting table z3950servers now uses 'servername' instead of 'name' (8.76 KB, patch)
2015-04-16 16:03 UTC, Blou
Details | Diff | Splinter Review
Bug 11300 - Add update_cache method to C4::Linker::Z3950Server to match definition (1.38 KB, patch)
2015-04-16 20:17 UTC, Blou
Details | Diff | Splinter Review
Bug 11300 - Add missing parameter in call to LinkBibHeadingsToAuthorities (1.07 KB, patch)
2015-05-28 20:33 UTC, Blou
Details | Diff | Splinter Review
Bug 11300 - Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server (31.96 KB, patch)
2015-12-02 13:27 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300 - Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server (32.83 KB, patch)
2016-10-14 14:09 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300: small fix for adjust using first,last and default in result search, using index Match-heading for search (2.38 KB, patch)
2016-10-14 14:17 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server. (27.38 KB, patch)
2017-03-10 16:42 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server. (27.47 KB, patch)
2017-09-15 20:41 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server. (28.82 KB, patch)
2017-11-10 21:39 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server. (25.36 KB, patch)
2017-11-17 20:24 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server. (25.36 KB, patch)
2018-09-25 19:47 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server. (25.34 KB, patch)
2019-10-28 20:06 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server. (24.28 KB, patch)
2019-10-30 12:52 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server. (23.08 KB, patch)
2020-10-15 21:12 UTC, Blou
Details | Diff | Splinter Review
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server. (23.16 KB, patch)
2020-10-16 15:18 UTC, Blou
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.14 KB, patch)
2021-01-16 14:52 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.11 KB, patch)
2022-04-20 17:57 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.29 KB, patch)
2022-06-21 20:41 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.35 KB, patch)
2022-07-22 14:26 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.55 KB, patch)
2022-09-30 14:17 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.45 KB, patch)
2022-11-04 20:53 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.45 KB, patch)
2023-03-28 13:58 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.38 KB, patch)
2023-05-11 13:28 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.38 KB, patch)
2023-05-19 13:21 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 11300: (Fix) Editing the way authority links is searched on a Z39.50 server. (9.85 KB, text/plain)
2023-05-19 13:21 UTC, Hammat wele
Details
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.53 KB, patch)
2023-09-14 04:08 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 11300: (Fix) Fixing the authority linking (9.63 KB, patch)
2023-09-14 04:08 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.56 KB, patch)
2023-12-12 15:22 UTC, Salah Ghedda
Details | Diff | Splinter Review
Bug 11300: (Fix) Fixing the authority linking (9.62 KB, patch)
2023-12-12 15:22 UTC, Salah Ghedda
Details | Diff | Splinter Review
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server. (26.56 KB, patch)
2024-03-26 17:41 UTC, Hammat wele
Details | Diff | Splinter Review
Bug 11300: (Fix) Z3950Server.pm, deleting Biblio.pm.rej and adding a new atomicupdate (5.55 KB, patch)
2024-03-26 17:41 UTC, Hammat wele
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Frédérick Capovilla 2013-11-25 19:37:08 UTC Comment hidden (obsolete)
Comment 1 François Pichenot 2015-03-05 11:32:32 UTC
Nice feature, but I can't test the patch on a sandbox.

Some problems occurred applying patches from bug 11299 11300:
<h1>Something went wrong !</h1>Applying: Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server. Also modifies the automatic linker button so it won't create empty authorities when used.
fatal: sha1 information is lacking or useless (C4/Biblio.pm).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.

Patch failed at 0001 Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server. Also modifies the automatic linker button so it won't create empty authorities when used.

When you have resolved this problem run git bz apply --continue.
If you would prefer to skip this patch, instead run git bz apply --skip.
To restore the original branch and stop patching run git bz apply --abort.
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.

23147 - Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server.
Comment 2 Blou 2015-04-15 20:32:21 UTC Comment hidden (obsolete)
Comment 3 Blou 2015-04-15 20:37:27 UTC
I rebased the patch, on top of bz 11299.  I fixed the issues spotted by qa-test.  This now applies cleanly.

***** Remember to first apply 11299 before *****
Comment 4 Blou 2015-04-16 16:03:13 UTC Comment hidden (obsolete)
Comment 5 Blou 2015-04-16 16:03:30 UTC Comment hidden (obsolete)
Comment 6 Blou 2015-04-16 16:04:23 UTC
Rebased over 11299, and small fixes added in new patch
Comment 7 Blou 2015-04-16 20:17:58 UTC Comment hidden (obsolete)
Comment 8 Blou 2015-05-28 20:33:27 UTC Comment hidden (obsolete)
Comment 9 Bouzid Fergani 2015-12-02 13:27:22 UTC
Created attachment 45324 [details] [review]
Bug 11300 - Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server

This patch depends on code added in Bug 11299, and must be applied after it.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.
Comment 10 Josef Moravec 2016-02-16 13:44:29 UTC
Could you rebase please?
Comment 11 Bouzid Fergani 2016-10-14 14:09:20 UTC
Created attachment 56542 [details] [review]
Bug 11300 - Add a Z39.50 Linker that searches for authority links in the specified Z39.50 server

This patch depends on code added in Bug 11299, and must be applied after it.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.
Comment 12 Bouzid Fergani 2016-10-14 14:17:25 UTC
Created attachment 56543 [details] [review]
Bug 11300: small fix for adjust using first,last and default in result search, using index Match-heading for search

- Rebase all patches .
- Fix using first,last and default in result search.
- Using index Match-heading for search z3950 server.
Comment 13 Bouzid Fergani 2017-03-10 16:42:49 UTC
Created attachment 60999 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Comment 14 Bouzid Fergani 2017-03-10 16:44:10 UTC
Hi all,
I rebase all patches and squash all in one good patch.
Thanks.
Comment 15 Katrin Fischer 2017-05-01 23:51:33 UTC
Blocked by failed 11299 for now - hope we can get this moving soon!
Comment 16 Bouzid Fergani 2017-09-15 20:41:08 UTC
Created attachment 67165 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Comment 17 Bouzid Fergani 2017-09-15 20:42:07 UTC
Rebase patch because it have conflict
Comment 18 Bouzid Fergani 2017-09-15 20:45:24 UTC
Hi katrin,
I change status for this patch, because 11299 it's needs signoff.
Thanks.
Bouzid.
Comment 19 Katrin Fischer 2017-10-09 06:36:43 UTC
Patch applies cleanly on top of bug 11299!
Comment 20 Katrin Fischer 2017-10-14 19:23:49 UTC
Comment on attachment 67165 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.

Review of attachment 67165 [details] [review]:
-----------------------------------------------------------------

Hi Bouzid,

noted some thing in the splinter review. Additionally:

- atomicupdate for adding the system preference is missing
- You will have to add tests for the new module to pass QA
- QA tools show some fails:

 OK	C4/Biblio.pm
   OK	  critic
   OK	  forbidden patterns
   OK	  git manipulation
   OK	  pod
   OK	  pod coverage
   OK	  spelling
   OK	  valid

 FAIL	C4/Linker/Z3950Server.pm
   FAIL	  critic
		Found use of Switch. This module is deprecated by the Perl 5 Porters at line 223, column 5. Find an alternative module.
   OK	  forbidden patterns
   OK	  git manipulation
   OK	  pod
   FAIL	  pod coverage
		POD is missing for flip_heading
		POD is missing for getZ3950Authority
		POD is missing for get_link
		POD is missing for update_cache
   OK	  spelling
   OK	  valid

 OK	cataloguing/automatic_linker.pl
   OK	  critic
   OK	  forbidden patterns
   OK	  git manipulation
   OK	  pod
   OK	  spelling
   OK	  valid

 FAIL	installer/data/mysql/sysprefs.sql
   OK	  git manipulation
   OK	  semicolon
   FAIL	  sysprefs_order
		Not blocker: Sysprefs AdditionalFieldsInZ3950ResultSearch is bad placed (see bug 10610)

- I've tried to configure and test the feature, but see an alert with an internal server error. Plack error logs show:

CGI::param called in list context from package CGI::Compile::ROOT::home_vagrant_kohaclone_cataloguing_automatic_linker_2epl line 65, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436.
Personal-name,do-not-truncate,ext="K�rger, Walter Christian"
ZOOM error 114 "Unsupported Use attribute" (addinfo: "Personal-name") from diag-set 'Bib-1' at /home/vagrant/kohaclone/C4/Linker/Z3950Server.pm line 260.
Can't locate object method "get_link" via package "C4::Linker::Default" (perhaps you forgot to load "C4::Linker::Default"?) at /home/vagrant/kohaclone/C4/Biblio.pm line 533.

::: C4/Linker/Z3950Server.pm
@@ +15,5 @@
> +# You should have received a copy of the GNU General Public License
> +# along with Koha; if not, see <http://www.gnu.org/licenses>.
> +
> +use strict;
> +use warnings;

Please use Modern::Perl instead!

::: installer/data/mysql/sysprefs.sql
@@ +8,5 @@
>  ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
>  ('AddressFormat','us','us|de|fr','Choose format to display postal addresses', 'Choice'),
> +('AdditionalFieldsInZ3950ResultSearch', '', NULL, 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of a search Z3950', 'Free'),
> +('AddPatronLists','categorycode','categorycode|category_type','Allow user to choose what list to pick up from when adding patrons','Choice'),
> +('AddressFormat','us','','Choose format to display postal addresses', 'Choice'),

I think there is a merge error here - the new pref (LinkerZ3950Server) is missing and others are doubled up.
Comment 21 Bouzid Fergani 2017-11-10 21:39:16 UTC
Created attachment 69096 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Comment 22 Bouzid Fergani 2017-11-17 20:24:15 UTC
Created attachment 69204 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Comment 23 Bouzid Fergani 2017-11-17 20:35:20 UTC
Hi Katrin,
I fixed :
     - adding atomicupdate
     - cleaninig sysprefs.sql
     - Some problem of QA tools
     - Use Modern::Perl
     - internal error server
But, I do not know how to add tests for new linker, because it uses z3950 server?, any idea.

 Thanks
Comment 24 Katrin Fischer 2017-12-18 22:33:34 UTC
Comment on attachment 69204 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.

Review of attachment 69204 [details] [review]:
-----------------------------------------------------------------

Hi Bouzid, did you attach the most recent patch? This one is not using Modern::Perl as you said in your last comment?

I have taken another look at the code, some are questions:

::: C4/Linker/Z3950Server.pm
@@ +1,1 @@
> +package C4::Linker::Z3950Server;

I am not sure about adding a new module to the C4 namespace at this point in time, as we have been busy moving things into the new Koha namespace. This might be something to check with the Release Manager. It might be ok because of the relationship with C4::Linker.

@@ +15,5 @@
> +# You should have received a copy of the GNU General Public License
> +# along with Koha; if not, see <http://www.gnu.org/licenses>.
> +
> +use strict;
> +use warnings;

You should always use Modern::Perl instead of use strict; use warnings;

@@ +121,5 @@
> +  ($authid, $record, $status) = $self->getZ3950Authority($heading);
> +
> +  Do a Z39.50 search for the heading using the $conn ZOOM::Connection object and the $heading Heading.
> +  The column origincode is used to check for duplicates.
> +  FIXME: Use thesaurus in search? As of Koha 3.8, the community stopped using them.

What's this comment referring to?

@@ +167,5 @@
> +    }
> +    my $query;
> +    if ($heading->{'auth_type'} eq 'PERSO_NAME' ){
> +         $query =qq(Personal-name,do-not-truncate,ext="$heading->{'search_form'}");
> +    }elsif ($heading->{'auth_type'}  eq 'UNIF_TITLE' ) {

I am not sure if these are universal or only specific to MARC21. :(

@@ +214,5 @@
> +        my $authtypecode = C4::AuthoritiesMarc::GuessAuthTypeCode($record);
> +        my $authId;
> +
> +        # Use the control number to prevent the creation of duplicate authorities.
> +        my $controlNumber = $record->field('970')->subfield('0');

What is 970? I checked authority frameworks and bibliograpic frameworks but it's defined in neither?

@@ +225,5 @@
> +        # Corrections and verifications before insertion
> +        my $format;
> +        my $leader='     nz  a22     o  4500';# Leader for incomplete MARC21 record
> +
> +        if (uc(C4::Context->preference('marcflavour')) eq 'UNIMARC') {

No need for uc() here I think.

@@ +238,5 @@
> +                $record->leader($leader);
> +            }
> +            if (!$record->field('003')) {
> +                $record->insert_fields_ordered(
> +                        MARC::Field->new('003',C4::Context->preference('MARCOrgCode'))

I think this needs to be adjusted - as of 17.11 the MARCOrgCode can also be set on library level.
Comment 25 Bouzid Fergani 2018-09-25 19:47:16 UTC
Created attachment 79400 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Comment 26 Cori Lynn Arnold 2018-10-16 16:07:42 UTC
Can we add some test steps for this?
Comment 27 Michal Denar 2019-04-14 12:37:45 UTC
It's very useful feature, but sleep very long. Time to take it back to life?
Comment 28 Bouzid Fergani 2019-10-28 20:06:58 UTC
Created attachment 94819 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Comment 29 Bouzid Fergani 2019-10-28 20:08:18 UTC
I rebased the bug 11299 and test this.
Thanks.
Bouzid.
Comment 30 Bouzid Fergani 2019-10-30 12:52:53 UTC
Created attachment 94875 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Comment 31 Michal Denar 2019-11-07 12:55:54 UTC
Any test plan?


Thanks.
Comment 32 Myka Kennedy Stephens 2020-02-12 01:26:55 UTC
(In reply to Michal Denar from comment #31)
> Any test plan?
> 
> 
> Thanks.

+1 - I'd be willing to try and test if there's a test plan. Thank you!
Comment 33 Phil Ringnalda 2020-04-16 16:46:35 UTC
Since the Library of Congress has separate databases (and thus separate servers, as far as Koha is concerned) for name authorities and subject authorities, it would probably save time later on to just start out with the ability to either specify more than one LinkerZ3950Server, or to specify which server to use for each authority type.
Comment 34 Bernardo Gonzalez Kriegel 2020-05-01 11:52:31 UTC
Sorry, does not apply.
Please rebase.
Comment 35 Blou 2020-10-15 21:12:03 UTC
Created attachment 111801 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Comment 36 Blou 2020-10-15 21:14:05 UTC
All I did was rebase it over the almost-successful Bug 11299.

It has not been tested and should not be evaluated.
Comment 37 Blou 2020-10-16 15:18:52 UTC
Created attachment 111896 [details] [review]
Bug 11300 - Add a new authority linker which searches for authority links on a Z39.50 server.
Comment 38 Maryse Simard 2021-01-16 14:52:19 UTC
Created attachment 115217 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 39 Fridolin Somers 2021-01-18 15:16:56 UTC
Can this work with SRU target ?
In France BNF only provides SRU for authorities.
Comment 40 Michal Denar 2022-02-17 21:27:57 UTC
Hi,
if I apply patch, set linker and try to use autolinker:
Error : 
Can't locate object method "ModZebrations" via package "C4::Context" at /kohadevbox/koha/C4/Linker/Z3950Server.pm line 151
	C4::Linker::Z3950Server::getZ3950Authority('C4::Linker::Z3950Server=HASH(0x5587c5b84068)', 'C4::Heading=HASH(0x5587c5baa240)') called at /kohadevbox/koha/C4/Linker/Z3950Server.pm line 92
	C4::Linker::Z3950Server::get_link('C4::Linker::Z3950Server=HASH(0x5587c5b84068)', 'C4::Heading=HASH(0x5587c5baa240)') called at /kohadevbox/koha/C4/Biblio.pm line 619
	C4::Biblio::LinkBibHeadingsToAuthorities('C4::Linker::Z3950Server=HASH(0x5587c5b84068)', 'MARC::Record=HASH(0x5587c5b7a678)', '', '', undef, 1) called at /kohadevbox/koha/C4/Biblio.pm line 558
	C4::Biblio::BiblioAutoLink('MARC::Record=HASH(0x5587c5b7a678)', '', 1) called at /kohadevbox/koha/svc/cataloguing/automatic_linker.pl line 45
	eval {...} at /kohadevbox/koha/svc/cataloguing/automatic_linker.pl line 2
	CGI::Compile::ROOT::kohadevbox_koha_svc_cataloguing_automatic_linker_2epl::__ANON__('CGI::Compile=HASH(0x5587c3772dc0)', '', '/kohadevbox/koha/svc/cataloguing/automatic_linker.pl', '/kohadevbox/koha/svc/cataloguing', 'ARRAY(0x5587c6b4b910)') called at /usr/share/perl5/CGI/Compile.pm line 151
	CGI::Compile::ROOT::kohadevbox_koha_svc_cataloguing_automatic_linker_2epl::automatic_linker_2epl at /usr/share/perl5/CGI/Emulate/PSGI.pm line 30
	CGI::Emulate::PSGI::__ANON__('HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/App/WrapCGI.pm line 95
	Plack::App::WrapCGI::call('Plack::App::WrapCGI=HASH(0x5587c4956ac8)', 'HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/App/CGIBin.pm line 50
	Plack::App::CGIBin::serve_path('Plack::App::CGIBin=HASH(0x5587b9c4d248)', 'HASH(0x5587c5d42800)', '/kohadevbox/koha/svc/cataloguing/automatic_linker.pl') called at /usr/share/perl5/Plack/App/File.pm line 34
	Plack::App::File::call('Plack::App::CGIBin=HASH(0x5587b9c4d248)', 'HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Middleware/LogWarn.pm line 22
	Plack::Middleware::LogWarn::call('Plack::Middleware::LogWarn=HASH(0x5587c36c31a0)', 'HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Middleware/Log4perl.pm line 30
	Plack::Middleware::Log4perl::call('Plack::Middleware::Log4perl=HASH(0x5587c369dd30)', 'HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Middleware/HTTPExceptions.pm line 20
	Plack::Middleware::HTTPExceptions::try {...}  at /usr/share/perl5/Try/Tiny.pm line 100
	eval {...} at /usr/share/perl5/Try/Tiny.pm line 93
	Try::Tiny::try('CODE(0x5587c62fdf40)', 'Try::Tiny::Catch=REF(0x5587c6b513a8)') called at /usr/share/perl5/Plack/Middleware/HTTPExceptions.pm line 23
	Plack::Middleware::HTTPExceptions::call('Plack::Middleware::HTTPExceptions=HASH(0x5587c36c37e8)', 'HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Middleware/ErrorDocument.pm line 15
	Plack::Middleware::ErrorDocument::call('Plack::Middleware::ErrorDocument=HASH(0x5587c368d528)', 'HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/App/URLMap.pm line 71
	Plack::App::URLMap::call('Plack::App::URLMap=HASH(0x5587c34fcbc0)', 'HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c5d42800)') called at /kohadevbox/koha/Koha/Middleware/RealIP.pm line 64
	Koha::Middleware::RealIP::call('Koha::Middleware::RealIP=HASH(0x5587c36a6c08)', 'HASH(0x5587c5d42800)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c5d42800)') called at /kohadevbox/koha/Koha/Middleware/SetEnv.pm line 104
	Koha::Middleware::SetEnv::call('Koha::Middleware::SetEnv=HASH(0x5587c36bfee0)', 'HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Middleware/Static.pm line 18
	Plack::Middleware::Static::call('Plack::Middleware::Static=HASH(0x5587c368d3f0)', 'HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Middleware/ReverseProxy.pm line 68
	Plack::Middleware::ReverseProxy::call('Plack::Middleware::ReverseProxy=HASH(0x5587c368d798)', 'HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Middleware/Lint.pm line 24
	Plack::Middleware::Lint::call('Plack::Middleware::Lint=HASH(0x5587b9c4d008)', 'HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Middleware::StackTrace::try {...}  at /usr/share/perl5/Try/Tiny.pm line 100
	eval {...} at /usr/share/perl5/Try/Tiny.pm line 93
	Plack::Middleware::StackTrace::call('Plack::Middleware::StackTrace=HASH(0x5587c2353b70)', 'HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Middleware/AccessLog.pm line 27
	Plack::Middleware::AccessLog::call('Plack::Middleware::AccessLog=HASH(0x5587c2353de0)', 'HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Component.pm line 50
	Plack::Component::__ANON__('HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Plack/Util.pm line 145
	eval {...} at /usr/share/perl5/Plack/Util.pm line 145
	Plack::Util::run_app('CODE(0x5587c2353d68)', 'HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Starman/Server.pm line 195
	Starman::Server::dispatch_request('Starman::Server=HASH(0x5587b9669a58)', 'HASH(0x5587c6b4acb0)') called at /usr/share/perl5/Starman/Server.pm line 298
	Starman::Server::process_request('Starman::Server=HASH(0x5587b9669a58)', 'Net::Server::Proto::UNIX=GLOB(0x5587c64e7f68)') called at /usr/share/perl5/Net/Server.pm line 72
	Net::Server::run_client_connection('Starman::Server=HASH(0x5587b9669a58)') called at /usr/share/perl5/Net/Server/PreFork.pm line 225
	eval {...} at /usr/share/perl5/Net/Server/PreFork.pm line 225
	Net::Server::PreFork::run_child('Starman::Server=HASH(0x5587b9669a58)') called at /usr/share/perl5/Net/Server/PreFork.pm line 183
	Net::Server::PreFork::run_n_children('Starman::Server=HASH(0x5587b9669a58)', 2) called at /usr/share/perl5/Net/Server/PreFork.pm line 107
	Net::Server::PreFork::loop('Starman::Server=HASH(0x5587b9669a58)') called at /usr/share/perl5/Net/Server.pm line 58
	Net::Server::run('Starman::Server=HASH(0x5587b9669a58)', 'port', 'ARRAY(0x5587b9bf82f8)', 'host', '*', 'proto', 'tcp', 'serialize', 'none', 'min_servers', 2, 'min_spare_servers', 1, 'max_spare_servers', 1, 'max_servers', 2, 'max_requests', 50, 'user', 'kohadev-koha', 'group', 'kohadev-koha', 'listen', 1024, 'check_for_waiting', 1, 'no_client_stdout', 1, 'log_file', '/var/log/koha/kohadev/plack-error.log', 'setsid', 1, 'pid_file', '/var/run/koha/kohadev/plack.pid', 'background', 1) called at /usr/share/perl5/Starman/Server.pm line 106
	Starman::Server::run('Starman::Server=HASH(0x5587b9669a58)', 'CODE(0x5587b9669908)', 'HASH(0x5587b96696b0)') called at /usr/share/perl5/Plack/Handler/Starman.pm line 25
	Plack::Handler::Starman::run('Plack::Handler::Starman=HASH(0x5587b9669920)', 'CODE(0x5587b9669908)') called at /usr/share/perl5/Plack/Loader/Delayed.pm line 20
	Plack::Loader::Delayed::run('Plack::Loader::Delayed=HASH(0x5587b93b6570)', 'Plack::Handler::Starman=HASH(0x5587b9669920)') called at /usr/share/perl5/Plack/Runner.pm line 279
	Plack::Runner::run('Plack::Runner=HASH(0x5587b93538e8)') called at /usr/bin/starman line 38
Comment 41 Shi Yao Wang 2022-04-20 17:57:52 UTC
Created attachment 133496 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 42 Shi Yao Wang 2022-06-21 20:41:36 UTC
Created attachment 136404 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 43 Michal Denar 2022-06-22 19:39:36 UTC
Would it be possible to add a test plan? I have applied the patch, set it up according to the instructions, but the authority linking does not work. Nothing happens.
Comment 44 Shi Yao Wang 2022-07-22 14:26:57 UTC
Created attachment 138029 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 45 Shi Yao Wang 2022-09-30 14:17:36 UTC
Created attachment 141168 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 46 Shi Yao Wang 2022-11-04 20:53:23 UTC
Created attachment 143292 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 47 Michal Denar 2023-03-28 12:07:32 UTC
Hi,
can you update this on master? I can test this patch.

Thank you.
Comment 48 Hammat wele 2023-03-28 13:58:40 UTC
Created attachment 148824 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 49 Hammat wele 2023-05-11 13:28:24 UTC
Created attachment 151079 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 50 Hammat wele 2023-05-11 13:30:14 UTC
I rebased the patch
Comment 51 Phil Ringnalda 2023-05-12 18:05:31 UTC
Here's a super-simple test plan, which fails.

1. Set the preference LinkerModule to Z39.50 Server
2. Set the preference LinkerZ3950Server to LIBRARY OF CONGRESS SUBJECTS
3. Set the preference  LinkerOptions to local_first
4. Verify that your local authorities include "Perl (Computer program language)" but do not include "Scripting languages (Computer science)"
5. Cataloging > New record
6. 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.
7. 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" - if you are told "650 - No matching authority found" then this patch does not work.
Comment 52 Phil Ringnalda 2023-05-12 18:08:19 UTC
Also, the patch has included adding the file C4/Biblio.pm.rej for a couple of years now.

Also, there are still unaddressed concerns from comment 24 from 5+ years ago.
Comment 53 Hammat wele 2023-05-19 13:21:28 UTC
Created attachment 151476 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 54 Hammat wele 2023-05-19 13:21:36 UTC
Created attachment 151477 [details]
Bug 11300: (Fix) Editing the way authority links is searched on a Z39.50 server.

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
Comment 55 Phil Ringnalda 2023-05-19 19:52:22 UTC
Sorry if my "super-simple test plan" was confusing. I didn't intend that to be a description of everything the feature should do, only a super-simple way to tell whether or not it does anything at all, because testers have been asking for that since 2018. I certainly didn't intend to imply that the only thing a linker needs to do is link subjects which have only subfield a.

A real test plan would include all the authority types that automatic linking supports, and headings with multiple subfields, and headings that should not match (for example, LC has an authority record for 150 $aAbandoned children$vFiction, which should not match 650 $aAbandoned children$xFiction, and $aAlabama$xHistory$yCivil War, 1861-1865 should match but in a different order $aAlabama$yCivil War, 1861-1865$xHistory should not).
Comment 56 Blou 2023-05-23 12:46:17 UTC
(In reply to Phil Ringnalda from comment #55)
> children$xFiction, and $aAlabama$xHistory$yCivil War, 1861-1865 should match
> but in a different order $aAlabama$yCivil War, 1861-1865$xHistory should
> not).

Are you saying subfield order should matter?
Comment 57 Phil Ringnalda 2023-05-23 14:25:40 UTC
Correct: the order of subfields matters, which subfield letter it is matters, and whether or not there is a subfield matters ($aScience fiction should not match $aScience$vFiction).
Comment 58 Blou 2023-05-23 14:32:26 UTC
The code will not care about the order.  I would be doing that and I would hear about it asking why there are duplicates.
Comment 59 Phil Ringnalda 2023-05-24 02:02:23 UTC
I wasn't asking for a weird enhancement I just thought of, I was describing the behavior of an authority linker. Order matters, Dogs -- Food and Food -- Dogs are not the same headings.
Comment 60 Hammat wele 2023-09-14 04:08:06 UTC
Created attachment 155602 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 61 Hammat wele 2023-09-14 04:08:12 UTC
Created attachment 155603 [details] [review]
Bug 11300: (Fix) Fixing the authority linking
Comment 62 Phil Ringnalda 2023-09-14 04:47:06 UTC
Does a publicly-available z39.50 server where this would actually work exist? It would have to only return results from the main heading, and only exact matches. No z39.50 authority servers I know of do either one of those things.

I tried linking two headings, "Scripting languages (Computer science)" which was linked to "ActionScript (Computer program language)" (because Scripting languages (Computer science) is in a 550 on that record) and "Patterson, James" which was linked to "Patterson, James A., 1947-" because that happens to be the first of the 14 pages of results the Library of Congress name authority server returns.
Comment 63 Phil Ringnalda 2023-10-20 04:37:58 UTC
I guess that means there isn't a server where it works?
Comment 64 Michal Denar 2023-10-20 11:43:39 UTC
Hi,
if I try Authority server of National library Czech republic via Yaz client:

find @attr 1=1016 "ph135534" I get just one result. Number "ph135534" is is a unique authority identifier that also appears in the corresponding field of the biblio record

Attribute 1016 = any term

find @attr 1=1003 "Kinney Jeff 1971-" show just one result:

[AUT]Record type: USmarc
00869cz  a2200241n  4500
001 xx0093180
003 CZ PrNK
005 20110512104424.0
008 090327|n|acnnnaabn           n a|a
040    $a ULG001 $b cze $d ABA001
046    $f 1971
100 1  $a Kinney, Jeff, $d 1971- $7 xx0093180
667    $a Záznam neprošel revizí podle pravidel RDA.
670    $a Jeho: Deník malého poseroutky
670    $a LC (Names), cit. 12. 5. 2011
670    $a www(Wikipedia, the free encyclopedia)
678 0  $a Americký spisovatel a ilustrátor, autor knih pro děti.
856 42 $u http://en.wikipedia.org/wiki/Jeff_Kinney_(writer) $4 N
906    $a za20090327 $b xivze
906    $a op20110512 $b anmu $c zdroj - aktualizace, další výskyt, URL - nově, biografická poznámka -doplnění
996    $a xx $b 60 $c 20090327 $l AUT10
996    $a 0073 $b 60 $c 20110512 $l AUT10
998    $a 000505890

Same if I try to find find @attr 1=1003 "xx0093180".

I think a linker can work, but it should have the appropriate settings. Ideally one where you can write exact queries to Yaz that are tailored to the 39.50 North that the linker will query.
Comment 65 Michal Denar 2023-10-20 11:46:22 UTC
I think a linker can work, but it should have the appropriate settings. Ideally one where you can write exact queries to Yaz that are tailored to the z39.50 server that the linker will query.
Comment 66 Salah Ghedda 2023-12-12 15:22:49 UTC
Created attachment 159741 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 67 Salah Ghedda 2023-12-12 15:22:53 UTC
Created attachment 159742 [details] [review]
Bug 11300: (Fix) Fixing the authority linking
Comment 68 Salah Ghedda 2023-12-12 15:23:29 UTC
Rebased
Comment 69 Hammat wele 2024-03-26 17:41:11 UTC
Created attachment 163946 [details] [review]
Bug 11300: Add a new authority linker which searches for authority links on a Z39.50 server.

This patch adds a Z39.50 Linker which searches for authority links on a remote server.

If a matching authority is found, it's imported in the local database for linking with the current biblio record.

If no matching authority was found on the remote server, the Linker falls back to a local authority search.

Configuration :
* The option "Z39.50 Server" is added to the LinkerModule preference. You must choose this to use the new Linker.
* The preference LinkerZ3950Server is required and specifies which server to use for linking. It must contain the "name" of the server, as defined in the z3950servers table.
* You can set the "local_first" option in the LinkerOptions preference to force the Linker to search for authorities in the local database first. If no local authority match was found, the Linker falls back to a remote Z39.50 search.

Sponsored-by: CCSR ( http://www.ccsr.qc.ca )
Comment 70 Hammat wele 2024-03-26 17:41:16 UTC
Created attachment 163947 [details] [review]
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
Comment 71 Michal Denar 2024-03-26 21:22:09 UTC
Hi,
I am following the Test plan, but the missing authorities will not download from 39.50. What is worse, in the lines where the link to the authority is missing, when I click on the Create authority icon I get error 403: Programming error - No CSRF token passed for POST http://localhost:8081/intranet/authorities/authorities.pl (referer: http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=)

I'm not sure if I was able to set up LinkerZ3950Server correctly. It would be more user friendly and reliable to choose from the available servers rather than just writing its name. 

Then I have one more question. If z39.50 provide separately personal and subject, we may run into the problem that this option is now not possible to set up. Yet for fields 100 or 700 we are just looking for personal authorities and in fields 6X for subjects.