Bugzilla – Attachment 42526 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]
Bug 14100: (follow-up) Language overlay for item types
Bug-14100-follow-up-Language-overlay-for-item-type.patch (text/plain), 32.08 KB, created by
Jonathan Druart
on 2015-09-14 14:27:57 UTC
(
hide
)
Description:
Bug 14100: (follow-up) Language overlay for item types
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-09-14 14:27:57 UTC
Size:
32.08 KB
patch
obsolete
>From 0559d5c8263a541021f780d288a3600d0cd51f97 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 19 Aug 2015 10:22:24 +0100 >Subject: [PATCH] Bug 14100: (follow-up) Language overlay for item types > >Display the translated description for item types in the following pages: >> admin/smart-rules.pl >> catalogue/detail.pl >> catalogue/itemsearch.pl >> catalogue/moredetail.pl >> reports/acquisitions_stats.pl >> reports/bor_issues_top.pl >> reports/cat_issues_top.pl >> reports/catalogue_out.pl >> reports/catalogue_stats.pl >> reports/issues_avg_stats.pl >> reports/issues_stats.pl >> reports/itemslost.pl >> reports/manager.pl >> reports/reserves_stats.pl >> suggestion/suggestion.pl >> tools/export.pl > >> Opac: >> opac-detail.pl >> opac-MARCdetail.pl >> opac-search.pl > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Biblio.pm | 2 +- > C4/ItemType.pm | 13 +++++++++++-- > C4/Items.pm | 10 +++++++++- > C4/Koha.pm | 9 +-------- > Koha/Template/Plugin/ItemTypes.pm | 2 +- > admin/smart-rules.pl | 19 ++++++++++--------- > catalogue/itemsearch.pl | 2 +- > catalogue/moredetail.pl | 4 ++-- > .../prog/en/modules/admin/smart-rules.tt | 8 ++++---- > .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 6 +++--- > .../prog/en/modules/reports/acquisitions_stats.tt | 4 ++-- > .../prog/en/modules/reports/bor_issues_top.tt | 2 +- > .../prog/en/modules/reports/catalogue_stats.tt | 8 +++----- > .../prog/en/modules/reports/issues_avg_stats.tt | 4 ++-- > .../prog/en/modules/reports/itemtypes.tt | 3 ++- > .../prog/en/modules/suggestion/suggestion.tt | 4 ++-- > opac/opac-detail.pl | 4 ++-- > reports/acquisitions_stats.pl | 15 ++------------- > reports/bor_issues_top.pl | 4 ++-- > reports/cat_issues_top.pl | 4 ++-- > reports/catalogue_out.pl | 4 ++-- > reports/catalogue_stats.pl | 6 ++---- > reports/issues_avg_stats.pl | 19 ++++--------------- > reports/issues_stats.pl | 4 ++-- > reports/itemslost.pl | 4 ++-- > reports/itemtypes.plugin | 14 +++++++------- > reports/reserves_stats.pl | 4 ++-- > tools/export.pl | 2 +- > 28 files changed, 85 insertions(+), 99 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 0911e0f..e3efde9 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1637,7 +1637,7 @@ sub GetAuthorisedValueDesc { > > #---- itemtypes > if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) { >- return getitemtypeinfo($value)->{description}; >+ return getitemtypeinfo($value)->{translated_description}; > } > > #---- "true" authorized value >diff --git a/C4/ItemType.pm b/C4/ItemType.pm >index 16b3f8c..27b5aea 100644 >--- a/C4/ItemType.pm >+++ b/C4/ItemType.pm >@@ -21,6 +21,7 @@ package C4::ItemType; > use strict; > use warnings; > use C4::Context; >+use C4::Languages; > use Encode qw( encode ); > > our $AUTOLOAD; >@@ -78,9 +79,17 @@ sub all { > my ($class) = @_; > my $dbh = C4::Context->dbh; > >+ my $language = C4::Languages::getlanguage(); > my @itypes; >- for ( @{$dbh->selectall_arrayref( >- "SELECT * FROM itemtypes ORDER BY description", { Slice => {} })} ) >+ for ( @{$dbh->selectall_arrayref(q| >+ SELECT *, >+ COALESCE( localization.translation, itemtypes.description ) AS translated_description >+ FROM itemtypes >+ LEFT JOIN localization ON itemtypes.itemtype = localization.code >+ AND localization.entity = 'itemtypes' >+ AND localization.lang = ? >+ ORDER BY description >+ |, { Slice => {} }, $language)} ) > { > push @itypes, $class->new($_); > } >diff --git a/C4/Items.pm b/C4/Items.pm >index 087b20d..3d60ecd 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1301,6 +1301,7 @@ sub GetItemsInfo { > my ( $biblionumber ) = @_; > my $dbh = C4::Context->dbh; > # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance. >+ my $language = C4::Languages::getlanguage(); > my $query = " > SELECT items.*, > biblio.*, >@@ -1326,6 +1327,7 @@ sub GetItemsInfo { > serial.serialseq, > serial.publisheddate, > itemtypes.description, >+ COALESCE( localization.translation, itemtypes.description ) AS translated_description, > itemtypes.notforloan as notforloan_per_itemtype, > holding.branchurl, > holding.branchname, >@@ -1344,9 +1346,15 @@ sub GetItemsInfo { > LEFT JOIN serial USING (serialid) > LEFT JOIN itemtypes ON itemtypes.itemtype = " > . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); >+ $query .= q| >+ LEFT JOIN localization ON itemtypes.itemtype = localization.code >+ AND localization.entity = 'itemtypes' >+ AND localization.lang = ? >+ |; >+ > $query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; > my $sth = $dbh->prepare($query); >- $sth->execute($biblionumber); >+ $sth->execute($language, $biblionumber); > my $i = 0; > my @results; > my $serial; >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 8a573c0..186e0a7 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -194,14 +194,7 @@ build a HTML select with the following code : > sub GetSupportList{ > my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); > if (!$advanced_search_types or $advanced_search_types =~ /itemtypes/) { >- my $query = qq| >- SELECT * >- FROM itemtypes >- order by description >- |; >- my $sth = C4::Context->dbh->prepare($query); >- $sth->execute; >- return $sth->fetchall_arrayref({}); >+ return GetItemTypes( style => 'array' ); > } else { > my $advsearchtypes = GetAuthorisedValues($advanced_search_types); > my @results= map {{itemtype=>$$_{authorised_value},description=>$$_{lib},imageurl=>$$_{imageurl}}} @$advsearchtypes; >diff --git a/Koha/Template/Plugin/ItemTypes.pm b/Koha/Template/Plugin/ItemTypes.pm >index 0f16601..b7dee06 100644 >--- a/Koha/Template/Plugin/ItemTypes.pm >+++ b/Koha/Template/Plugin/ItemTypes.pm >@@ -27,7 +27,7 @@ use C4::Koha; > sub GetDescription { > my ( $self, $itemtype ) = @_; > >- my $itemtype = C4::Koha::getitemtypeinfo( $itemtype ); >+ $itemtype = C4::Koha::getitemtypeinfo( $itemtype ); > return $itemtype->{translated_description}; > > } >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 9ef6ef6..c312a36 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -46,6 +46,7 @@ my ($template, $loggedinuser, $cookie) > my $type=$input->param('type'); > my $branch = $input->param('branch') || ( C4::Branch::onlymine() ? ( C4::Branch::mybranch() || '*' ) : '*' ); > my $op = $input->param('op') || q{}; >+my $language = C4::Languages::getlanguage(); > > if ($op eq 'delete') { > my $itemtype = $input->param('itemtype'); >@@ -386,25 +387,25 @@ while (my $data=$sth->fetchrow_hashref){ > } > > $sth->finish; >-$sth=$dbh->prepare("SELECT description,itemtype FROM itemtypes ORDER BY description"); >-$sth->execute; >-# $i=0; > my @row_loop; >-my @itemtypes; >-while (my $row=$sth->fetchrow_hashref){ >- push @itemtypes,$row; >-} >+my @itemtypes = @{ GetItemTypes( style => 'array' ) }; > > my $sth2 = $dbh->prepare(" >- SELECT issuingrules.*, itemtypes.description AS humanitemtype, categories.description AS humancategorycode >+ SELECT issuingrules.*, >+ itemtypes.description AS humanitemtype, >+ categories.description AS humancategorycode, >+ COALESCE( localization.translation, itemtypes.description ) AS translated_description > FROM issuingrules > LEFT JOIN itemtypes > ON (itemtypes.itemtype = issuingrules.itemtype) > LEFT JOIN categories > ON (categories.categorycode = issuingrules.categorycode) >+ LEFT JOIN localization ON issuingrules.itemtype = localization.code >+ AND localization.entity = 'itemtypes' >+ AND localization.lang = ? > WHERE issuingrules.branchcode = ? > "); >-$sth2->execute($branch); >+$sth2->execute($language, $branch); > > while (my $row = $sth2->fetchrow_hashref) { > $row->{'current_branch'} ||= $row->{'branchcode'}; >diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl >index ed1a932..1735548 100755 >--- a/catalogue/itemsearch.pl >+++ b/catalogue/itemsearch.pl >@@ -258,7 +258,7 @@ if ($format eq 'html') { > my @itemtypes = C4::ItemType->all(); > foreach my $itemtype (@itemtypes) { > $itemtype->{value} = $itemtype->{itemtype}; >- $itemtype->{label} = $itemtype->{description}; >+ $itemtype->{label} = $itemtype->{translated_description}; > } > my $ccode_avcode = GetAuthValCode('items.ccode') || 'CCODE'; > my $ccodes = GetAuthorisedValues($ccode_avcode); >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index 3736c13..70378d0 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -127,7 +127,7 @@ my $ccodes= GetKohaAuthorisedValues('items.ccode',$fw); > my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$fw); > my $itemtypes = GetItemTypes; > >-$data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'description'}; >+$data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'translated_description'}; > $data->{'rentalcharge'} = sprintf( "%.2f", $data->{'rentalcharge'} ); > foreach ( keys %{$data} ) { > $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' ); >@@ -138,7 +138,7 @@ foreach my $item (@items){ > $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw),$item->{itemlost}) if GetAuthValCode('items.itemlost',$fw); > $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw),$item->{damaged}) if GetAuthValCode('items.damaged',$fw); > $item->{'collection'} = $ccodes->{ $item->{ccode} } if ($ccodes); >- $item->{'itype'} = $itemtypes->{ $item->{'itype'} }->{'description'}; >+ $item->{'itype'} = $itemtypes->{ $item->{'itype'} }->{'translated_description'}; > $item->{'replacementprice'} = sprintf( "%.2f", $item->{'replacementprice'} ); > if ( defined $item->{'copynumber'} ) { > $item->{'displaycopy'} = 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 84ffcd8..2a28575 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -174,7 +174,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <td>[% IF ( rule.default_humanitemtype ) %] > <em>All</em> > [% ELSE %] >- [% rule.humanitemtype %] >+ [% rule.translated_description %] > [% END %] > </td> > <td>[% IF ( rule.unlimited_maxissueqty ) %] >@@ -242,7 +242,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <select name="itemtype" id="matrixitemtype" style="width:13em;"> > <option value="*">All</option> > [% FOREACH itemtypeloo IN itemtypeloop %] >- <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option> >+ <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option> > [% END %] > </select> > </td> >@@ -501,7 +501,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <td>[% IF ( branch_item_rule_loo.default_humanitemtype ) %] > <em>Default</em> > [% ELSE %] >- [% branch_item_rule_loo.humanitemtype %] >+ [% branch_item_rule_loo.translated_description %] > [% END %] > </td> > <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %] >@@ -531,7 +531,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <td> > <select name="itemtype"> > [% FOREACH itemtypeloo IN itemtypeloop %] >- <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option> >+ <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option> > [% END %] > </select> > </td> >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 73a97a9..d327ed4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -402,7 +402,7 @@ function verify_images() { > [% FOREACH subtitl IN subtitle %] > <h4>[% subtitl.subfield %]</h4> > [% END %] >- [% UNLESS ( item_level_itypes ) %]<img src="[% imageurl %]" alt="[% description %]" title="[% description %]">[% END %] >+ [% UNLESS ( item_level_itypes ) %]<img src="[% imageurl %]" alt="[% translated_description %]" title="[% translated_description %]">[% END %] > [% IF ( unititle ) %]<p>[% unititle |html %]</p>[% END %] > [% IF ( author ) %]<p>By <a href="/cgi-bin/koha/catalogue/search.pl?q=au:[% author |url %]">[% author %]</a></p>[% END %] > <ul> >@@ -619,9 +619,9 @@ function verify_images() { > [% IF ( item_level_itypes ) %] > <td class="itype"> > [% IF !noItemTypeImages && item.imageurl %] >- <img src="[% item.imageurl %]" alt="[% item.description %]" title="[% item.description %]" /> >+ <img src="[% item.imageurl %]" alt="[% item.translated_description %]" title="[% item.translated_description %]" /> > [% END %] >- [% item.description %] >+ [% item.translated_description %] > </td> > [% END %] > <td class="location">[% UNLESS ( singlebranchmode ) %][% item.branchname %] [% END %]</td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt >index 2d80961..a03b058 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt >@@ -223,8 +223,8 @@ > <td> > <select name="Filter" size="1" id="itemtypes"> > <option value="">All item types</option> >- [% FOREACH value IN ItemTypes.values %] >- <option value="[% value %]">[% ItemTypes.labels.$value %]</option> >+ [% FOREACH itemtype IN itemtypes %] >+ <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option> > [% END %] > </select> > </td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt >index 6fc0d54..e6663ed 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt >@@ -148,7 +148,7 @@ function Dopop(link) { > <li> > <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option> > [% FOREACH itemtypeloo IN itemtypeloop %] >- <option value="[% itemtypeloo.value %]" >[% itemtypeloo.description %] </option> >+ <option value="[% itemtypeloo.value %]" >[% itemtypeloo.translated_description %] </option> > [% END %] > </select> > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt >index 9290ea7..567892b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt >@@ -164,11 +164,9 @@ > <td><input type="radio" name="Column" value="[% item_itype %]" /></td> > <td><select name="Filter" id="[% item_itype %]"> > <option value=""> </option> >- [% FOREACH CGIItemTyp IN CGIItemType %] >- [% IF ( CGIItemTyp.selected ) %] >- <option value="[% CGIItemTyp.itemtype %]" selected="selected">[% CGIItemTyp.description %]</option>[% ELSE %]<option value="[% CGIItemTyp.itemtype %]">[% CGIItemTyp.description %]</option>[% END %] >- >- [% END %] >+ [% FOREACH itemtype IN itemtypes %] >+ <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option> >+ [% END %] > </select> > </td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt >index 67d0a13..e6cb22f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt >@@ -168,8 +168,8 @@ > <td> > <select name="Filter" size="1" id="itemtypes"> > <option value=""></option> >- [% FOREACH value IN ItemType.values %] >- <option value="[%- value -%]">[%- ItemType.labels.$value -%]</option> >+ [% FOREACH itemtype IN itemtypes %] >+ <option value="[%- itemtype.itemtype -%]">[%- itemtype.translated_description -%]</option> > [% END %] > </select> > </td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt >index 689f262..014d5aa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt >@@ -1,3 +1,4 @@ >+[% USE ItemTypes %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Reports › Catalog by item types</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -47,7 +48,7 @@ $(document).ready(function(){ > <tbody> > [% FOREACH loopitemtyp IN mainloo.loopitemtype %] > <tr> >- <td>[% loopitemtyp.itemtype %]</td> >+ <td>[% ItemTypes.GetDescription( loopitemtyp.itemtype ) %]</td> > <td>[% loopitemtyp.count %]</td> > </tr> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index b3fedc4..31842ac 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -214,7 +214,7 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o > <li><span class="label">Collection title:</span>[% collectiontitle |html %]</li> > <li><span class="label">Document type:</span> > [% FOREACH itemtypeloo IN itemtypeloop %] >- [% IF ( itemtypeloo.selected ) %][% itemtypeloo.description %][% END %] >+ [% IF ( itemtypeloo.selected ) %][% itemtypeloo.translated_description %][% END %] > [% END %] > </li> > [% IF ( patron_reason_loop ) %] >@@ -339,7 +339,7 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o > <select id="itemtype" name="itemtype" > > [% FOREACH itemtypeloo IN itemtypeloop %] > [% IF ( itemtypeloo.selected ) %]<option selected="selected" value="[% itemtypeloo.itemtype %]">[% ELSE %]<option value="[% itemtypeloo.itemtype %]">[% END %] >- [% itemtypeloo.description %]</option> >+ [% itemtypeloo.translated_description %]</option> > [% END %] > </select> > </li> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 0fa588f..35ca0ca 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -521,7 +521,7 @@ my $itemtypes = GetItemTypes(); > my $itemtype = $dat->{'itemtype'}; > if ( $itemtype ) { > $dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} ); >- $dat->{'description'} = $itemtypes->{$itemtype}->{'description'}; >+ $dat->{'description'} = $itemtypes->{$itemtype}->{translated_description}; > } > my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac'); > my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac'); >@@ -647,7 +647,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) { > } > if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) { > $itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} ); >- $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'}; >+ $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{translated_description}; > } > foreach (qw(ccode enumchron copynumber itemnotes uri)) { > $itemfields{$_} = 1 if ($itm->{$_}); >diff --git a/reports/acquisitions_stats.pl b/reports/acquisitions_stats.pl >index 0f45989..3c86bf1 100755 >--- a/reports/acquisitions_stats.pl >+++ b/reports/acquisitions_stats.pl >@@ -120,18 +120,7 @@ else { > $req->execute; > my $booksellers = $req->fetchall_arrayref({}); > >- $req = $dbh->prepare("SELECT DISTINCTROW itemtype,description FROM itemtypes ORDER BY description"); >- $req->execute; >- my @iselect; >- my %iselect; >- while ( my ( $value, $desc ) = $req->fetchrow ) { >- push @iselect, $value; >- $iselect{$value} = $desc; >- } >- my $ItemTypes = { >- values => \@iselect, >- labels => \%iselect, >- }; >+ my $itemtypes = GetItemTypes( style => 'array' ); > > $req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets ORDER BY budget_name"); > $req->execute; >@@ -208,7 +197,7 @@ else { > > $template->param( > booksellers => $booksellers, >- ItemTypes => $ItemTypes, >+ itemtypes => $itemtypes, > Budgets => $Budgets, > hassort1 => $hassort1, > hassort2 => $hassort2, >diff --git a/reports/bor_issues_top.pl b/reports/bor_issues_top.pl >index b158b7b..eb5482d 100755 >--- a/reports/bor_issues_top.pl >+++ b/reports/bor_issues_top.pl >@@ -123,9 +123,9 @@ foreach (sort keys %$branches) { > > my $itemtypes = GetItemTypes; > my @itemtypeloop; >-foreach (sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys %$itemtypes) { >+foreach (sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes) { > my %row = (value => $_, >- description => $itemtypes->{$_}->{description}, >+ description => $itemtypes->{$_}->{translated_description}, > ); > push @itemtypeloop, \%row; > } >diff --git a/reports/cat_issues_top.pl b/reports/cat_issues_top.pl >index e5a4414..f88ff47 100755 >--- a/reports/cat_issues_top.pl >+++ b/reports/cat_issues_top.pl >@@ -123,9 +123,9 @@ if ($do_it) { > #doctype > my $itemtypes = GetItemTypes; > my @itemtypeloop; >- 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}, > ); > push @itemtypeloop, \%row; > } >diff --git a/reports/catalogue_out.pl b/reports/catalogue_out.pl >index a4e40a9..efcfa7d 100755 >--- a/reports/catalogue_out.pl >+++ b/reports/catalogue_out.pl >@@ -65,14 +65,14 @@ if ($do_it) { > my $itemtypes = GetItemTypes(); > my @itemtypeloop; > foreach ( >- sort { $itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } >+ sort { $itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } > keys %$itemtypes > ) > { > push @itemtypeloop, > { > value => $_, >- description => $itemtypes->{$_}->{'description'}, >+ description => $itemtypes->{$_}->{translated_description}, > }; > } > >diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl >index 5e7848d..c0b11da 100755 >--- a/reports/catalogue_stats.pl >+++ b/reports/catalogue_stats.pl >@@ -146,9 +146,7 @@ if ($do_it) { > my $hascote = 1; > my $highcote = 5; > >- $req = $dbh->prepare("select itemtype, description from itemtypes order by description"); >- $req->execute; >- my $CGIitemtype = $req->fetchall_arrayref({}); >+ my $itemtypes = GetItemTypes( style => 'array' ); > > my $authvals = GetKohaAuthorisedValues("items.ccode"); > my @authvals; >@@ -167,7 +165,7 @@ if ($do_it) { > $template->param(hasdewey=>$hasdewey, > haslccn => $haslccn, > hascote => $hascote, >- CGIItemType => $CGIitemtype, >+ itemtypes => $itemtypes, > CGIBranch => GetBranchesLoop(C4::Context->userenv->{'branch'}), > locationloop => \@locations, > authvals => \@authvals, >diff --git a/reports/issues_avg_stats.pl b/reports/issues_avg_stats.pl >index 772acd6..9b8cc64 100755 >--- a/reports/issues_avg_stats.pl >+++ b/reports/issues_avg_stats.pl >@@ -128,20 +128,9 @@ if ($do_it) { > values => \@selectc, > labels => \%labelsc, > }; >- >- $req = $dbh->prepare( "select distinctrow itemtype,description from itemtypes order by description"); >- $req->execute; >- my @selecti; >- my %labelsi; >- while (my ($value,$desc) =$req->fetchrow) { >- push @selecti, $value; >- $labelsi{$value}=$desc; >- } >- my $ItemTypes = { >- values => \@selecti, >- labels => \%labelsi, >- }; >- >+ >+ my $itemtypes = GetItemTypes( style => 'array' ); >+ > $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1"); > $req->execute; > my @selects1; >@@ -172,7 +161,7 @@ if ($do_it) { > > $template->param( > BorCat => $BorCat, >- ItemType => $ItemTypes, >+ itemtypes => $itemtypes, > branchloop => GetBranchesLoop(), > hassort1 => $hassort1, > hassort2 => $hassort2, >diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl >index 938a835..e567e70 100755 >--- a/reports/issues_stats.pl >+++ b/reports/issues_stats.pl >@@ -131,8 +131,8 @@ my %select; > > # create itemtype arrayref for <select>. > my @itemtypeloop; >-for my $itype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys(%$itemtypes)) { >- push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{description} } ; >+for my $itype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys(%$itemtypes)) { >+ push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{translated_description} } ; > } > > # location list >diff --git a/reports/itemslost.pl b/reports/itemslost.pl >index b84dbc5..e208351 100755 >--- a/reports/itemslost.pl >+++ b/reports/itemslost.pl >@@ -85,10 +85,10 @@ if ( $get_items ) { > # getting all itemtypes > my $itemtypes = &GetItemTypes(); > my @itemtypesloop; >-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'}, > ); > push @itemtypesloop, \%row; > } >diff --git a/reports/itemtypes.plugin b/reports/itemtypes.plugin >index 3f6c677..2da9a88 100755 >--- a/reports/itemtypes.plugin >+++ b/reports/itemtypes.plugin >@@ -49,7 +49,7 @@ sub calculate { > if ($branch) { > if (C4::Context->preference('item-level_itypes')) { > $sth = $dbh->prepare(" >- SELECT description, items.itype as itemtype, COUNT(*) AS total >+ SELECT itemtype, description, items.itype as itemtype, COUNT(*) AS total > FROM itemtypes,items > WHERE items.itype=itemtypes.itemtype > AND items.holdingbranch=? >@@ -59,7 +59,7 @@ sub calculate { > } > else { > $sth = $dbh->prepare(" >- SELECT description, biblioitems.itemtype, COUNT(*) AS total >+ SELECT itemtype, description, biblioitems.itemtype, COUNT(*) AS total > FROM itemtypes, biblioitems, items > WHERE biblioitems.itemtype=itemtypes.itemtype > AND items.biblioitemnumber=biblioitems.biblioitemnumber >@@ -71,14 +71,14 @@ sub calculate { > } else { > if (C4::Context->preference('item-level_itypes')) { > $sth = $dbh->prepare(" >- SELECT description,items.itype AS itemtype, COUNT(*) AS total >+ SELECT itemtype, description,items.itype AS itemtype, COUNT(*) AS total > FROM itemtypes,items > WHERE items.itype=itemtypes.itemtype > GROUP BY items.itype > ORDER BY itemtypes.description"); > } > else { >- $sth = $dbh->prepare("SELECT description, biblioitems.itemtype, COUNT(*) AS total >+ $sth = $dbh->prepare("SELECT itemtype, description, biblioitems.itemtype, COUNT(*) AS total > FROM itemtypes, biblioitems,items > WHERE biblioitems.itemtype=itemtypes.itemtype > AND biblioitems.biblioitemnumber = items.biblioitemnumber >@@ -87,17 +87,17 @@ sub calculate { > } > $sth->execute; > } >- my ($description,$biblioitems,$total); >+ my ($itemtype, $description,$biblioitems,$total); > my $grantotal = 0; > my $count = 0; >- while (($description,$biblioitems,$total) = $sth->fetchrow) { >+ while (($itemtype, $description,$biblioitems,$total) = $sth->fetchrow) { > my %line; > if($count % 2){ > $line{toggle} = 1; > } else { > $line{toggle} = 0; > } >- $line{itemtype} = $description; >+ $line{itemtype} = $itemtype; > $line{count} = $total; > $grantotal += $total; > push @results,\%line; >diff --git a/reports/reserves_stats.pl b/reports/reserves_stats.pl >index df8d648..79cb122 100755 >--- a/reports/reserves_stats.pl >+++ b/reports/reserves_stats.pl >@@ -139,8 +139,8 @@ my %select; > > # create itemtype arrayref for <select>. > my @itemtypeloop; >-for my $itype ( sort {$itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description}} keys(%$itemtypes)) { >- push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{description} } ; >+for my $itype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys(%$itemtypes)) { >+ push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{translated_description} } ; > } > > # location list >diff --git a/tools/export.pl b/tools/export.pl >index 80a15b4..5eb0d6e 100755 >--- a/tools/export.pl >+++ b/tools/export.pl >@@ -483,7 +483,7 @@ else { > foreach my $thisitemtype ( sort keys %$itemtypes ) { > my %row = ( > value => $thisitemtype, >- description => $itemtypes->{$thisitemtype}->{'description'}, >+ description => $itemtypes->{$thisitemtype}->{translated_description}, > ); > push @itemtypesloop, \%row; > } >-- >2.1.0
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