Bugzilla – Attachment 133872 Details for
Bug 28371
Improve performance of XSLTParse4Display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28371: (follow-up) Fetch values if not passed
Bug-28371-follow-up-Fetch-values-if-not-passed.patch (text/plain), 2.67 KB, created by
Nick Clemens (kidclamp)
on 2022-04-26 10:52:04 UTC
(
hide
)
Description:
Bug 28371: (follow-up) Fetch values if not passed
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-04-26 10:52:04 UTC
Size:
2.67 KB
patch
obsolete
>From df03d073b731036a49507f61cdcc402f83d505db Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 26 Apr 2022 10:42:54 +0000 >Subject: [PATCH] Bug 28371: (follow-up) Fetch values if not passed > >There are two places where transformMARC4XSLT is called ouside of XSLTParse4Display > >ILS-DI if expanding avs >get_marc_notes > >The first was pushed after the initial patches here (bug 26195) >The second will only take effect if a notes field is mapped to an av > >This patch adds a fallback in transformMARC4XSLT to cover these uses >and fixes a wrong call in tests >--- > C4/XSLT.pm | 6 ++++++ > t/db_dependent/XSLT.t | 6 +++--- > 2 files changed, 9 insertions(+), 3 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 4b84bb8733..c4a5ec44b9 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -73,6 +73,12 @@ sub transformMARCXML4XSLT { > }; > if ($@) { warn "PROBLEM WITH RECORD"; next; } > my $marcflavour = C4::Context->preference('marcflavour'); >+ >+ # FIXME: This should properly use the cache in the future, but is here to save on performance where possible >+ $av = getAuthorisedValues4MARCSubfields("") unless $av; >+ $branches = { map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' })->as_list } unless $branches; >+ $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } } unless $itemtypes; >+ > foreach my $tag ( keys %$av ) { > foreach my $field ( $record->field( $tag ) ) { > if ( defined $av->{ $tag } ) { >diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t >index a33d8a7e56..18279b7a25 100755 >--- a/t/db_dependent/XSLT.t >+++ b/t/db_dependent/XSLT.t >@@ -79,10 +79,10 @@ subtest 'transformMARCXML4XSLT tests' => sub { > > $av->{952}->{a}->{$auth_val->category}->{$auth_val->authorised_value}->{lib} = ""; > $record->field(952)->update( a => $auth_val->authorised_value, c => $branch_2->branchcode, d => $itemtype_2->itemtype ); >- C4::XSLT::transformMARCXML4XSLT( 3, $record, $branches, $itemtypes, $av ); >+ C4::XSLT::transformMARCXML4XSLT( 3, $record, 0, $branches, $itemtypes, $av ); > is($record->subfield( '952', 'a' ),$auth_val->authorised_value,'952$a is not transformed when value found but blank'); >- is($record->subfield( '952', 'c' ),$branch_2->branchcode,'952$c is returned unaltered invalid branchcode'); >- is($record->subfield( '952', 'd' ),$itemtype_2->itemtype,'952$d is returned unaltered when invalid itemtype'); >+ is($record->subfield( '952', 'c' ),"",'952$c is returned blank when invalid branchcode'); >+ is($record->subfield( '952', 'd' ),"",'952$d is returned blank when invalid itemtype'); > > > }; >-- >2.30.2
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 28371
:
121111
|
124086
|
124087
|
127082
|
127083
|
127090
|
127091
|
132801
|
132802
|
132943
|
132944
|
133719
|
133720
| 133872 |
135373
|
135381