From 12df8633596a00e856e21d22dc1bcae49ed5c47c Mon Sep 17 00:00:00 2001
From: "Ocke Janssen [oj]" <Ocke.Janssen@sun.com>
Date: Mon, 23 Nov 2009 10:33:17 +0100
Subject: dba33d: #i107104# error in where <> having

---
 .../source/ui/querydesign/SelectionBrowseBox.cxx   | 25 +++++++++++-----------
 1 file changed, 12 insertions(+), 13 deletions(-)

(limited to 'dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx')

diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 3d59903e3..7e2f34c95 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1807,25 +1807,23 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo , sal_uInt
             pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
             pEntry->GetFunction() == rInfo->GetFunction())
         {
-            /*sal_uInt32 nPos = aIter - rFields.begin();
-            bAppend = _nCurrentPos > nPos && (rInfo->IsGroupBy() != pEntry->IsGroupBy());
-            if ( bAppend )
+            if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
+            {
+                pEntry->SetGroupBy(sal_False);
                 aIter = rFields.end();
-            else*/
+                break;
+            }
+            else
             {
-                if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
-                {
-                    pEntry->SetGroupBy(sal_False);
-                    aIter = rFields.end();
-                }
-                else
+                if ( !pEntry->IsGroupBy() && !pEntry->HasCriteria() ) // here we have a where condition which is no having clause
                 {
                     pEntry->SetGroupBy(rInfo->IsGroupBy());
                     if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
                         pEntry->SetVisible(sal_True);
+                    break;
                 }
             }
-            break;
+            
         }
     }
 
@@ -1887,13 +1885,14 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S
         if (bCase(aField,rInfo->GetField()) && 
             bCase(aAlias,rInfo->GetAlias()) && 
             pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
-            pEntry->GetFunction() == rInfo->GetFunction())
+            pEntry->GetFunction() == rInfo->GetFunction() && 
+            pEntry->IsGroupBy() == rInfo->IsGroupBy() )
         {
             if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
                 pEntry->SetGroupBy(sal_False);
             else
             {
-                pEntry->SetGroupBy(rInfo->IsGroupBy());
+//				pEntry->SetGroupBy(rInfo->IsGroupBy());
                 if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
                     pEntry->SetVisible(sal_True);
             }
-- 
cgit v1.2.3