I noticed these warnings coming from getTranslatedLanguages when working on my OpacNav-to-news patch: Use of uninitialized value $interface in concatenation (.) or string at /kohadevbox/koha/C4/Languages.pm line 121. Use of uninitialized value $theme in concatenation (.) or string at /kohadevbox/koha/C4/Languages.pm line 121.
Created attachment 124922 [details] [review] Bug 29040: Quiet ninitialized value warnings in Languages.pm This patch makes a minor change to getTranslatedLanguages in Languages.pm in order to quiet a warning shown when the "interface" and "theme" variables are empty. To test, apply the patch go to Administration -> Item types -> Edit item type. - Check the error log: tail /var/log/koha/kohadev/plack-intranet-error.log - Before the patch you would see a warning, "Use of uninitialized value $interface in concatenation (.) or string at /kohadevbox/koha/C4/Languages.pm line 121." - After the patch there should be no new warnings.
Created attachment 124942 [details] [review] Bug 29040: Quiet ninitialized value warnings in Languages.pm This patch makes a minor change to getTranslatedLanguages in Languages.pm in order to quiet a warning shown when the "interface" and "theme" variables are empty. To test, apply the patch go to Administration -> Item types -> Edit item type. - Check the error log: tail /var/log/koha/kohadev/plack-intranet-error.log - Before the patch you would see a warning, "Use of uninitialized value $interface in concatenation (.) or string at /kohadevbox/koha/C4/Languages.pm line 121." - After the patch there should be no new warnings. Signed-off-by: David Nind <david@davidnind.com>
The get_from_cache() function cannot be called without any value because it calls croak() if done so. This change will at least break the Koha installer, http://localhost:8081/cgi-bin/koha/installer/install.pl. Please also fix the typo in the commit title and check with perltidy your code follows the coding style: https://wiki.koha-community.org/wiki/Coding_Guidelines#PERL1:_Perltidy
Created attachment 127866 [details] [review] Bug 29040: Remove warning from the itemtype edit view Use of uninitialized value $interface in concatenation (.) or string at /kohadevbox/koha/C4/Languages.pm line 121. We are expecting "intranet" or "opac", here we sent undef which raises a warning. For no change in behaviour we can send "both" (or whatever different than "intranet" and "opac"). Test plan: Hit /cgi-bin/koha/admin/itemtypes.pl?op=add_form&itemtype=BK Notice that the warning does no longer appear in the logs with the patch applied.
Created attachment 128253 [details] [review] Bug 29040: Remove warning from the itemtype edit view Use of uninitialized value $interface in concatenation (.) or string at /kohadevbox/koha/C4/Languages.pm line 121. We are expecting "intranet" or "opac", here we sent undef which raises a warning. For no change in behaviour we can send "both" (or whatever different than "intranet" and "opac"). Test plan: Hit /cgi-bin/koha/admin/itemtypes.pl?op=add_form&itemtype=BK Notice that the warning does no longer appear in the logs with the patch applied. Signed-off-by: David Nind <david@davidnind.com>
Created attachment 128459 [details] [review] Bug 29040: Remove warning from the itemtype edit view Use of uninitialized value $interface in concatenation (.) or string at /kohadevbox/koha/C4/Languages.pm line 121. We are expecting "intranet" or "opac", here we sent undef which raises a warning. For no change in behaviour we can send "both" (or whatever different than "intranet" and "opac"). Test plan: Hit /cgi-bin/koha/admin/itemtypes.pl?op=add_form&itemtype=BK Notice that the warning does no longer appear in the logs with the patch applied. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
*** Bug 28775 has been marked as a duplicate of this bug. ***
I will still have a look at this call now on bug 29245. my $translated_languages = C4::Languages::getTranslatedLanguages( "both", C4::Context->preference('template') ); When we ask for both, it is actually a bit weird to pass the staff theme too. But this is merely theoretical.
Another question: admin/localization.pl contains: my $translated_languages = C4::Languages::getTranslatedLanguages( 'intranet', C4::Context->preference('template') ); Since we use both in itemtypes, I am wondering if this statement is wrong?
Pushed to 21.11.x for 21.11.01
Pushed to 21.05.x for 21.05.08
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.