Bugzilla – Attachment 62157 Details for
Bug 17835
Move C4::Koha::GetItemTypes to Koha::ItemTypes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17835: Do not reselect translated_description if comes from search_with_localization
Bug-17835-Do-not-reselect-translateddescription-if.patch (text/plain), 1.67 KB, created by
Marcel de Rooy
on 2017-04-14 08:49:18 UTC
(
hide
)
Description:
Bug 17835: Do not reselect translated_description if comes from search_with_localization
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-04-14 08:49:18 UTC
Size:
1.67 KB
patch
obsolete
>From 113669ce3a435d9a79a4b8dafd9d7009a9000505 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 3 Jan 2017 09:22:48 +0100 >Subject: [PATCH] Bug 17835: Do not reselect translated_description if comes > from search_with_localization >Content-Type: text/plain; charset=utf-8 > >If the Koha::ItemType object has been instanciated from a call to >Koha::ItemTypes->search_with_localization, we already have the >translated_description value. So there is no need to fetch it again from >the DB. This is what this trick does: if the translated_description >column exist in the DBIx::Class result source's column list, that means >the value has already been retrieved. > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Lari Taskula <lari.taskula@jns.fi> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/ItemType.pm | 8 ++++++++ > 1 file changed, 8 insertions(+) > >diff --git a/Koha/ItemType.pm b/Koha/ItemType.pm >index 48df808..8f2279b 100644 >--- a/Koha/ItemType.pm >+++ b/Koha/ItemType.pm >@@ -51,6 +51,14 @@ sub image_location { > > sub translated_description { > my ( $self, $lang ) = @_; >+ if ( my $translated_description = eval { $self->get_column('translated_description') } ) { >+ # If the value has already been fetched (eg. from sarch_with_localization), >+ # do not search for it again >+ # Note: This is a bit hacky but should be fast >+ return $translated_description >+ ? $translated_description >+ : $self->description; >+ } > $lang ||= C4::Languages::getlanguage; > my $translated_description = Koha::Localizations->search({ > code => $self->itemtype, >-- >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 17835
:
58561
|
58562
|
58563
|
58564
|
58565
|
58600
|
60033
|
60046
|
60048
|
60049
|
60050
|
60051
|
60052
|
60053
|
60914
|
60915
|
60916
|
60917
|
61695
|
61696
|
61697
|
61698
|
61699
|
61700
|
61966
|
61967
|
61968
|
61969
|
61970
|
61971
|
62156
| 62157 |
62158
|
62159
|
62160
|
62161
|
62162
|
62370
|
62470