Bug 101524

Summary: ML Content Items can 'disappear'
Product: [Retired] Red Hat Enterprise CMS Reporter: Dennis Gregorovic <dgregor>
Component: otherAssignee: Justin Ross <jross>
Status: CLOSED CURRENTRELEASE QA Contact: Jon Orris <jorris>
Severity: medium Docs Contact:
Priority: medium    
Version: nightly   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-10-14 14:58:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 101458    

Description Dennis Gregorovic 2003-08-02 16:27:04 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030716

Description of problem:
If you create a content item and then change its language, it will no longer
appear in the content section browse pane.  

When a content item is created it is assigned a language.  A content bundle is
also created and its default language is set to the language on the content
item.  The SQL query used to select items displayed in the browse pane matches
the default language of the bundle with the content item.  This is because there
may be multiple items with different languages in the same bundle, and you only
want to display one of those items.  However, because of this, if you change the
language on the content items such that none of them match the original language
(the bundle's default language) then none of the items appear

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.create a 'foo' article of language english
2.change its language to french
3.go to the content section browse pane

Actual Results:  'foo' isn't there

Expected Results:  'foo' should be there.  However, It's unclear what the
correct solution is.  One option is to just pull one item from random from the
bundle if none of them match the default language.  Another option is to prevent
the user from getting into a state such that none of the items match the
bundle's default language.

Additional info:

Comment 1 Dennis Gregorovic 2003-08-02 17:08:58 UTC
Here's an initial stab at a modified query that will pull one content item at
random to display when non match the default language.

--- Folder-queries.ora.pdl	2003-08-01 10:35:30.000000000 -0400
+++ /tmp/Folder-queries.ora.pdl	2003-08-02 13:07:07.000000000 -0400
@@ -255,8 +255,6 @@
       i.item_id = a.object_id
       i.type_id = t.type_id
-    and 
-      i.language = b.default_language
       i.parent_id = b.bundle_id
@@ -265,6 +263,22 @@
       bi.parent_id = :parent
       i.version = :version
+    and
+      i.item_id = case when exists (select 1
+                                      from cms_items c
+                                     where c.language = b.default_language
+                                       and c.parent_id = b.bundle_id
+                                       and c.version = :version)
+                       then (select c.item_id
+                                      from cms_items c
+                                     where c.language = b.default_language
+                                       and c.parent_id = b.bundle_id
+                                       and c.version = :version)
+                       else (select max(c.item_id)
+                                      from cms_items c
+                                     where c.parent_id = b.bundle_id
+                                       and c.version = :version)
+                       end;
   } map {
     bundleID = bundle_id;
     item.id = i.item_id;

Comment 2 Jon Orris 2003-08-11 19:17:47 UTC
Justin & Archit: Need to change bundle's primary language when primary item's
language is changed.

Comment 3 Jon Orris 2003-10-14 14:58:43 UTC
Fixed. MLTest verifies