Bugzilla – Attachment 35896 Details for
Bug 13708
MARC Mapping Item columns to several MARC Fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13708 - MARC Mapping Item columns to several MARC Fields
Bug-13708---MARC-Mapping-Item-columns-to-several-M.patch (text/plain), 2.56 KB, created by
Olli-Antti Kivilahti
on 2015-02-13 12:00:13 UTC
(
hide
)
Description:
Bug 13708 - MARC Mapping Item columns to several MARC Fields
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-02-13 12:00:13 UTC
Size:
2.56 KB
patch
obsolete
>From 2ff8c9a6edf760eb8edddfeb2aff7810994ce425 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Fri, 13 Feb 2015 13:58:49 +0200 >Subject: [PATCH] Bug 13708 - MARC Mapping Item columns to several MARC Fields > >Because we have ran out of MARC subfield codes, we cannot add more Item-columns >from the DB to the search indexable MARC Record. >This patch enables support for "Koha to MARC mapping" to work on other Fields >as well. > >This patch enables editing Items' columns mapped to non-standard MARC Items >Fields. >No further issues regarding using non-standard Item fields identified yet. >--- > C4/Context.pm | 20 ++++++++++++++++++++ > C4/Items.pm | 6 ++++-- > 2 files changed, 24 insertions(+), 2 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 274522e..14b08fe 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -1022,6 +1022,26 @@ sub _new_marcfromkohafield > return $marcfromkohafield; > } > >+sub getItemFieldsForMARC { >+ my ($self, $frameworkcode) = @_; >+ # If the hash already exists, return it. >+ return $context->{itemFieldsForMARC}->{$frameworkcode} if defined($context->{itemFieldsForMARC}->{$frameworkcode}); >+ >+ # No hash. Create one. >+ my $marcToDBMappings = &marcfromkohafield(); >+ my $framework = $marcToDBMappings->{$frameworkcode}; >+ my $itemFields = {}; >+ foreach my $key (keys %$framework) { >+ if ($key =~ /^items\./) { >+ my $itemField = $framework->{$key}->[0]; >+ $itemFields->{$itemField} = 1; >+ } >+ } >+ $context->{itemFieldsForMARC}->{$frameworkcode} = [keys($itemFields)]; >+ >+ return $context->{itemFieldsForMARC}->{$frameworkcode}; >+} >+ > =head2 stopwords > > $dbh = C4::Context->stopwords; >diff --git a/C4/Items.pm b/C4/Items.pm >index a225b49..26f5200 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -499,10 +499,12 @@ sub ModItemFromMarc { > > my $dbh = C4::Context->dbh; > my $frameworkcode = GetFrameworkCode($biblionumber); >- my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); >+ my $itemFieldCodes = C4::Context->getItemFieldsForMARC($frameworkcode); > > my $localitemmarc = MARC::Record->new; >- $localitemmarc->append_fields( $item_marc->field($itemtag) ); >+ foreach my $fieldCode (@$itemFieldCodes) { >+ $localitemmarc->append_fields( $item_marc->field($fieldCode) ); >+ } > my $item = &TransformMarcToKoha( $dbh, $localitemmarc, $frameworkcode, 'items' ); > my $default_values = _build_default_values_for_mod_marc(); > foreach my $item_field ( keys %$default_values ) { >-- >1.7.9.5
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 13708
: 35896