fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7525] property: remove duplicate from result


From: Sigurd Nes
Subject: [Fmsystem-commits] [7525] property: remove duplicate from result
Date: Wed, 24 Aug 2011 10:57:56 +0000

Revision: 7525
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7525
Author:   sigurdne
Date:     2011-08-24 10:57:54 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
property: remove duplicate from result

Modified Paths:
--------------
    trunk/property/inc/class.soentity.inc.php

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2011-08-24 07:06:07 UTC (rev 
7524)
+++ trunk/property/inc/class.soentity.inc.php   2011-08-24 10:57:54 UTC (rev 
7525)
@@ -223,6 +223,7 @@
 
                                $sql = 
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols_return'=>$cols_return,'cols'=>$cols,
                                        
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query,'lookup'=>$lookup,'location_level'=>$category['location_level']));
+                               $sql =  str_replace('SELECT', 'SELECT 
DISTINCT',$sql);
 
                                
$this->bocommon->fm_cache("sql_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}", 
$sql);
                                
$this->bocommon->fm_cache("uicols_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $this->bocommon->uicols);
@@ -545,9 +546,8 @@
                        $sql .= " $filtermethod $querymethod";
 
 //_debug_array($sql);
-                       $this->db->query('SELECT count(*) as cnt ' . 
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $this->total_records = $this->db->f('cnt');
+                       $this->db->query("SELECT DISTINCT {$entity_table}.id " 
. substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();
 
                        if($dry_run)
                        {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]