Bugzilla – Attachment 43606 Details for
Bug 14100
Add base to make item types, branch names, sysprefs values and authorised values translatable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14100: Fix some missing occurrences
PASSED-QA-Bug-14100-Fix-some-missing-occurrences.patch (text/plain), 9.34 KB, created by
Katrin Fischer
on 2015-10-19 17:01:26 UTC
(
hide
)
Description:
[PASSED QA] Bug 14100: Fix some missing occurrences
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-10-19 17:01:26 UTC
Size:
9.34 KB
patch
obsolete
>From 4c9e6106a3bdbcd12dc9f0bc0aeea5e475994cd9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 14 Oct 2015 09:38:05 +0100 >Subject: [PATCH] [PASSED QA] Bug 14100: Fix some missing occurrences > >This patch fixes: >- reports/bor_issues_top.pl >- sort order >- adv search and search results >- opac-topissues.pl > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Search.pm | 6 +++--- > catalogue/search.pl | 2 +- > opac/opac-search.pl | 4 ++-- > opac/opac-topissues.pl | 33 ++++++++++++++++++++++----------- > reports/bor_issues_top.pl | 2 +- > 5 files changed, 29 insertions(+), 18 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 04e77f8..48f6b3a 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -571,7 +571,7 @@ sub getRecords { > { > $facet_label_value = > $itemtypes->{$one_facet} >- ->{'description'}; >+ ->{translated_description}; > } > } > >@@ -1950,7 +1950,7 @@ sub searchResults { > > # edition information, if any > $oldbiblio->{edition} = $oldbiblio->{editionstatement}; >- $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{description}; >+ $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{translated_description}; > # Build summary if there is one (the summary is defined in the itemtypes table) > # FIXME: is this used anywhere, I think it can be commented out? -- JF > if ( $itemtypes{ $oldbiblio->{itemtype} }->{summary} ) { >@@ -2062,7 +2062,7 @@ sub searchResults { > foreach my $code ( keys %subfieldstosearch ) { > $item->{$code} = $field->subfield( $subfieldstosearch{$code} ); > } >- $item->{description} = $itemtypes{ $item->{itype} }{description}; >+ $item->{description} = $itemtypes{ $item->{itype} }{translated_description}; > > # OPAC hidden items > if ($is_opac) { >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 0bd2cc6..c3ec804 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -262,7 +262,7 @@ foreach my $advanced_srch_type (@advanced_search_types) { > if ($advanced_srch_type eq 'itemtypes') { > # itemtype is a special case, since it's not defined in authorized values > my @itypesloop; >- foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { >+ foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes ) { > my %row =( number=>$cnt++, > ccl => "$itype_or_itemtype,phr", > code => $thisitemtype, >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 81f2bbb..0582d46 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -236,13 +236,13 @@ foreach my $advanced_srch_type (@advanced_search_types) { > if ($advanced_srch_type eq 'itemtypes') { > # itemtype is a special case, since it's not defined in authorized values > my @itypesloop; >- foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { >+ foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes ) { > next if $hidingrules->{itype} && any { $_ eq $thisitemtype } @{$hidingrules->{itype}}; > next if $hidingrules->{itemtype} && any { $_ eq $thisitemtype } @{$hidingrules->{itemtype}}; > my %row =( number=>$cnt++, > ccl => "$itype_or_itemtype,phr", > code => $thisitemtype, >- description => $itemtypes->{$thisitemtype}->{'description'}, >+ description => $itemtypes->{$thisitemtype}->{translated_description}, > imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ), > ); > push @itypesloop, \%row; >diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl >index c88cb17..c5c8bcf 100755 >--- a/opac/opac-topissues.pl >+++ b/opac/opac-topissues.pl >@@ -25,6 +25,7 @@ use warnings; > use CGI qw ( -utf8 ); > use C4::Auth; > use C4::Context; >+use C4::Languages; > use C4::Search; > use C4::Output; > use C4::Koha; >@@ -77,11 +78,10 @@ my $whereclause = ''; > $whereclause .= ' AND items.homebranch='.$dbh->quote($branch) if ($branch); > $whereclause .= ' AND TO_DAYS(NOW()) - TO_DAYS(biblio.datecreated) <= '.($timeLimit*30) if $timeLimit < 999; > $whereclause =~ s/ AND $// if $whereclause; >-my $query; >- >+my $sth; > if($advanced_search_types eq 'ccode'){ > $whereclause .= ' AND authorised_values.authorised_value='.$dbh->quote($itemtype) if $itemtype; >- $query = "SELECT datecreated, biblio.biblionumber, title, >+ my $query = "SELECT datecreated, biblio.biblionumber, title, > author, sum( items.issues ) AS tot, biblioitems.itemtype, > biblioitems.publishercode, biblioitems.place, biblioitems.publicationyear, biblio.copyrightdate, > authorised_values.lib as description, biblioitems.pages, biblioitems.size >@@ -98,6 +98,8 @@ if($advanced_search_types eq 'ccode'){ > LIMIT ? > "; > $template->param(ccodesearch => 1); >+ $sth = $dbh->prepare($query); >+ $sth->execute($limit); > }else{ > if ($itemtype){ > if (C4::Context->preference('item-level_itypes')){ >@@ -107,14 +109,18 @@ if($advanced_search_types eq 'ccode'){ > $whereclause .= ' AND biblioitems.itemtype='.$dbh->quote($itemtype); > } > } >- $query = "SELECT datecreated, biblio.biblionumber, title, >+ my $query = "SELECT datecreated, biblio.biblionumber, title, > author, sum( items.issues ) AS tot, biblioitems.itemtype, > biblioitems.publishercode, biblioitems.place, biblioitems.publicationyear, biblio.copyrightdate, >- itemtypes.description, biblioitems.pages, biblioitems.size >+ itemtypes.description, biblioitems.pages, biblioitems.size, >+ COALESCE( localization.translation, itemtypes.description ) AS translated_description > FROM biblio > LEFT JOIN items USING (biblionumber) > LEFT JOIN biblioitems USING (biblionumber) > LEFT JOIN itemtypes ON itemtypes.itemtype = biblioitems.itemtype >+ LEFT JOIN localization ON itemtypes.itemtype = localization.code >+ AND localization.entity = 'itemtypes' >+ AND localization.lang = ? > WHERE 1 > $whereclause > GROUP BY biblio.biblionumber >@@ -122,13 +128,18 @@ if($advanced_search_types eq 'ccode'){ > ORDER BY tot DESC > LIMIT ? > "; >- $template->param(itemtypesearch => 1); >+ $template->param(itemtypesearch => 1); >+ $sth = $dbh->prepare($query); >+ my $language = C4::Languages::getlanguage(); >+ $sth->execute($language, $limit); > } > >-my $sth = $dbh->prepare($query); >-$sth->execute($limit); > my @results; > while (my $line= $sth->fetchrow_hashref) { >+ if ( $advanced_search_types ne 'ccode' ) { >+ $line->{description} = $line->{translated_description}; >+ } >+ > push @results, $line; > } > >@@ -138,7 +149,7 @@ if($timeLimit eq 999){ $timeLimitFinite = 0 }; > $template->param(do_it => 1, > limit => $limit, > branch => $branches->{$branch}->{branchname}, >- itemtype => $itemtypes->{$itemtype}->{description}, >+ itemtype => $itemtypes->{$itemtype}->{translated_description}, > timeLimit => $timeLimit, > timeLimitFinite => $timeLimitFinite, > results_loop => \@results, >@@ -151,9 +162,9 @@ my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':' > $itemtypes = GetItemTypes; > my @itemtypesloop; > if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { >- foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { >+ foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes ) { > my %row =( value => $thisitemtype, >- description => $itemtypes->{$thisitemtype}->{'description'}, >+ description => $itemtypes->{$thisitemtype}->{translated_description}, > selected => $thisitemtype eq $itemtype, > ); > push @itemtypesloop, \%row; >diff --git a/reports/bor_issues_top.pl b/reports/bor_issues_top.pl >index eb5482d..485095e 100755 >--- a/reports/bor_issues_top.pl >+++ b/reports/bor_issues_top.pl >@@ -125,7 +125,7 @@ my $itemtypes = GetItemTypes; > my @itemtypeloop; > foreach (sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes) { > my %row = (value => $_, >- description => $itemtypes->{$_}->{translated_description}, >+ translated_description => $itemtypes->{$_}->{translated_description}, > ); > push @itemtypeloop, \%row; > } >-- >1.9.1
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 14100
:
38727
|
40917
|
40965
|
41654
|
41659
|
41660
|
42525
|
42526
|
43110
|
43111
|
43365
|
43366
|
43367
|
43368
|
43369
|
43370
|
43394
|
43395
|
43396
|
43577
|
43602
|
43603
|
43604
|
43605
|
43606
|
43613
|
44085
|
44086
|
44087
|
44088
|
44089
|
44090
|
44094
|
44108
|
44109
|
44119
|
44151