Bug 15306: Do not display the translate link if only 1 language is installed

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 <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
(cherry picked from commit adef1d1020)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Jonathan Druart 2016-01-07 12:34:54 +00:00 committed by Julian Maurice
parent fd65d2264e
commit 24975cd7ef
2 changed files with 5 additions and 1 deletions

View File

@ -121,6 +121,7 @@ if ( $op eq 'add_form' ) {
}
my $searchcategory = GetAuthorisedValues("ITEMTYPECAT", $data->{'searchcategory'});
my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') );
$template->param(
itemtype => $itemtype,
@ -137,6 +138,7 @@ if ( $op eq 'add_form' ) {
sip_media_type => $data->{sip_media_type},
hideinopac => $data->{'hideinopac'},
searchcategory => $searchcategory,
can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ),
);
# END $OP eq ADD_FORM

View File

@ -126,7 +126,9 @@ Item types administration
[% END %]
<li>
<label for="description" class="required">Description: </label><input type="text" id="description" name="description" size="48" value="[% description |html %]" required="required" /> <span class="required">Required</span>
<a href="/cgi-bin/koha/admin/localization.pl?entity=itemtypes&code=[% itemtype %]" title="Translate item type [% itemtype %]" rel="gb_page_center[600,500]"><i class="icon-edit"></i> Translate into other languages</a>
[% IF can_be_translated %]
<a href="/cgi-bin/koha/admin/localization.pl?entity=itemtypes&code=[% itemtype %]" title="Translate item type [% itemtype %]" rel="gb_page_center[600,500]"><i class="icon-edit"></i> Translate into other languages</a>
[% END %]
</li>
<li>
<span class="label">Search category</span>