From b3b187b576b10dc4107253872223d9e6b72eab61 Mon Sep 17 00:00:00 2001 From: Johanna Raisa Date: Fri, 29 Jul 2022 08:37:50 +0300 Subject: [PATCH] Bug 30966: Record Overlay Rules - can't use Z39.50 filter This patch fixes overlay rules on z39.50 import Test plan: 1) Create protection overlay rule to some fields for z39.50. 2) Import a record via z39.50. 3) See that the protected fields are replaced on the editor. 4) Apply the patch. 5) Import a record again. 6) See that the protected fields are in place on the editor. Sponsored-by: Koha-Suomi Oy Signed-off-by: Michaela Sieber Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 0970eef56df1ac8fee1f3c5f0216a164be5048ec) Signed-off-by: Matt Blenkinsop (cherry picked from commit 207349be3ae6793ee83141da2648e695b5f711aa) Signed-off-by: Lucas Gass (cherry picked from commit 487a6e9f808af9fdc1dba6c0ecd05c4ee3974fce) Signed-off-by: Arthur Suzuki --- cataloguing/addbiblio.pl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index cfbbb8bc59..07042991c9 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -36,6 +36,7 @@ use C4::Biblio qw( prepare_host_field PrepHostMarcField TransformHtmlToMarc + ApplyMarcOverlayRules ); use C4::Search qw( FindDuplicate enabled_staff_search_views ); use C4::Auth qw( get_template_and_user haspermission ); @@ -855,6 +856,20 @@ if ($biblionumber) { my $sth = $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?"); $sth->execute($biblionumber); ($biblioitemnumber) = $sth->fetchrow; + if (C4::Context->preference('MARCOverlayRules')) { + my $member = Koha::Patrons->find($loggedinuser); + $record = ApplyMarcOverlayRules( + { + biblionumber => $biblionumber, + record => $record, + overlay_context => { + source => $z3950 ? 'z3950' : 'intranet', + categorycode => $member->categorycode, + userid => $member->userid + } + } + ); + } } #------------------------------------------------------------------------------------- @@ -883,7 +898,7 @@ if ( $op eq "addbiblio" ) { $frameworkcode, { overlay_context => { - source => $z3950 ? 'z39.50' : 'intranet', + source => $z3950 ? 'z3950' : 'intranet', categorycode => $member->categorycode, userid => $member->userid } -- 2.39.5