Bugzilla – Attachment 98222 Details for
Bug 24531
OAI-PMH set mappings only consider first field with a given tag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24531 - Fix OAI-PMH sets for records with repeated fields
Bug-24531---Fix-OAI-PMH-sets-for-records-with-repe.patch (text/plain), 1.59 KB, created by
David Nind
on 2020-01-31 09:58:47 UTC
(
hide
)
Description:
Bug 24531 - Fix OAI-PMH sets for records with repeated fields
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-01-31 09:58:47 UTC
Size:
1.59 KB
patch
obsolete
>From 6a628b9e2e9abf89d8f276daa8102c0ec93b2ced Mon Sep 17 00:00:00 2001 >From: Magnus Enger <magnus@libriotech.no> >Date: Wed, 29 Jan 2020 23:59:44 +0100 >Subject: [PATCH] Bug 24531 - Fix OAI-PMH sets for records with repeated fields > >Currently, an OAI-PMH set mapping will only match if the value it >is looking for occurs in the first instance of a repeated field. > >To test: >- Apply the first patch with two new tests >- Run something like this: > sudo koha-shell -c "prove -v t/db_dependent/OAI/Sets.t" kohadev >- Verify that the last test fails >- Apply this secind patch >- Rerun the test file above >- Verify that all tests now pass > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/OAI/Sets.pm | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > >diff --git a/C4/OAI/Sets.pm b/C4/OAI/Sets.pm >index 44100e8794..454f80c224 100644 >--- a/C4/OAI/Sets.pm >+++ b/C4/OAI/Sets.pm >@@ -541,7 +541,18 @@ sub _evalRule { > my $subfield = $mapping->{'marcsubfield'}; > my $operator = $mapping->{'operator'}; > my $value = $mapping->{'marcvalue'}; >- my @subfield_values = $record->subfield($field, $subfield); >+ >+ my @subfield_values; >+ # Get all the fields with the given tag >+ my @fields = $record->field($field); >+ # Iterate over all the fields >+ foreach my $field ( @fields ) { >+ # Get the value from the given subfield >+ if ( my $subfield_value = $field->subfield($subfield) ) { >+ push @subfield_values, $subfield_value; >+ } >+ } >+ > if ($operator eq 'notequal') { > if(0 == grep /^$value$/, @subfield_values) { > return 1; >-- >2.11.0
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 24531
:
98153
|
98154
|
98221
|
98222
|
98894
|
98895
|
98896
|
98897
|
98906
|
98907