From 2a330981e0cdaff2b9d573112acdecde8cfacc8a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 15 Sep 2020 13:55:11 +0100 Subject: [PATCH] Bug 24975: Use 'key' for translation lookup This patch switches from using the original text as a key for translations to using a dedicated 'key' field. We also add in a 'fuzzy' flag to denote when the source text has changed and as such the pre-existing translations may be incorrect. ToDo: 1/ Expose 'Fuzzy' on the 'Localization' admin page 2/ Add a 'translation_key' method to Koha::Itemtype to encourage the adoption of a standardly names accessor to get the 'translation_key' from a Koha::Object derived class. --- C4/Biblio.pm | 2 +- C4/Items.pm | 2 +- C4/Search.pm | 6 ++-- Koha/DBIx/Component/L10nSource.pm | 27 +++++++++-------- Koha/I18N.pm | 29 +++++++++---------- Koha/Schema/Result/Itemtype.pm | 12 ++++---- Koha/Template/Plugin/ItemTypes.pm | 4 +-- acqui/orderreceive.pl | 1 - authorities/authorities.pl | 2 +- catalogue/getitem-ajax.pl | 2 +- catalogue/itemsearch.pl | 2 +- catalogue/moredetail.pl | 5 ++-- catalogue/search.pl | 2 +- cataloguing/addbiblio.pl | 2 +- circ/transferstoreceive.pl | 2 +- .../data/mysql/atomicupdate/bug-24975.perl | 20 ++++++------- installer/data/mysql/kohastructure.sql | 27 +++++++++++------ .../prog/en/modules/admin/localization.tt | 5 ++++ opac/opac-detail.pl | 4 +-- opac/opac-search.pl | 2 +- reports/issues_stats.pl | 4 +-- reports/reserves_stats.pl | 2 +- svc/checkouts | 2 +- svc/holds | 2 +- 24 files changed, 91 insertions(+), 77 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 9e95184e64f..b873e32e5b2 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1414,7 +1414,7 @@ sub GetAuthorisedValueDesc { my $itypes = $cache->get_from_cache( $cache_key, { unsafe => 1 } ); if ( !$itypes ) { $itypes = - { map { $_->itemtype => db_t('itemtype', $itemtype->description) } + { map { $_->itemtype => db_t('itemtype', $itemtype->itemtype) } Koha::ItemTypes->search()->as_list }; $cache->set_in_cache( $cache_key, $itypes ); } diff --git a/C4/Items.pm b/C4/Items.pm index e3f37c2c7d5..1d2d74b0f5e 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1464,7 +1464,7 @@ sub PrepareItemrecordDisplay { push @authorised_values, ""; while ( my $itemtype = $itemtypes->next ) { push @authorised_values, $itemtype->itemtype; - $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description); + $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->itemtype); } if ($defaultvalues && $defaultvalues->{'itemtype'}) { $defaultvalue = $defaultvalues->{'itemtype'}; diff --git a/C4/Search.pm b/C4/Search.pm index f25de056966..77e3e6e48cd 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -539,7 +539,7 @@ sub getRecords { && ref( $itemtypes->{$one_facet} ) eq "HASH" ) { - $facet_label_value = db_t('itemtype', $itemtypes->{$one_facet}->{description}); + $facet_label_value = db_t('itemtype', $itemtypes->{$one_facet}->{itemtype}); } } @@ -1751,7 +1751,7 @@ sub searchResults { # add imageurl to itemtype if there is one $oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{}; # Build summary if there is one (the summary is defined in the itemtypes table) - $oldbiblio->{description} = $itemtype ? db_t('itemtype', $itemtype->{description}) : q{}; + $oldbiblio->{description} = $itemtype ? db_t('itemtype', $itemtype->{itemtype}) : q{}; # Pull out the items fields my @fields = $marcrecord->field($itemtag); @@ -1823,7 +1823,7 @@ sub searchResults { next; } - $item->{description} = db_t('itemtype', $itemtypes{ $item->{itype} }{description}) if $item->{itype}; + $item->{description} = db_t('itemtype', $itemtypes{ $item->{itype} }{itemtype}) if $item->{itype}; # OPAC hidden items if ($is_opac) { diff --git a/Koha/DBIx/Component/L10nSource.pm b/Koha/DBIx/Component/L10nSource.pm index 933638e834e..1a3a4c0a9c4 100644 --- a/Koha/DBIx/Component/L10nSource.pm +++ b/Koha/DBIx/Component/L10nSource.pm @@ -49,19 +49,22 @@ Update or create an entry in l10n_source =cut sub update_l10n_source { - my ($self, $group, $key, $text) = @_; + my ( $self, $group, $key, $source_text ) = @_; - my $l10n_source_rs = $self->result_source->schema->resultset('L10nSource'); - $l10n_source_rs->update_or_create( - { - group => $group, - key => $key, - text => $text, - }, - { - key => 'group_key', - } - ); + my $l10n_source_rs = + $self->result_source->schema->resultset('L10nSource') + ->find( { group => $group, key => $key }, { key => 'group_key' } ); + + if ($l10n_source_rs) { + $l10n_source_rs->update( { text => $source_text } ); + my $l10n_target_rs = $l10n_source_rs->l10n_targets_rs; + $l10n_target_rs->update( { fuzzy => 1 } ); + } + else { + $l10n_source_rs = + $self->result_source->schema->resultset('L10nSource') + ->create( { group => $group, key => $key, text => $source_text } ); + } } =head2 delete_l10n_source diff --git a/Koha/I18N.pm b/Koha/I18N.pm index fe117c11c31..d88d6948615 100644 --- a/Koha/I18N.pm +++ b/Koha/I18N.pm @@ -228,19 +228,20 @@ sub _expand { =head2 db_t - db_t($group, $text) - db_t('itemtype', $itemtype->description) + db_t($group, $key) + db_t('itemtype', $itemtype->translation_key) Search for a translation in l10n_target table and return it if found -Return C<$text> otherwise +Return untranslated original text otherwise. =cut sub db_t { - my ($group, $text) = @_; + my ($group, $key) = @_; my $cache = Koha::Caches->get_instance(); unless ($cache->is_cache_active) { + warn "Using Koha::Cache::Memory::Lite"; $cache = Koha::Cache::Memory::Lite->get_instance(); } @@ -249,29 +250,27 @@ sub db_t { my $translations = $cache->get_from_cache($cache_key); unless ($translations) { my $schema = Koha::Database->new->schema; - my $rs = $schema->resultset('L10nTarget'); + my $rs = $schema->resultset('L10nSource'); my @targets = $rs->search( { - 'l10n_source.group' => $group, - language => $language, + 'group' => $group, + 'l10n_target.language' => $language, }, { - join => 'l10n_source', - prefetch => 'l10n_source', + join => 'l10n_target', + prefetch => 'l10n_target', result_class => 'DBIx::Class::ResultClass::HashRefInflator', }, ); - $translations = { map { $_->{l10n_source}->{text} => $_->{translation} } @targets }; + $translations = + { map { $_->{key} => $_->{l10n_targets}->[0]{translation} //= $_->{text} } + @targets }; $cache->set_in_cache($cache_key, $translations); } - if (exists $translations->{$text}) { - return $translations->{$text}; - } - - return $text; + return $translations->{$key}; } 1; diff --git a/Koha/Schema/Result/Itemtype.pm b/Koha/Schema/Result/Itemtype.pm index fdf55b9fbf6..2dd4d4b059a 100644 --- a/Koha/Schema/Result/Itemtype.pm +++ b/Koha/Schema/Result/Itemtype.pm @@ -356,7 +356,7 @@ sub insert { my $result = $self->next::method(@_); - $self->update_l10n_source('itemtype', $self->itemtype, $self->description); + $self->update_l10n_source( 'itemtype', $self->itemtype, $self->description ); return $result; } @@ -366,21 +366,21 @@ sub update { my $is_description_changed = $self->is_column_changed('description'); - my $result = $self->next::method(@_); - if ($is_description_changed) { - $self->update_l10n_source('itemtype', $self->itemtype, $self->description); + $self->update_l10n_source( 'itemtype', $self->itemtype, $self->description ); } + my $result = $self->next::method(@_); + return $result; } sub delete { my $self = shift; - my $result = $self->next::method(@_); + $self->delete_l10n_source( 'itemtype', $self->itemtype ); - $self->delete_l10n_source('itemtype', $self->itemtype); + my $result = $self->next::method(@_); return $result; } diff --git a/Koha/Template/Plugin/ItemTypes.pm b/Koha/Template/Plugin/ItemTypes.pm index 57379fa2f6a..7cf4a011c67 100644 --- a/Koha/Template/Plugin/ItemTypes.pm +++ b/Koha/Template/Plugin/ItemTypes.pm @@ -40,9 +40,9 @@ sub Get { } sub t { - my ($self, $description) = @_; + my ($self, $key) = @_; - return db_t('itemtype', $description); + return db_t('itemtype', $key); } 1; diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index 5f5b66b89e6..4ee436495bc 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -115,7 +115,6 @@ unless($acq_fw) { $template->param('NoACQframework' => 1); } - my $creator = Koha::Patrons->find( $order->created_by ); my $budget = GetBudget( $order->budget_id ); diff --git a/authorities/authorities.pl b/authorities/authorities.pl index 57f7f3d7e98..6665db62453 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -73,7 +73,7 @@ sub build_authorized_values_list { unless ( $tagslib->{$tag}->{$subfield}->{mandatory} && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) ); push @authorised_values, $itemtype->itemtype; - $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description); + $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->itemtype); } } else { # "true" authorised value diff --git a/catalogue/getitem-ajax.pl b/catalogue/getitem-ajax.pl index 43e5a0945c6..14667cad577 100755 --- a/catalogue/getitem-ajax.pl +++ b/catalogue/getitem-ajax.pl @@ -76,7 +76,7 @@ if($itemnumber) { my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype ); # We should not do that here, but call ->itemtype->description when needed instea - $item_unblessed->{itemtype} = db_t('itemtype', $itemtype->description); + $item_unblessed->{itemtype} = db_t('itemtype', $itemtype->itemtype); } my $json_text = to_json( $item_unblessed, { utf8 => 1 } ); diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index 75e071b659b..01816c27a51 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -283,7 +283,7 @@ my @itemtypes; foreach my $itemtype ( Koha::ItemTypes->search->as_list ) { push @itemtypes, { value => $itemtype->itemtype, - label => db_t('itemtype', $itemtype->description), + label => db_t('itemtype', $itemtype->itemtype), }; } diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index effac41111b..20f58eb318f 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -141,7 +141,7 @@ my $copynumbers = my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } }; -$data->{'itemtypename'} = db_t('itemtype', $itemtypes->{ $data->{'itemtype'} }->{description}) +$data->{'itemtypename'} = db_t('itemtype', $itemtypes->{ $data->{'itemtype'} }->{itemtype}) if $data->{itemtype} && exists $itemtypes->{ $data->{itemtype} }; foreach ( keys %{$data} ) { $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' ); @@ -155,8 +155,7 @@ foreach my $item (@items){ my $item_info = $item->unblessed; $item_info->{object} = $item; - $item_info->{itype} = $itemtypes->{ $item->itype }->{'translated_description'} if exists $itemtypes->{ $item->itype }; - $item_info->{itype} = db_t('itemtype', $itemtypes->{ $item_info->{itype} }->{description}) if exists $itemtypes->{ $item_info->{itype} }; + $item_info->{itype} = db_t('itemtype', $itemtypes->{ $item_info->{itype} }->{itemtype}) if exists $itemtypes->{ $item_info->{itype} }; $item_info->{effective_itemtype} = $itemtypes->{$item->effective_itemtype}; $item_info->{'ccode'} = $ccodes->{ $item->ccode } if $ccodes && $item->ccode && exists $ccodes->{ $item->ccode }; if ( defined $item->copynumber ) { diff --git a/catalogue/search.pl b/catalogue/search.pl index 9456d44505b..051a9654588 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -815,7 +815,7 @@ sub prepare_adv_search_types { map { $_->{itemtype} => { %$_, - description => db_t( 'itemtype', $_->{description} ), + description => db_t( 'itemtype', $_->{itemtype} ), } } @{ Koha::ItemTypes->search->unblessed } }; diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 7cb8d816350..07ed55d74e4 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -201,7 +201,7 @@ sub build_authorized_values_list { my $itemtypes = Koha::ItemTypes->search; while ( $itemtype = $itemtypes->next ) { push @authorised_values, $itemtype->itemtype; - $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description); + $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->itemtype); } $value = $itemtype unless ($value); } diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index 9edb0e43a0d..5ab65172db0 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -88,7 +88,7 @@ while ( my $library = $libraries->next ) { my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype ); $getransf{'datetransfer'} = $num->{'datesent'}; - $getransf{'itemtype'} = db_t('itemtype', $itemtype->description); + $getransf{'itemtype'} = db_t('itemtype', $itemtype->itemtype); %getransf = ( %getransf, title => $biblio->title, diff --git a/installer/data/mysql/atomicupdate/bug-24975.perl b/installer/data/mysql/atomicupdate/bug-24975.perl index 66d03199280..011fe02361c 100644 --- a/installer/data/mysql/atomicupdate/bug-24975.perl +++ b/installer/data/mysql/atomicupdate/bug-24975.perl @@ -2,25 +2,25 @@ $DBversion = 'XXX'; if( CheckVersion( $DBversion ) ) { $dbh->do(q{ CREATE TABLE IF NOT EXISTS l10n_source ( - l10n_source_id INT(11) NOT NULL AUTO_INCREMENT, + `l10n_source_id` INT(11) NOT NULL AUTO_INCREMENT, `group` VARCHAR(100) NULL DEFAULT NULL, `key` VARCHAR(100) NOT NULL, `text` TEXT NOT NULL, PRIMARY KEY (l10n_source_id), - UNIQUE KEY group_key (`group`, `key`), - KEY group_text (`group`, `text`(60)) + UNIQUE KEY group_text (`group`, `key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; }); $dbh->do(q{ CREATE TABLE IF NOT EXISTS l10n_target ( - l10n_target_id INT(11) NOT NULL AUTO_INCREMENT, - l10n_source_id INT(11) NOT NULL, - language VARCHAR(10) NOT NULL, - translation TEXT NOT NULL, + `l10n_target_id` INT(11) NOT NULL AUTO_INCREMENT, + `l10n_source_id` INT(11) NOT NULL, + `language` VARCHAR(10) NOT NULL, + `translation` TEXT NOT NULL, + `fuzzy` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (l10n_target_id), UNIQUE KEY l10n_source_language (l10n_source_id, language), - FOREIGN KEY l10n_source (l10n_source_id) REFERENCES l10n_source (l10n_source_id) + CONSTRAINT `l10n_target_fk` FOREIGN KEY (`l10n_source_id`) REFERENCES `l10n_source` (`l10n_source_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; }); @@ -37,11 +37,11 @@ if( CheckVersion( $DBversion ) ) { SELECT DISTINCT l10n_source_id, lang, translation FROM localization JOIN itemtypes ON (localization.code = itemtypes.itemtype) - JOIN l10n_source ON (itemtypes.itemtype = l10n_source.`key` AND l10n_source.`group` = 'itemtype') + JOIN l10n_source ON (itemtypes.description = l10n_source.`text` AND l10n_source.`group` = 'itemtype') WHERE entity = 'itemtypes' }); - $dbh->do('DROP TABLE localization'); + #$dbh->do('DROP TABLE localization'); } diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 4025c6830ad..794cb874928 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3754,29 +3754,38 @@ CREATE TABLE `keyboard_shortcuts` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `l10n_source` +-- DROP TABLE IF EXISTS l10n_source; CREATE TABLE l10n_source ( - l10n_source_id INT(11) NOT NULL AUTO_INCREMENT, + `l10n_source_id` INT(11) NOT NULL AUTO_INCREMENT, `group` VARCHAR(100) NULL DEFAULT NULL, `key` VARCHAR(100) NOT NULL, `text` TEXT NOT NULL, PRIMARY KEY (l10n_source_id), - UNIQUE KEY group_key (`group`, `key`), - KEY group_text (`group`, `text`(60)) + UNIQUE KEY group_key (`group`, `key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `l10n_target` +-- DROP TABLE IF EXISTS l10n_target; CREATE TABLE l10n_target ( - l10n_target_id INT(11) NOT NULL AUTO_INCREMENT, - l10n_source_id INT(11) NOT NULL, - language VARCHAR(10) NOT NULL, - translation TEXT NOT NULL, + `l10n_target_id` INT(11) NOT NULL AUTO_INCREMENT, + `l10n_source_id` INT(11) NOT NULL, + `language` VARCHAR(10) NOT NULL, + `translation` TEXT NOT NULL, + `fuzzy` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (l10n_target_id), UNIQUE KEY l10n_source_language (l10n_source_id, language), - FOREIGN KEY l10n_source (l10n_source_id) REFERENCES l10n_source (l10n_source_id) + CONSTRAINT `l10n_target_fk` FOREIGN KEY (`l10n_source_id`) REFERENCES `l10n_source` (`l10n_source_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `language_descriptions` @@ -5106,7 +5115,7 @@ CREATE TABLE `saved_sql` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `search_field` + -- DROP TABLE IF EXISTS `search_field`; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt index 683b8e460fb..cf1d244ab77 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt @@ -46,6 +46,7 @@ Group + Key Text Translations @@ -92,6 +93,10 @@ name: 'group', data: 'group', }, + { + name: 'key', + data: 'key', + }, { name: 'text', data: 'text', diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index b5a83f40f8c..7d7b93685c5 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -513,7 +513,7 @@ my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unble my $itemtype = $dat->{'itemtype'}; if ( $itemtype ) { $dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} ); - $dat->{'description'} = db_t('itemtype', $itemtypes->{$itemtype}->{description}); + $dat->{'description'} = db_t('itemtype', $itemtypes->{$itemtype}->{itemtype}); } my $shelflocations = @@ -709,7 +709,7 @@ else { $item_info->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itemtype->itemtype }->{'imageurl'} ); $item_info->{'description'} = - db_t('itemtype', $itemtypes->{ $itemtype->itemtype }->{description}); + db_t('itemtype', $itemtypes->{ $itemtype->itemtype }->{itemtype}); foreach my $field ( qw(ccode materials enumchron copynumber itemnotes location_description uri) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 3e26bf07e73..dcafa37b47f 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -240,7 +240,7 @@ foreach my $itemtype ( keys %{$itemtypes} ) { # If 'iscat' (see ITEMTYPECAT) then there is no itemtype and the description is not translated my $description = $itemtypes->{$itemtype}->{iscat} ? $itemtypes->{$itemtype}->{description} - : db_t('itemtype', Koha::ItemTypes->find($itemtype)->description); + : db_t('itemtype', Koha::ItemTypes->find($itemtype)->itemtype); $itemtypes->{$itemtype}->{description} = $description || $itemtypes->{$itemtype}->{description} || q{}; } diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl index 7423d692f77..02828361850 100755 --- a/reports/issues_stats.pl +++ b/reports/issues_stats.pl @@ -340,7 +340,7 @@ sub calculate { $cell{rowtitle_display} = ( $line =~ /ccode/ ) ? $ccodes->{$celvalue} : ( $line =~ /location/ ) ? $locations->{$celvalue} - : ( $line =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{description}) + : ( $line =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{itemtype}) : $celvalue; # default fallback if ( $line =~ /sort1/ ) { foreach (@$Bsort1) { @@ -429,7 +429,7 @@ sub calculate { $cell{coltitle_display} = ( $column =~ /ccode/ ) ? $ccodes->{$celvalue} : ( $column =~ /location/ ) ? $locations->{$celvalue} - : ( $column =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{description}) + : ( $column =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{itemtype}) : $celvalue; # default fallback if ( $column =~ /sort1/ ) { foreach (@$Bsort1) { diff --git a/reports/reserves_stats.pl b/reports/reserves_stats.pl index 0f5602b834f..e4303901dad 100755 --- a/reports/reserves_stats.pl +++ b/reports/reserves_stats.pl @@ -299,7 +299,7 @@ sub display_value { my $display_value = ( $crit =~ /ccode/ ) ? $ccodes->{$value} : ( $crit =~ /location/ ) ? $locations->{$value} - : ( $crit =~ /itemtype/ ) ? db_t('itemtype', Koha::ItemTypes->find( $value )->description) + : ( $crit =~ /itemtype/ ) ? db_t('itemtype', Koha::ItemTypes->find( $value )->itemtype) : ( $crit =~ /branch/ ) ? Koha::Libraries->find($value)->branchname : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value) : $value; # default fallback diff --git a/svc/checkouts b/svc/checkouts index aec48d978a3..10313c45807 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -147,7 +147,7 @@ my $item_level_itypes = C4::Context->preference('item-level_itypes'); my $claims_returned_lost_value = C4::Context->preference('ClaimReturnedLostValue'); my $confirm_parts_required = C4::Context->preference("CircConfirmItemParts"); -my $itemtypes = { map { $_->{itemtype} => db_t('itemtypes', $_->{itemtype}) } @{ Koha::ItemTypes->search->unblessed } }; +my $itemtypes = { map { $_->{itemtype} => db_t('itemtype', $_->{itemtype}) } @{ Koha::ItemTypes->search->unblessed } }; my @checkouts_today; my @checkouts_previous; diff --git a/svc/holds b/svc/holds index 77e111f6155..4bbef0c4b38 100755 --- a/svc/holds +++ b/svc/holds @@ -82,7 +82,7 @@ while ( my $h = $holds_rs->next() ) { my $itemtype_limit; if ( $h->itemtype ) { my $itemtype = Koha::ItemTypes->find( $h->itemtype ); - $itemtype_limit = db_t('itemtype', $itemtype->description); + $itemtype_limit = db_t('itemtype', $itemtype->itemtype); } my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed; -- 2.25.1