Skip to content

Commit

Permalink
Merge pull request BioKIC#492 from BioKIC/hotfix_2023-06-01
Browse files Browse the repository at this point in the history
Hotfix: Occurrence upload, Key editor, Taxon Profile
  • Loading branch information
egbot authored Jun 2, 2023
2 parents de15df7 + 30c8a55 commit 091676d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
7 changes: 3 additions & 4 deletions classes/KeyEditorManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions classes/OccurrenceMaintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -189,8 +189,8 @@ private function batchUpdateTidInterpreted(&$occidArr){
$this->outputMsg($this->errorArr,2);
$status = false;
}
unset($occidArr[$tid]);
}
unset($occidArr);
return $status;
}

Expand Down
9 changes: 4 additions & 5 deletions classes/OccurrenceUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)){
Expand Down
2 changes: 1 addition & 1 deletion classes/SpecUploadBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
4 changes: 2 additions & 2 deletions classes/TPDescEditorManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())';
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion config/symbbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 091676d

Please sign in to comment.