Bugzilla – Attachment 56384 Details for
Bug 17249
Koha::AuthorisedValues - Remove GetKohaAuthorisedValuesFromField
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - (follow-up) inventory
PASSED-QA-Bug-17249-Remove-GetKohaAuthorisedValues.patch (text/plain), 2.56 KB, created by
Martin Renvoize (ashimema)
on 2016-10-13 12:48:03 UTC
(
hide
)
Description:
[PASSED QA] Bug 17249: Remove GetKohaAuthorisedValuesFromField - (follow-up) inventory
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2016-10-13 12:48:03 UTC
Size:
2.56 KB
patch
obsolete
>From f8e7061fd47225b396cb95bbd64d9f18f225e516 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 5 Sep 2016 16:12:56 +0100 >Subject: [PATCH] [PASSED QA] Bug 17249: Remove > GetKohaAuthorisedValuesFromField - (follow-up) inventory > >Before this patch set, the tests in >t/db_dependent/Items/GetItemsForInventory.t were executed in 4s. But >with the previous patch, it was in 45sec(!) >To make sure decrease this execution time to what it was before, this >patch introduces a local to avoid the same query to be executed several >times. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Items/GetItemsForInventory.t | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Items/GetItemsForInventory.t b/t/db_dependent/Items/GetItemsForInventory.t >index 32ea963..dfb2175 100755 >--- a/t/db_dependent/Items/GetItemsForInventory.t >+++ b/t/db_dependent/Items/GetItemsForInventory.t >@@ -137,6 +137,7 @@ sub OldWay { > $sth->execute( @bind_params ); > my ($iTotalRecords) = $sth->fetchrow_array(); > >+ my $marc_field_mapping; > foreach my $row (@$tmpresults) { > > # Auth values >@@ -145,9 +146,14 @@ sub OldWay { > my ($f, $sf) = C4::Biblio::GetMarcFromKohaField("items.$field", $row->{'frameworkcode'}); > if (defined($f) and defined($sf)) { > # We replace the code with it's description >- my $av = Koha::AuthorisedValues->search_by_marc_field({ frameworkcode => $row->{frameworkcode}, tagfield => $f, tagsubfield => $sf, }); >- $av = $av->count ? $av->unblessed : []; >- my $authvals = { map { ( $_->{authorised_value} => $_->{lib} ) } @$av }; >+ my $avs; >+ if ( exists $marc_field_mapping->{$row->{frameworkcode}}{$f}{$sf} ) { >+ $avs = $marc_field_mapping->{$row->{frameworkcode}}{$f}{$sf}; >+ } else { >+ $avs = Koha::AuthorisedValues->search_by_marc_field({ frameworkcode => $row->{frameworkcode}, tagfield => $f, tagsubfield => $sf, }); >+ $marc_field_mapping->{$row->{frameworkcode}}{$f}{$sf} = $avs->unblessed; >+ } >+ my $authvals = { map { $_->{authorised_value} => $_->{lib} } @{ $marc_field_mapping->{$row->{frameworkcode}}{$f}{$sf} } }; > $row->{$field} = $authvals->{$row->{$field}} if defined $authvals && defined $row->{$field} && defined $authvals->{$row->{$field}}; > } > } >-- >2.1.4
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 17249
:
55176
|
55177
|
55178
|
55179
|
55180
|
55181
|
55182
|
55428
|
55429
|
55430
|
55431
|
55432
|
55433
|
55434
|
56380
|
56381
|
56382
|
56383
| 56384 |
56385
|
56386