From ff0da4944cbb2f2a9af645bdc399e8df7cef8793 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 4 May 2022 14:30:28 +0000 Subject: [PATCH] Bug 30678: Add OCLC_NO as option to OPACSearchForTitleIn We need to pass OCLC_NO as key to C4::Output::parametrized_url. We get it from MARC21 035$a and strip the organizational code. Test plan: Add e.g. 62385712 in 035$a in a record. Add e.g. following link to pref OPACSearchForTitleIn: WorldCat (via OCLC number) Open that record on detail page. Click More searches. Follow that link. Signed-off-by: Marcel de Rooy Signed-off-by: David Nind Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- opac/opac-ISBDdetail.pl | 3 +++ opac/opac-MARCdetail.pl | 3 +++ opac/opac-detail.pl | 3 +++ 3 files changed, 9 insertions(+) diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 2d2355bb79..7707d45244 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -201,6 +201,8 @@ my $issn = $marcissns->[0] || ''; if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ $dat->{title} =~ s/\/+$//; # remove trailing slash $dat->{title} =~ s/\s+$//; # remove trailing space + my $oclc_no = $record->subfield('035','a') // q{}; + $oclc_no =~ s/\([^)]*\)//; $search_for_title = parametrized_url( $search_for_title, { @@ -210,6 +212,7 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ ISSN => $issn, CONTROLNUMBER => $marccontrolnumber, BIBLIONUMBER => $biblionumber, + OCLC_NO => $oclc_no, } ); $template->param('OPACSearchForTitleIn' => $search_for_title); diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index b4dae6d4ff..d24ba79161 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -352,6 +352,8 @@ my $issn = $marcissns->[0] || ''; if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ $dat->{title} =~ s/\/+$//; # remove trailing slash $dat->{title} =~ s/\s+$//; # remove trailing space + my $oclc_no = $record->subfield('035','a') // q{}; + $oclc_no =~ s/\([^)]*\)//; $search_for_title = parametrized_url( $search_for_title, { @@ -361,6 +363,7 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ ISSN => $issn, CONTROLNUMBER => $marccontrolnumber, BIBLIONUMBER => $biblionumber, + OCLC_NO => $oclc_no, } ); $template->param('OPACSearchForTitleIn' => $search_for_title); diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 65c6d0d624..bf6d5b313e 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -1186,6 +1186,8 @@ my $issn = $marcissns->[0] || ''; if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ $dat->{title} =~ s/\/+$//; # remove trailing slash $dat->{title} =~ s/\s+$//; # remove trailing space + my $oclc_no = $record->subfield('035','a') // q{}; + $oclc_no =~ s/\([^)]*\)//; $search_for_title = parametrized_url( $search_for_title, { @@ -1195,6 +1197,7 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ ISSN => $issn, CONTROLNUMBER => $marccontrolnumber, BIBLIONUMBER => $biblionumber, + OCLC_NO => $oclc_no, } ); $template->param('OPACSearchForTitleIn' => $search_for_title); -- 2.39.5