Bug 23532 - AutoCreateAuthorities create authority only headings
Summary: AutoCreateAuthorities create authority only headings
Status: RESOLVED DUPLICATE of bug 24421
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-03 10:56 UTC by George Veranis
Modified: 2024-02-23 19:37 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description George Veranis 2019-09-03 10:56:19 UTC
The problem: 
We have enable AutoCreateAuthorities and also enable BiblioAddsAuthorities
and when we insert values for tag 650 , we get authorities only with 150$a filled and not other subfields. 

I found that on C4/Biblio.pm lines 549 - 555

 map {
                        $authfield->add_subfields( $_->[0] => $_->[1] )
                          if ( $_->[0] =~ /[A-z]/ && $_->[0] ne "a"
                            && C4::Heading::valid_bib_heading_subfield(
                                $authority_type->auth_tag_to_report, $_->[0] )
                            );
                    } $field->subfields();

Koha try to copy subfields to the new authority record. 
BUT the condition  

C4::Heading::valid_bib_heading_subfield(
                                $authority_type->auth_tag_to_report, $_->[0])

return false. Because the  $authority_type->auth_tag_to_report has value of 150 and not 650 as file C4/Heading/MARC21.pm declared. 

if we set on file C4/Heading/MARC21.pm also the value 
 '150' => { auth_type => 'TOPIC_TERM', subfields => 'abvxyz', subject => 1 },

(valid based on https://github.com/Koha-Community/Koha/blob/master/installer/data/mysql/en/marcflavour/marc21/mandatory/authorities_normal_marc21.sql)

then it works , but I am not sure if it is valid to set there new fields. 

or better solution could be $authority_type->auth_tag_to_report take right value in condition.

Could anyone propose the best solution ? 

Thanks, 
George Veranis
Comment 1 Andreas Roussos 2021-02-12 14:20:16 UTC
I managed to reproduce this: the current master I used was aa178bc.

In C4/Heading/MARC21.pm, the variable $bib_heading_fields is hardcoded.
Under the 'DATA STRUCTURES' heading there's actually a comment that
reads: "FIXME - this should be moved to a configuration file."

C4/Heading/UNIMARC.pm uses a different approach, where the same
variable is populated from the results of a SELECT statement on the
marc_subfield_structure table.

In my case, to work around this problem, I had to do the following:

1) modify C4/Heading/UNIMARC.pm as per below:

-    '650' => { auth_type => 'TOPIC_TERM', subfields => 'abvxyz', subject => 1 },
+    '650' => { auth_type => 'TOPIC_TERM', subfields => 'abcdegvxyz', subject => 1 },

2) add subfields $c/$d/$e to the MARC framework subfield structure
of field 150 for the TOPIC_TERM authority type.

Then, all subfields entered in tag 650 while adding a biblio in the
Cataloging module were copied to tag 150 of the new authority that
was created automatically.

But, what should we do to fix this issue for the general case?

Could we follow the same approach as for UNIMARC, and populate the
$bib_heading_fields variable from SQL data?

Or do we need a separate configuration file for this?
Comment 2 Andreas Roussos 2023-07-31 21:42:07 UTC
(In reply to Andreas Roussos from comment #1)
> 1) modify C4/Heading/UNIMARC.pm as per below:
I just realised I made a typo there, what I meant to say was:
1) modify C4/Heading/MARC21.pm as per below:
Comment 3 Phil Ringnalda 2024-02-23 19:03:35 UTC
Comment 0 was fixed by bug 24421

For comment 1, e should not be included just like it is not included for name headings: there's one Eastwood, Clint, 1930- whether he was $eactor or $edirector or $eactor, director for a particular biblio record. And for 150, the MARC21 Authority format doesn't define any of c d or e which is correct for e (it's only defined in authorities for use as the relationship between a name and a work in name-title headings) but rather odd for c and d.

So there's no reason why there shouldn't be a bug for adding g to the list of 650 subfields, but adding c and d should start with a spec proposal, https://www.loc.gov/marc/faq.html#changes

*** This bug has been marked as a duplicate of bug 24421 ***