Bugzilla – Attachment 149954 Details for
Bug 24975
Refactor database translations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24975: Some more fixes
Bug-24975-Some-more-fixes.patch (text/plain), 9.47 KB, created by
Jonathan Druart
on 2023-04-20 12:45:05 UTC
(
hide
)
Description:
Bug 24975: Some more fixes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-04-20 12:45:05 UTC
Size:
9.47 KB
patch
obsolete
>From c666d70ad1e151c172833d7641d8f57d8ddd35a1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 20 Apr 2023 14:19:01 +0200 >Subject: [PATCH] Bug 24975: Some more fixes > >--- > Koha/UI/Form/Builder/Item.pm | 5 +++-- > catalogue/detail.pl | 4 +++- > catalogue/search.pl | 8 +++++++- > .../prog/en/modules/catalogue/detail.tt | 2 +- > .../bootstrap/en/modules/opac-reserve.tt | 4 ++-- > opac/opac-reserve.pl | 12 +++++++----- > opac/opac-search.pl | 16 ++++++++++++++-- > 7 files changed, 37 insertions(+), 14 deletions(-) > >diff --git a/Koha/UI/Form/Builder/Item.pm b/Koha/UI/Form/Builder/Item.pm >index 8ff8363c609..28164c843d4 100644 >--- a/Koha/UI/Form/Builder/Item.pm >+++ b/Koha/UI/Form/Builder/Item.pm >@@ -209,8 +209,9 @@ sub generate_subfield_form { > push @authorised_values, ""; > my $itemtypes; > if ($branch_limit) { >- $itemtypes = Koha::ItemTypes->search( >- { branchcode => $branch_limit } ); >+ $itemtypes = >+ Koha::ItemTypes->search_with_library_limits( undef, undef, >+ $branch_limit ); > } > else { > $itemtypes = Koha::ItemTypes->search; >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 48bd7998796..fcc7468cbf4 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -50,6 +50,7 @@ use Koha::Biblio::ItemGroup::Items; > use Koha::Biblio::ItemGroups; > use Koha::CoverImages; > use Koha::DateUtils; >+use Koha::I18N; > use Koha::Illrequests; > use Koha::Items; > use Koha::ItemTypes; >@@ -189,7 +190,8 @@ $template->param( > content_identifier_exists => $content_identifier_exists, > ); > >-my $itemtypes = { map { $_->itemtype => $_ } @{ Koha::ItemTypes->search_with_localization->as_list } }; >+my $itemtypes = { map { $_->itemtype => $_ } @{ Koha::ItemTypes->search->as_list } }; >+ > my $all_items = $biblio->items->search_ordered; > my @items; > my $patron = Koha::Patrons->find( $borrowernumber ); >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 051a9654588..75c0f2bf4bb 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -579,7 +579,13 @@ for (my $i=0;$i<@servers;$i++) { > \@sort_by, $scan, $lang, { weighted_fields => $weight_search, whole_record => $whole_record }); > my $quoted_results_hashref; > eval { >- my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; >+ my $itemtypes = { >+ map { >+ $_->{itemtype} => >+ { %$_, description => db_t( 'itemtype', $_->{itemtype} ), } >+ } @{ Koha::ItemTypes->search->unblessed } >+ }; >+ > ( $error, $quoted_results_hashref, $facets ) = $searcher->search_compat( > $query, $simple_query, \@sort_by, ['biblioserver'], > $results_per_page, $offset, undef, $itemtypes, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index e8c92075631..a513851238a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -405,7 +405,7 @@ > [% IF !noItemTypeImages && itemtype.image_location('intranet') %] > <img src="[% itemtype.image_location('intranet') | html %]" alt="[% ItemTypes.t(itemtype.translation_key) | html %]" title="[% ItemTypes.t(itemtype.translation_key) | html %]" /> > [% END %] >- <span class="itypedesc itypetext">[% ItemTypes.t(item.translation_key) | html %]</span> >+ <span class="itypedesc itypetext">[% ItemTypes.t(itemtype.translation_key) | html %]</span> > </td> > [% END %] > <td class="location">[% UNLESS ( singlebranchmode ) %][% Branches.GetName( item.holdingbranch ) | html %] [% END %]</td> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >index e486da3e249..3d67a2b721b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -232,7 +232,7 @@ > <li class="itype"> > <span class="label">Item type: </span> > [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl | html %]" alt="" />[% END %] >- <span class="itypetext">[% ItemTypes.t(bibitemloo.translation_key) | html %]</span> >+ <span class="itypetext">[% bibitemloo.description | html %]</span> > </li> > [% END %] > >@@ -421,7 +421,7 @@ > <img src="[% itemLoo.imageurl | html %]" alt="" /> > [% END %] > [% END %] >- <span class="itypetext">[% ItemTypes.t(itemLoo.translation_key) | html %]</span> >+ <span class="itypetext">[% itemLoo.description | html %]</span> > </td> > [% END %] > >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 981b81c3ded..f3a487fed91 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -35,6 +35,7 @@ use C4::Overdues; > use Koha::AuthorisedValues; > use Koha::Biblios; > use Koha::CirculationRules; >+use Koha::I18N; > use Koha::Items; > use Koha::ItemTypes; > use Koha::Checkouts; >@@ -72,7 +73,7 @@ unless ( $can_place_hold_if_available_at_pickup ) { > } > } > >-my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } }; >+my $itemtypes = { map { $_->itemtype => $_ } @{ Koha::ItemTypes->search->as_list } }; > > # There are two ways of calling this script, with a single biblio num > # or multiple biblio nums. >@@ -413,8 +414,9 @@ foreach my $biblioNum (@biblionumbers) { > $biblioLoopIter{object} = $biblio; > > if (!$itemLevelTypes && $biblioData->{itemtype}) { >- $biblioLoopIter{description} = $itemtypes->{$biblioData->{itemtype}}{description}; >- $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$biblioData->{itemtype}}{imageurl}; >+ $biblioLoopIter{description} = >+ db_t('itemtype', $itemtypes->{$biblioData->{itemtype}}->translation_key); >+ $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$biblioData->{itemtype}}->imageurl; > } > > >@@ -435,9 +437,9 @@ foreach my $biblioNum (@biblionumbers) { > if ($itemLevelTypes) { > my $itemtype = $item->itemtype; > $item_info->{'imageurl'} = getitemtypeimagelocation( 'opac', >- $itemtypes->{ $itemtype->itemtype }->{'imageurl'} ); >+ $itemtypes->{ $itemtype->itemtype }->imageurl ); > $item_info->{'description'} = >- db_t('itemtype', $itemtypes->{ $itemtype->itemtype }->{description}); >+ db_t('itemtype', $itemtypes->{ $itemtype->itemtype }->translation_key); > } > > # checking for holds >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index b2c7cc6992a..b5c73738bdb 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -577,7 +577,13 @@ if ($tag) { > $pasarParams .= '&count=' . uri_escape_utf8($results_per_page); > $pasarParams .= '&simple_query=' . uri_escape_utf8($simple_query); > $pasarParams .= '&query_type=' . uri_escape_utf8($query_type) if ($query_type); >- my $itemtypes_nocategory = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } }; >+ my $itemtypes_nocategory = { >+ map { >+ $_->{itemtype} => >+ { %$_, description => db_t( 'itemtype', $_->{itemtype} ), } >+ } @{ Koha::ItemTypes->search->unblessed } >+ }; >+ > eval { > ($error, $results_hashref, $facets) = $searcher->search_compat($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes_nocategory,$query_type,$scan,1); > }; >@@ -638,7 +644,13 @@ for (my $i=0;$i<@servers;$i++) { > } > ); > my $quoted_results_hashref; >- my $itemtypes_nocategory = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; >+ my $itemtypes_nocategory = { >+ map { >+ $_->{itemtype} => >+ { %$_, description => db_t( 'itemtype', $_->{itemtype} ), } >+ } @{ Koha::ItemTypes->search->unblessed } >+ }; >+ > eval { > ($error, $quoted_results_hashref, $facets) = $searcher->search_compat($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes_nocategory,$query_type,$scan,1); > }; >-- >2.25.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 24975
:
101703
|
101786
|
102387
|
102388
|
102513
|
102514
|
102688
|
102701
|
132388
|
132508
|
132509
|
132510
|
132511
|
132512
|
132513
|
132514
|
132515
|
132516
|
132517
|
132518
|
132519
|
132520
|
132521
|
132522
|
132523
|
132524
|
132525
|
132526
|
132527
|
132528
|
132529
|
132530
|
132531
|
132532
|
132533
|
132546
|
132562
|
132563
|
132564
|
132565
|
132566
|
132567
|
132568
|
132569
|
132570
|
132571
|
132572
|
132573
|
132574
|
132575
|
149941
|
149942
|
149943
|
149944
|
149945
|
149946
|
149947
|
149948
|
149949
|
149950
|
149951
|
149952
|
149953
|
149954
|
149956
|
149957
|
150015
|
150033
|
150034