Bugzilla – Attachment 82961 Details for
Bug 21826
Automatic authority record generation improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21826: Use subfield map in LinkBibHeadingsToAuthorities
Bug-21826-Use-subfield-map-in-LinkBibHeadingsToAut.patch (text/plain), 3.51 KB, created by
Ere Maijala
on 2018-12-07 12:50:43 UTC
(
hide
)
Description:
Bug 21826: Use subfield map in LinkBibHeadingsToAuthorities
Filename:
MIME Type:
Creator:
Ere Maijala
Created:
2018-12-07 12:50:43 UTC
Size:
3.51 KB
patch
obsolete
>From b6a1e8cb3df392191e8fa936470ac57c94625792 Mon Sep 17 00:00:00 2001 >From: Ere Maijala <ere.maijala@helsinki.fi> >Date: Tue, 13 Nov 2018 16:43:50 +0000 >Subject: [PATCH] Bug 21826: Use subfield map in LinkBibHeadingsToAuthorities > >Use only allowable subfields when creating authorities from >bibliographic records. > >Sponsored-by: National Library of Finland >Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Biblio.pm | 7 +++++-- > C4/Heading.pm | 18 ++++++++++++++++++ > C4/Heading/MARC21.pm | 15 +++++++++++++++ > 3 files changed, 38 insertions(+), 2 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 808ed8d067..0249983331 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -539,7 +539,10 @@ sub LinkBibHeadingsToAuthorities { > '', '', "a" => "" . $field->subfield('a') ); > map { > $authfield->add_subfields( $_->[0] => $_->[1] ) >- if ( $_->[0] =~ /[A-z]/ && $_->[0] ne "a" ) >+ if ( $_->[0] =~ /[A-z]/ && $_->[0] ne "a" >+ && C4::Heading::valid_bib_heading_subfield( >+ $authority_type->auth_tag_to_report, $_->[0] ) >+ ); > } $field->subfields(); > $marcrecordauth->insert_fields_ordered($authfield); > >@@ -2989,7 +2992,7 @@ sub _koha_modify_biblio { > > $sth->execute( > $frameworkcode, $biblio->{'author'}, $biblio->{'title'}, $biblio->{'unititle'}, $biblio->{'notes'}, >- $biblio->{'serial'}, $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'}, $biblio->{'biblionumber'} >+ $biblio->{'serial'}, $biblio->{'seriestitle'}, $biblio->{'copyrightdate'} ? int($biblio->{'copyrightdate'}) : undef, $biblio->{'abstract'}, $biblio->{'biblionumber'} > ) if $biblio->{'biblionumber'}; > > if ( $dbh->errstr || !$biblio->{'biblionumber'} ) { >diff --git a/C4/Heading.pm b/C4/Heading.pm >index 642ecbaa6b..53dd0074f2 100644 >--- a/C4/Heading.pm >+++ b/C4/Heading.pm >@@ -17,6 +17,8 @@ package C4::Heading; > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >+use Modern::Perl; >+ > use strict; > use warnings; > use 5.010; >@@ -172,6 +174,22 @@ sub preferred_authorities { > return $results; > } > >+=head2 valid_bib_heading_subfield >+ >+ if (C4::Heading::valid_bib_heading_subfield('100', 'e', '')) ... >+ >+=cut >+ >+sub valid_bib_heading_subfield { >+ my $tag = shift; >+ my $subfield = shift; >+ my $marcflavour = @_ ? shift : C4::Context->preference('marcflavour'); >+ >+ my $marc_handler = _marc_format_handler($marcflavour); >+ >+ return $marc_handler->valid_bib_heading_subfield( $tag, $subfield ); >+} >+ > =head1 INTERNAL METHODS > > =head2 _search >diff --git a/C4/Heading/MARC21.pm b/C4/Heading/MARC21.pm >index 9a50cf6c28..fc4d576a45 100644 >--- a/C4/Heading/MARC21.pm >+++ b/C4/Heading/MARC21.pm >@@ -161,6 +161,21 @@ sub valid_bib_heading_tag { > > } > >+=head2 valid_bib_heading_subfield >+ >+=cut >+ >+sub valid_bib_heading_subfield { >+ my $self = shift; >+ my $tag = shift; >+ my $subfield = shift; >+ >+ if ( exists $bib_heading_fields->{$tag} ) { >+ return 1 if ($bib_heading_fields->{$tag}->{subfields} =~ /$subfield/); >+ } >+ return 0; >+} >+ > =head2 parse_heading > > =cut >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21826
:
82310
|
82311
|
82479
|
82480
|
82481
|
82514
|
82515
|
82516
|
82517
|
82535
|
82536
|
82537
|
82576
|
82577
|
82578
|
82579
|
82580
|
82634
|
82635
|
82636
|
82637
|
82638
| 82961 |
82962
|
82963
|
82964
|
82965