diff --git a/classes/OccurrenceManager.php b/classes/OccurrenceManager.php index 82dc1699ac..5716de54f3 100644 --- a/classes/OccurrenceManager.php +++ b/classes/OccurrenceManager.php @@ -549,7 +549,7 @@ protected function getTableJoins($sqlWhere){ if(strpos($sqlWhere,'e.taxauthid')){ $sqlJoin .= 'INNER JOIN taxaenumtree e ON o.tidinterpreted = e.tid '; } - if(strpos($sqlWhere,'ts.family')){ + if(strpos($sqlWhere,'ts.')){ $sqlJoin .= 'LEFT JOIN taxstatus ts ON o.tidinterpreted = ts.tid '; } if(strpos($sqlWhere,'ds.datasetid')){ diff --git a/classes/OccurrenceMapManager.php b/classes/OccurrenceMapManager.php index 19e9f6cf53..3c2749400f 100644 --- a/classes/OccurrenceMapManager.php +++ b/classes/OccurrenceMapManager.php @@ -55,11 +55,16 @@ public function getCoordinateMap($start, $limit){ if($this->sqlWhere){ $statsManager = new OccurrenceAccessStats(); $sql = 'SELECT o.occid, CONCAT_WS(" ",o.recordedby,IFNULL(o.recordnumber,o.eventdate)) AS identifier, '. - 'o.sciname, o.family, o.tidinterpreted, o.DecimalLatitude, o.DecimalLongitude, o.collid, o.catalognumber, '. + 'o.sciname, IF(ts.family IS NULL, o.family, ts.family) as family, o.tidinterpreted, o.DecimalLatitude, o.DecimalLongitude, o.collid, o.catalognumber, '. 'o.othercatalognumbers, c.institutioncode, c.collectioncode, c.CollectionName '. 'FROM omoccurrences o INNER JOIN omcollections c ON o.collid = c.collid '; + + $this->sqlWhere .= 'AND ts.taxauthid = 1 '; + $sql .= $this->getTableJoins($this->sqlWhere); + $sql .= $this->sqlWhere; + if(is_numeric($start) && $limit){ $sql .= "LIMIT ".$start.",".$limit; }