[Koha-bugs] [Bug 32916] [Bug 30280 follow-up] Problems in linking authorities to biblio fields (MARC 21)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Feb 20 16:09:11 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32916

--- Comment #7 from Frank Hansen <frank.hansen at ub.lu.se> ---
Here are the patch I made for C4::Heading_search:

diff --git a/C4/Heading.pm b/C4/Heading.pm
index 7541a56205..9b807b5337 100644
--- a/C4/Heading.pm
+++ b/C4/Heading.pm
@@ -224,8 +224,16 @@ sub _search {
             $subject_heading_thesaurus = 'k';
         } elsif ($ind2 eq '6') {
             $subject_heading_thesaurus = 'v';
-        } else {
+        } elsif ($ind2 eq '7') {
             $subject_heading_thesaurus = 'z';
+            push @marclist, 'thesaurus-conventions';
+            push @and_or, 'and';
+            push @excluding, '';
+            push @operator, 'is';
+            push @value, $self->{'thesaurus'};
+        } else {
+            # use lcsh for anything else
+            $subject_heading_thesaurus = 'a';
         }
         push @marclist, 'thesaurus';
         push @and_or, 'and';
@@ -234,14 +242,6 @@ sub _search {
         push @value, $subject_heading_thesaurus;
     }

-    if ($ind2 eq '7') {
-        push @marclist, 'thesaurus-conventions';
-        push @and_or, 'and';
-        push @excluding, '';
-        push @operator, 'is';
-        push @value, $self->{'thesaurus'};
-    }
-
     require Koha::SearchEngine::QueryBuilder;
     require Koha::SearchEngine::Search;

diff --git a/C4/Heading.pm b/C4/Heading.pm
index 7541a56205..8dede0c090 100644
--- a/C4/Heading.pm
+++ b/C4/Heading.pm
@@ -209,7 +209,7 @@ sub _search {
         push @value,    $self->{'search_form'};
     }

-    if ($self->{'thesaurus'}) {
+    if ($self->{'thesaurus'} && $ind2 ne ' ') {
         if ($ind2 eq '0') {
             $subject_heading_thesaurus = 'a';
         } elsif ($ind2 eq '1') {
@@ -224,8 +224,16 @@ sub _search {
             $subject_heading_thesaurus = 'k';
         } elsif ($ind2 eq '6') {
             $subject_heading_thesaurus = 'v';
-        } else {
+        } elsif ($ind2 eq '7') {
             $subject_heading_thesaurus = 'z';
+            push @marclist, 'thesaurus-conventions';
+            push @and_or, 'and';
+            push @excluding, '';
+            push @operator, 'is';
+            push @value, $self->{'thesaurus'};
+        } else {
+            # use lcsh for anything else
+            $subject_heading_thesaurus = 'a';
         }
         push @marclist, 'thesaurus';
         push @and_or, 'and';
@@ -234,14 +242,6 @@ sub _search {
         push @value, $subject_heading_thesaurus;
     }

-    if ($ind2 eq '7') {
-        push @marclist, 'thesaurus-conventions';
-        push @and_or, 'and';
-        push @excluding, '';
-        push @operator, 'is';
-        push @value, $self->{'thesaurus'};
-    }
-
     require Koha::SearchEngine::QueryBuilder;
     require Koha::SearchEngine::Search;

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list