From adef1d1020255373ec6f954bcd1a02e382305047 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 7 Jan 2016 12:34:54 +0000 Subject: [PATCH] Bug 15306: Do not display the translate link if only 1 language is installed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It doesn't make sense to offer the option to translate an item type description into another language if there is only one language installed. Test plan: Generates templates for only 1 language Edit an item type and confirm that the link "translate into..." is not displayed. Generates templates for another language Confirm that the link is now displayed. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- admin/itemtypes.pl | 2 ++ koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index f5182cd4b5..c762acc76b 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -60,10 +60,12 @@ if ( $op eq 'add_form' ) { my $itemtype = Koha::ItemTypes->find($itemtype_code); my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) ); my $searchcategory = GetAuthorisedValues("ITEMTYPECAT", ( $itemtype ? $itemtype->searchcategory : '' ) ); + my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') ); $template->param( itemtype => $itemtype, imagesets => $imagesets, searchcategory => $searchcategory, + can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ), ); } elsif ( $op eq 'add_validate' ) { my $is_a_modif = $input->param('is_a_modif'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt index d4385c7116..164970237c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -140,7 +140,9 @@ Item types administration
  • Required - Translate into other languages + [% IF can_be_translated %] + Translate into other languages + [% END %]
  • Search category -- 2.39.5