Bugzilla – Attachment 30518 Details for
Bug 12705
News not possible for one sublanguage if two sublanguages are installed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12705 - News not possible for one sublanguage if two sublanguages are installed
Bug-12705---News-not-possible-for-one-sublanguage-.patch (text/plain), 3.24 KB, created by
Marc Véron
on 2014-08-03 17:35:35 UTC
(
hide
)
Description:
Bug 12705 - News not possible for one sublanguage if two sublanguages are installed
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2014-08-03 17:35:35 UTC
Size:
3.24 KB
patch
obsolete
>From f1a05d9f9eda40af81841ccaff0467a20ebaef1b Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Mon, 21 Jul 2014 18:31:02 +0200 >Subject: [PATCH] Bug 12705 - News not possible for one sublanguage if two > sublanguages are installed >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To reproduce problem: > >Install and enable (in systempreferences:I18N/L10N language) e.g. >Português > Português (pt-PT) > Português (pt-BR) >Deutsch > Deutsch (de-CH) > Deutsch (de-DE) > >Go to cgi-bin/koha/tools/koha-news.pl and try to create news. > >The dropdown 'Display location' contains: >- All >- Librarian interface >- Slip >- OPAC (pt-BR) >- OPAC (en) >- OPAC (de-DE) > >OPAC (de-CH) and OPAC (pt-PT) are missing. It is not possible to create news for them (even if you disable e.g. de-DE or pt-BR) in system preferences). > >This patch reduces the possible languages to the main language. In the example above you will get: >- All >- Librarian interface >- Slip >- OPAC (pt) >- OPAC (en) >- OPAC (de) > >The OPAC then desiplays the news for all variants of a language. E.g. news for OPAC (de) is displayed for de-DE and de-ch > >News that already existed before applying the patch e.g. for de-DE will display for all de variants (de-DE and de-CH). > >To test: >- Go to cgi-bin/koha/tools/koha-news.pl >- Dropdown for location will display only main languages for OPAC (e.g. de instead of de-DE) >- Create news for a language >- Got to main page of OPAC, choose language variant >- News should display >- Choose other language variant for same language >- News should display as well. >--- > C4/NewsChannels.pm | 6 ++++-- > tools/koha-news.pl | 2 +- > 2 files changed, 5 insertions(+), 3 deletions(-) > >diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm >index 47772ef..4ce7748 100644 >--- a/C4/NewsChannels.pm >+++ b/C4/NewsChannels.pm >@@ -152,7 +152,8 @@ sub get_opac_news { > }; > $query .= ' WHERE 1'; > if ($lang) { >- $query .= " AND (opac_news.lang='' OR opac_news.lang=?)"; >+ $lang = substr($lang,0,2).'%'; >+ $query .= " AND (opac_news.lang='' OR opac_news.lang like ?)"; > push @values,$lang; > } > if ($branchcode) { >@@ -188,6 +189,7 @@ sub get_opac_news { > sub GetNewsToDisplay { > my ($lang,$branch) = @_; > my $dbh = C4::Context->dbh; >+ $lang = substr($lang,0,2).'%'; > # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate > my $query = q{ > SELECT *,timestamp AS newdate >@@ -198,7 +200,7 @@ sub GetNewsToDisplay { > OR expirationdate = '00-00-0000' > ) > AND `timestamp` < CURRENT_DATE()+1 >- AND (lang = '' OR lang = ?) >+ AND (lang = '' OR lang like ?) > AND (branchcode IS NULL OR branchcode = ?) > ORDER BY number > }; # expirationdate field is NOT in ISO format? >diff --git a/tools/koha-news.pl b/tools/koha-news.pl >index 478308f..18d1256 100755 >--- a/tools/koha-news.pl >+++ b/tools/koha-news.pl >@@ -68,7 +68,7 @@ my $tlangs = getTranslatedLanguages() ; > foreach my $language ( @$tlangs ) { > push @lang_list, > { >- language => $language->{'rfc4646_subtag'}, >+ language => $language->{'language'}, > selected => ( $new_detail->{lang} eq $language->{'rfc4646_subtag'} ? 1 : 0 ), > }; > } >-- >1.7.10.4
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 12705
:
30518
|
30646
|
30648
|
30898