diff --git a/classes/KeyEditorManager.php b/classes/KeyEditorManager.php index 2f469fb190..c4d3fa3d81 100644 --- a/classes/KeyEditorManager.php +++ b/classes/KeyEditorManager.php @@ -23,8 +23,7 @@ public function __destruct(){ public function setTid($t){ if(is_numeric($t)){ $this->tid = $t; - $sql = "SELECT t.SciName, ts.ParentTID, t.RankId ". - "FROM taxa t INNER JOIN taxstatus ts ON t.tid = ts.tid WHERE ts.taxauthid = 1 AND (t.TID = ".$this->tid.')'; + $sql = 'SELECT t.SciName, ts.ParentTID, t.RankId FROM taxa t INNER JOIN taxstatus ts ON t.tid = ts.tid WHERE ts.taxauthid = 1 AND (t.TID = '.$this->tid.')'; $result = $this->conn->query($sql); if($row = $result->fetch_object()){ $this->taxonName = $row->SciName; @@ -81,9 +80,9 @@ private function setCharList(){ $parentStr = implode(',',$this->getParentArr($this->tid)); $sql = 'SELECT c.CharName, c.CID, ch.headingname, dep.CIDDependance, dep.CSDependance '. 'FROM kmcharacters c INNER JOIN kmchartaxalink ctl ON c.CID = ctl.CID '. - 'INNER JOIN kmcharheading ch ON c.hid = ch.hid '. + 'LEFT JOIN kmcharheading ch ON c.hid = ch.hid '. 'LEFT JOIN kmchardependance dep ON c.CID = dep.CID '. - 'WHERE (ch.language = "English") AND (c.CID Not In (SELECT DISTINCT chartl.CID FROM kmchartaxalink chartl WHERE (chartl.TID In ('.$parentStr.')) AND (chartl.Relation="exclude"))) '. + 'WHERE (ch.language IS NULL OR ch.language = "English") AND (c.CID Not In (SELECT DISTINCT chartl.CID FROM kmchartaxalink chartl WHERE (chartl.TID In ('.$parentStr.')) AND (chartl.Relation="exclude"))) '. 'AND (c.chartype = "UM" Or c.chartype="OM") AND (ctl.TID In ('.$parentStr.')) AND (ctl.Relation="include") '. 'ORDER BY ch.SortSequence,c.SortSequence'; //echo $sql; diff --git a/classes/OccurrenceMaintenance.php b/classes/OccurrenceMaintenance.php index a45de65fca..dc2b4bf709 100644 --- a/classes/OccurrenceMaintenance.php +++ b/classes/OccurrenceMaintenance.php @@ -180,7 +180,7 @@ public function indexOccurrencesToTaxa(){ private function batchUpdateTidInterpreted(&$occidArr){ $status = false; foreach($occidArr as $tid => $idArr){ - $sql = 'UPDATE omoccurrences SET tidInterpreted = '.$tid.' WHERE occid IN('.implode(',',$idArr).') '; + $sql = 'UPDATE omoccurrences SET tidInterpreted = '.$tid.' WHERE tidinterpreted IS NULL AND occid IN('.implode(',',$idArr).') '; if($this->conn->query($sql)){ $status = true; } @@ -189,8 +189,8 @@ private function batchUpdateTidInterpreted(&$occidArr){ $this->outputMsg($this->errorArr,2); $status = false; } + unset($occidArr[$tid]); } - unset($occidArr); return $status; } diff --git a/classes/OccurrenceUtilities.php b/classes/OccurrenceUtilities.php index b575782a72..4e0e046cad 100644 --- a/classes/OccurrenceUtilities.php +++ b/classes/OccurrenceUtilities.php @@ -704,12 +704,11 @@ public static function occurrenceArrayCleaning($recMap){ } } else{ - if(array_key_exists("genus",$recMap)){ + if(array_key_exists('genus',$recMap) && array_key_exists('specificepithet',$recMap) && array_key_exists('infraspecificepithet',$recMap)){ //Build sciname from individual units supplied by source - $sciName = $recMap["genus"]; - if(array_key_exists("specificepithet",$recMap)) $sciName .= " ".$recMap["specificepithet"]; - if(array_key_exists("taxonrank",$recMap)) $sciName .= " ".$recMap["taxonrank"]; - if(array_key_exists("infraspecificepithet",$recMap)) $sciName .= " ".$recMap["infraspecificepithet"]; + $sciName = trim($recMap['genus'].' '.$recMap['specificepithet']); + if(array_key_exists('taxonrank',$recMap)) $sciName .= ' '.$recMap['taxonrank']; + $sciName .= ' '.$recMap['infraspecificepithet']; $recMap['sciname'] = trim($sciName); } elseif(array_key_exists('scientificname',$recMap)){ diff --git a/classes/SpecUploadBase.php b/classes/SpecUploadBase.php index d5b6e2f070..7ff14c2d8d 100644 --- a/classes/SpecUploadBase.php +++ b/classes/SpecUploadBase.php @@ -1642,7 +1642,7 @@ protected function loadIdentificationRecord($recMap){ //Do some cleaning //Populate sciname if null if(!array_key_exists('sciname',$recMap) || !$recMap['sciname']){ - if(array_key_exists('genus',$recMap)){ + if(array_key_exists('genus',$recMap) && array_key_exists('specificepithet',$recMap) && array_key_exists('infraspecificepithet',$recMap)){ //Build sciname from individual units supplied by source $sciName = $recMap['genus']; if(array_key_exists('specificepithet',$recMap) && $recMap['specificepithet']) $sciName .= ' '.$recMap['specificepithet']; diff --git a/classes/TPDescEditorManager.php b/classes/TPDescEditorManager.php index 800a1726a7..73c8d40025 100644 --- a/classes/TPDescEditorManager.php +++ b/classes/TPDescEditorManager.php @@ -84,7 +84,7 @@ public function insertDescriptionProfile($postArr){ $langid = isset($postArr['langid']) ? $postArr['langid'] : 1; $defaultDisplayLevel = isset($postArr['defaultDisplayLevel']) ? $postArr['defaultDisplayLevel'] : 1; $dynamicProperties = isset($postArr['dynamicProperties']) ? $postArr['dynamicProperties'] : null; - $modifiedUid = isset($GLOBALS['SYMB_UID']); + $modifiedUid = $GLOBALS['SYMB_UID']; $sql = 'INSERT INTO taxadescrprofile(title, authors, caption, projectDescription, abstract, publication, urlTemplate, internalNotes, langid, defaultDisplayLevel, dynamicProperties, modifiedUid, modifiedTimestamp) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())'; @@ -159,7 +159,7 @@ public function insertDescriptionBlock($postArr){ if($tdProfileID = $this->insertDescriptionProfile($profileArr)){ $tid = $postArr['tid']; $note = isset($postArr['notes']) ? $postArr['notes'] : null; - $modifiedUid = isset($GLOBALS['SYMB_UID']); + $modifiedUid = $GLOBALS['SYMB_UID']; $sql = 'INSERT INTO taxadescrblock(tdProfileID, tid, source, sourceurl, displaylevel, notes, uid) VALUES(?, ?, ?, ?, ?, ?, ?)'; if($stmt = $this->conn->prepare($sql)){ $stmt->bind_param('iissisi', $tdProfileID, $tid, $source, $sourceUrl, $displayLevel, $note, $modifiedUid); diff --git a/config/symbbase.php b/config/symbbase.php index 1e2079a44a..1e21d05103 100644 --- a/config/symbbase.php +++ b/config/symbbase.php @@ -2,7 +2,7 @@ header('X-Frame-Options: DENY'); header('Cache-control: private'); // IE 6 FIX date_default_timezone_set('America/Phoenix'); -$CODE_VERSION = '3.0.7'; +$CODE_VERSION = '3.0.8'; if(!isset($CLIENT_ROOT) && isset($clientRoot)) $CLIENT_ROOT = $clientRoot; if(substr($CLIENT_ROOT,-1) == '/') $CLIENT_ROOT = substr($CLIENT_ROOT,0,strlen($CLIENT_ROOT)-1);