Skip to content

Commit

Permalink
Hotfix 3.1.4 (#1858)
Browse files Browse the repository at this point in the history
- Checklist voucher link bug 
-- Resolves issue where checklist link PK is not passed to link function. 
-- Resolves issue: #1828
- Specimen upload bug
-- Add IGNORE to avoid complete failure of insert statement
-- Capture and display warnings to user
-- Fix display of final record process count
- Occurrence Search breadcrumb bug fix 
-- Add comingFrom variable to pagination links within the list and tablelist pages
-- If comingFrom variable is not set, or set to anything other than "newsearch" or "harvestparams", set the variable to what is defined as the default within the symbini file. If default action is not defined within symbini, default to new search form.
-- Add comingFrom variable to harvestparams.php form
-- Resolves issue: #1840
- Occurrence Association Form Validation bug
-- Fix issue with internal association form validation failing and allowing for creation of an association without an internal occurrence being defined
-- Add form validation for external resource and general observation
-- Addresses issue: #1852
-- Add guid omoassociations RecordID on insert within occurrence editor
- Vendor library updates via composer 
-- update phpoffice/phpspreadsheet to v3.3.0
-- updated phpseclib/phpseclib explicitly to v3.0.42
-- update phpoffice/phpword to v1.3.0
- Fix data binding bug associated with searching occurrence via GUID within Occurrence Profile pages 
- Misc language translation issues
  • Loading branch information
egbot authored Nov 13, 2024
1 parent 258f4b9 commit 279ddd6
Show file tree
Hide file tree
Showing 1,665 changed files with 71,521 additions and 106,203 deletions.
10 changes: 6 additions & 4 deletions classes/ChecklistVoucherAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,16 +498,18 @@ public function addExternalVouchers($tid, $dataAsJson){

//Data mod functions
protected function insertChecklistTaxaLink($tid, $clid = null, $morpho = ''){
$status = false;
$clTaxaID = false;
if(!$clid) $clid = $this->clid;
if(is_numeric($tid) && is_numeric($clid)){
$inventoryManager = new ImInventories();
$inputArr = array('tid' => $tid, 'clid' => $clid);
if($morpho) $inputArr['morphoSpecies'] = $morpho;
$status = $inventoryManager->insertChecklistTaxaLink($inputArr);
if(!$status) $this->errorMessage = $inventoryManager->getErrorMessage();
if($inventoryManager->insertChecklistTaxaLink($inputArr)){
$clTaxaID = $inventoryManager->getPrimaryKey();
}
else $this->errorMessage = $inventoryManager->getErrorMessage();
}
return $status;
return $clTaxaID;
}

protected function insertVoucher($clTaxaID, $occid, $editorNotes = null, $notes = null){
Expand Down
6 changes: 3 additions & 3 deletions classes/GlossaryManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,9 @@ public function getExportArr($language, $tid, $keyword, $deepSearch=0, $images=0
if($r->source && !in_array($r->source, $referencesArr)) $referencesArr[] = $r->source;
if($r->translator && !in_array($r->translator, $contributorsArr)) $contributorsArr[] = $r->translator;
if($r->author && !in_array($r->author, $contributorsArr)) $contributorsArr[] = $r->author;
$retArr[$r->glossid]['term'] = strip_tags($r->term);
$retArr[$r->glossid]['searchTerm'] = strip_tags($r->searchterm);
if(!$definitions || $definitions != 'nodef') $retArr[$r->glossid]['definition'] = strip_tags($r->definition);
$retArr[$r->glossid]['term'] = strip_tags($r->term ?? '');
$retArr[$r->glossid]['searchTerm'] = strip_tags($r->searchterm ?? '');
if(!$definitions || $definitions != 'nodef') $retArr[$r->glossid]['definition'] = strip_tags($r->definition ?? '');
if($r->glossgrpid && $r->glossgrpid != $r->glossid) $groupMap[$r->glossgrpid][] = $r->glossid;
}
$rs->free();
Expand Down
5 changes: 3 additions & 2 deletions classes/OccurrenceEditorManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1621,9 +1621,10 @@ public function cloneOccurrence($postArr){
if($sourceOccid != $this->occid && !in_array($this->occid,$retArr)){
$retArr[$this->occid] = $this->occid;
if(isset($postArr['assocrelation']) && $postArr['assocrelation']){
$sql = 'INSERT INTO omoccurassociations(occid, associationType, occidAssociate, relationship,createdUid) VALUES(?, "internalOccurrence", ?, ?, ?) ';
$sql = 'INSERT INTO omoccurassociations(occid, associationType, occidAssociate, relationship, createdUid, RecordID) VALUES(?, "internalOccurrence", ?, ?, ?, ? ) ';
if($stmt = $this->conn->prepare($sql)){
$stmt->bind_param('iisi', $this->occid, $sourceOccid, $postArr['assocrelation'], $GLOBALS['SYMB_UID']);
$guid = UuidFactory::getUuidV4();
$stmt->bind_param('iisis', $this->occid, $sourceOccid, $postArr['assocrelation'], $GLOBALS['SYMB_UID'], $guid);
$stmt->execute();
if($stmt->error){
$this->errorArr[] = $LANG['ERROR_ADDING_REL'].': '.$this->conn->error;
Expand Down
3 changes: 2 additions & 1 deletion classes/OccurrenceExsiccatae.php
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ public function getExsTableRow($occid,$oArr,$omenid,$targetCollid){
}

private function cleanOutStr($str){
if(!isset($str)) return null;
$newStr = str_replace('"',""",$str);
$newStr = str_replace("'","'",$newStr);
//$newStr = $this->conn->real_escape_string($newStr);
Expand All @@ -788,4 +789,4 @@ private function cleanInStr($str){
return $newStr;
}
}
?>
?>
33 changes: 17 additions & 16 deletions classes/OccurrenceIndividual.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
include_once('Manager.php');
include_once('OccurrenceAccessStats.php');
include_once('ChecklistVoucherAdmin.php');
include_once($SERVER_ROOT . '/utilities/SymbUtil.php');

class OccurrenceIndividual extends Manager{

Expand Down Expand Up @@ -75,31 +76,31 @@ public function setGuid($guid){
if(!$this->occid){
//Check occurrence recordID
$sql = 'SELECT occid FROM omoccurrences WHERE (occurrenceid = ?) OR (recordID = ?)';
if($stmt = $this->conn->prepare($sql)){
$stmt->bind_param('ss', $guid, $guid);
$stmt->execute();
$stmt->bind_result($this->occid);
$stmt->close();
if($result = SymbUtil::execute_query($this->conn, $sql, [$guid, $guid])){
if($row = $result->fetch_assoc()) {
$this->occid = $row['occid'];
}
$result->free();
}
}
if(!$this->occid){
//Check image recordID
$sql = 'SELECT occid FROM images WHERE recordID = ?';
if($stmt = $this->conn->prepare($sql)){
$stmt->bind_param('s', $guid);
$stmt->execute();
$stmt->bind_result($this->occid);
$stmt->close();
if($result = SymbUtil::execute_query($this->conn, $sql, [$guid])){
if($row = $result->fetch_assoc()) {
$this->occid = $row['occid'];
}
$result->free();
}
}
if(!$this->occid){
//Check identification recordID
$sql = 'SELECT occid FROM omoccurdeterminations WHERE recordID = ?';
if($stmt = $this->conn->prepare($sql)){
$stmt->bind_param('s', $guid);
$stmt->execute();
$stmt->bind_result($this->occid);
$stmt->close();
if($result = SymbUtil::execute_query($this->conn, $sql, [$guid])){
if($row = $result->fetch_assoc()) {
$this->occid = $row['occid'];
}
$result->free();
}
}
return $this->occid;
Expand Down Expand Up @@ -422,7 +423,7 @@ private function setOccurrenceRelationships(){
$objectID = $r->catalogNumber;
if($objectID) {
if(strpos($objectID, $r->instCode) === false){
//Append institution and collection code to catalogNumber, but only if it is not already included
//Append institution and collection code to catalogNumber, but only if it is not already included
$collCode = $r->instCode;
if($r->collCode) $collCode .= '-' . $r->collCode;
$objectID = $collCode . ':' . $r->catalogNumber;
Expand Down
12 changes: 7 additions & 5 deletions classes/OccurrenceLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ public function getLabelArray($occidArr, $speciesAuthors = false){
'INNER JOIN taxa t2 ON ts.parenttid = t2.tid '.
$sqlWhere.' AND t.rankid > 220 AND ts.taxauthid = 1 ';
if(!$speciesAuthors) $sql1 .= 'AND t.unitname2 = t.unitname3 ';
//echo $sql1; exit;
if($rs1 = $this->conn->query($sql1)){
while($row1 = $rs1->fetch_object()){
$authorArr[$row1->occid] = $row1->author ?? '';
Expand All @@ -182,12 +181,15 @@ public function getLabelArray($occidArr, $speciesAuthors = false){
//Get occurrence records
$this->setLabelFieldArr();
$sql2 = 'SELECT '.implode(',',$this->labelFieldArr).' FROM omoccurrences o LEFT JOIN taxa t ON o.tidinterpreted = t.tid '.$sqlWhere;
//echo 'SQL: '.$sql2;
if($rs2 = $this->conn->query($sql2)){
while($row2 = $rs2->fetch_assoc()){
$row2 = array_change_key_case($row2);
if(array_key_exists($row2['occid'],$authorArr)) $row2['parentauthor'] = $authorArr[$row2['occid']];
$retArr[$row2['occid']] = $row2;
$occid = $row2['occid'];
foreach($row2 as $fieldName => $fieldValue){
$retArr[$occid][strtolower($fieldName)] = $fieldValue ?? '';
}
if(array_key_exists($occid, $authorArr)){
$retArr[$occid]['parentauthor'] = $authorArr[$occid];
}
}
$rs2->free();
}
Expand Down
7 changes: 5 additions & 2 deletions classes/TaxonomyUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,17 @@ public function loadFile($fieldMap){
if($k == 'author') $sql2 .= ',"'.($inValue?$inValue:'').'"';
else $sql2 .= ','.($inValue?'"'.$inValue.'"':'NULL');
}
$sql = 'INSERT INTO uploadtaxa('.substr($sql1,1).') VALUES('.substr($sql2,1).')';
$sql = 'INSERT IGNORE INTO uploadtaxa('.substr($sql1,1).') VALUES('.substr($sql2,1).')';
//echo '<div>'.$sql.'</div>';
if($this->conn->query($sql)){
if($recordCnt%1000 == 0){
$this->outputMsg('Upload count: '.$recordCnt,1);
ob_flush();
flush();
}
if($warnings = $this->conn->get_warnings()){
$this->outputMsg('WARNING at line ' . $recordCnt . ': ' . $warnings->message, 2);
}
}
else{
$this->outputMsg('ERROR loading taxon: '.$this->conn->error,2);
Expand All @@ -249,7 +252,7 @@ public function loadFile($fieldMap){
$this->outputMsg('ERROR loading taxonunit: '.$this->conn->error);
}
}
$this->outputMsg($recordCnt.' taxon records pre-processed');
$this->outputMsg(($recordCnt - 1) . ' taxon records pre-processed');
}
else{
$this->outputMsg('ERROR: Scientific name is not mapped to &quot;scinameinput&quot;');
Expand Down
25 changes: 20 additions & 5 deletions collections/editor/includes/resourcetab.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,27 @@ function occidAssociateChanged(radioElem){
}

function validateAssocForm(f){
if(f.relationship.value == ""){
alert("<?php echo $LANG['DEFINE_REL']; ?>");
return false;
if(f.associationType.value == "internalOccurrence"){
let occidAssocChecked = false;
if(f.occidAssociate){
let assocRadios = document.querySelector('input[name = "occidAssociate"]:checked');
if(assocRadios != null){
occidAssocChecked = true;
}
}
if(!occidAssocChecked){
alert("<?= $LANG['SELECT_INTERNAL_REL'] ?>");
return false;
}
}
else if(f.associationType.value == "observational"){
if(f.verbatimsciname.value == ""){
alert("<?= $LANG['VERB_SCINAME_EMPTY'] ?>");
return false;
}
}
else if(f.resourceurl.value == "" && f.objectid.value == "" && f.verbatimsciname.value == "" && (!f.occidAssociate || f.occidAssociate.value == "")){
alert("<?php echo $LANG['REL_NOT_DEFINED']; ?>");
else if(f.resourceurl.value == ""){
alert("<?= $LANG['RESOURCE_EMPTY'] ?>");
return false;
}
return true;
Expand Down
3 changes: 1 addition & 2 deletions collections/exsiccati/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function verifyExsEditForm(f){
}

function verifyExsMergeForm(f){
if(t.targetometid == ""){
if(!f.targetometid || !f.targetometid.value){
alert("You need to select a target exsiccata to merge into");
return false;
}
Expand Down Expand Up @@ -850,4 +850,3 @@ function buildExsSelect(selectObj){
include($SERVER_ROOT.'/includes/footer.php');
?>
</body>
</html>
1 change: 1 addition & 0 deletions collections/harvestparams.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@
<div><button type="reset" style="width:100%" onclick="resetHarvestParamsForm()"><?php echo isset($LANG['BUTTON_RESET'])?$LANG['BUTTON_RESET']:'Reset Form'; ?></button></div>
</div>
<div>
<input name="comingFrom" type="hidden" value="harvestparams" >
<input type="hidden" name="reset" value="1" />
<input type="hidden" name="db" value="<?php echo $collManager->getSearchTerm('db'); ?>" />
</div>
Expand Down
12 changes: 9 additions & 3 deletions collections/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
$cntPerPage = array_key_exists('cntperpage', $_REQUEST) ? filter_var($_REQUEST['cntperpage'], FILTER_SANITIZE_NUMBER_INT) : 100;
$pageNumber = array_key_exists('page', $_REQUEST) ? filter_var($_REQUEST['page'], FILTER_SANITIZE_NUMBER_INT) : 1;
$datasetid = array_key_exists('datasetid', $_REQUEST) ? filter_var($_REQUEST['datasetid'], FILTER_SANITIZE_NUMBER_INT) : '';
$comingFrom = array_key_exists('comingFrom', $_REQUEST) ? htmlspecialchars($_REQUEST['comingFrom'], HTML_SPECIAL_CHARS_FLAGS) : '';
$comingFrom = (array_key_exists('comingFrom', $_REQUEST) ? $_REQUEST['comingFrom'] : '');
if($comingFrom != 'harvestparams' && $comingFrom != 'newsearch'){
//If not set via a valid input variable, use setting set within symbini
$comingFrom = !empty($SHOULD_USE_HARVESTPARAMS) ? 'harvestparams' : 'newsearch';
}

$_SESSION['datasetid'] = filter_var($datasetid, FILTER_SANITIZE_NUMBER_INT);

$collManager = new OccurrenceListManager();
$searchVar = $collManager->getQueryTermStr();
if ($targetTid && array_key_exists('mode', $_REQUEST)) $searchVar .= '&mode=voucher&targettid=' . $targetTid;
$searchVar .= '&comingFrom=' . $comingFrom;
$occurArr = $collManager->getSpecimenMap($pageNumber, $cntPerPage);
$SHOULD_INCLUDE_CULTIVATED_AS_DEFAULT = $SHOULD_INCLUDE_CULTIVATED_AS_DEFAULT ?? false;
$SHOULD_USE_HARVESTPARAMS = $SHOULD_USE_HARVESTPARAMS ?? false;
Expand Down Expand Up @@ -138,7 +144,7 @@ function displayDatasetTools() {
else {
echo '<div class="navpath">';
echo '<a href="../index.php">' . htmlspecialchars($LANG['NAV_HOME'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) . '</a> &gt;&gt; ';
if($comingFrom !== 'search/index.php'){
if($comingFrom == 'harvestparams'){
echo '<a href="index.php">' . htmlspecialchars($LANG['NAV_COLLECTIONS'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) . '</a> &gt;&gt; ';
echo '<a href="' . $CLIENT_ROOT . '/collections/harvestparams.php">' . htmlspecialchars($LANG['NAV_SEARCH'], ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE) . '</a> &gt;&gt; ';
} else{
Expand Down Expand Up @@ -184,7 +190,7 @@ function displayDatasetTools() {
}
?>
<form action="listtabledisplay.php" method="post" style="float:left">
<input name="comingFrom" type="hidden" value="<?php echo $comingFrom; ?>" />
<input name="comingFrom" type="hidden" value="<?= $comingFrom; ?>" />
<button class="icon-button" aria-label="<?php echo (isset($LANG['TABLE_DISPLAY']) ? $LANG['TABLE_DISPLAY'] : 'Table Display'); ?>" title="<?php echo (isset($LANG['TABLE_DISPLAY']) ? $LANG['TABLE_DISPLAY'] : 'Table Display'); ?>">
<svg style="width:1.3em;height:1.3em" alt="<?php echo $LANG['IMG_TABLE_DISPLAY']; ?>" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200Zm80-400h560v-160H200v160Zm213 200h134v-120H413v120Zm0 200h134v-120H413v120ZM200-400h133v-120H200v120Zm427 0h133v-120H627v120ZM200-200h133v-120H200v120Zm427 0h133v-120H627v120Z"/></svg>
</button>
Expand Down
23 changes: 16 additions & 7 deletions collections/listtabledisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
header("Content-Type: text/html; charset=".$CHARSET);

$SHOULD_INCLUDE_CULTIVATED_AS_DEFAULT = $SHOULD_INCLUDE_CULTIVATED_AS_DEFAULT ?? false;
$SHOULD_USE_HARVESTPARAMS = $SHOULD_USE_HARVESTPARAMS ?? false;
$actionPage = $SHOULD_USE_HARVESTPARAMS ? "harvestparams.php" : "./search/index.php";
$comingFrom = array_key_exists('comingFrom', $_REQUEST) ? htmlspecialchars($_REQUEST['comingFrom'], HTML_SPECIAL_CHARS_FLAGS) : '';

$page = array_key_exists('page',$_REQUEST) ? $_REQUEST['page'] : 1;
$tableCount= array_key_exists('tablecount',$_REQUEST) ? $_REQUEST['tablecount'] : 1000;
$sortField1 = array_key_exists('sortfield1',$_REQUEST) ? $_REQUEST['sortfield1'] : 'collectionname';
$sortField2 = array_key_exists('sortfield2',$_REQUEST) ? $_REQUEST['sortfield2'] : '';
$sortOrder = array_key_exists('sortorder',$_REQUEST) ? $_REQUEST['sortorder'] : '';
$comingFrom = (array_key_exists('comingFrom', $_REQUEST) ? $_REQUEST['comingFrom'] : '');
if($comingFrom != 'harvestparams' && $comingFrom != 'newsearch'){
//If not set via a valid input variable, use setting set within symbini
$comingFrom = !empty($SHOULD_USE_HARVESTPARAMS) ? 'harvestparams' : 'newsearch';
}

//Sanitation
if(!is_numeric($page) || $page < 1) $page = 1;
Expand All @@ -24,6 +26,7 @@

$collManager = new OccurrenceListManager();
$searchVar = $collManager->getQueryTermStr();
$searchVar .= '&comingFrom=' . $comingFrom;
?>
<!DOCTYPE html>
<html lang="<?php echo $LANG_TAG ?>">
Expand Down Expand Up @@ -68,7 +71,7 @@
</div>
-->
<form action="list.php" method="post" style="float:left">
<input name="comingFrom" type="hidden" value="<?php echo $comingFrom; ?>" />
<input name="comingFrom" type="hidden" value="<?= $comingFrom; ?>" />
<button type="submit" class="icon-button" style="margin:5px;padding:5px;" title="<?php echo (isset($LANG['LIST_DISPLAY']) ? $LANG['LIST_DISPLAY'] : 'List Display'); ?>" aria-label="<?php echo (isset($LANG['LIST_DISPLAY']) ? $LANG['LIST_DISPLAY'] : 'List Display'); ?>">
<svg xmlns="http://www.w3.org/2000/svg" style="width:1.3em;height:1.3em" alt="<?php echo (isset($LANG['LIST_DISPLAY']) ? $LANG['LIST_DISPLAY'] : 'List Display'); ?>" height="24" viewBox="0 -960 960 960" width="24"> <path d="M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"/></svg>
</button>
Expand Down Expand Up @@ -160,12 +163,18 @@
</div>
<div class="navpath">
<a href="../index.php"><?php echo htmlspecialchars((isset($LANG['NAV_HOME']) ? $LANG['NAV_HOME'] : 'Home'), ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE); ?></a> &gt;&gt;
<?php if($comingFrom !== 'search/index.php'){ ?>
<?php
if($comingFrom == 'harvestparams'){
?>
<a href="index.php"><?php echo htmlspecialchars((isset($LANG['NAV_COLLECTIONS']) ? $LANG['NAV_COLLECTIONS'] : 'Collections'), ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE); ?></a> &gt;&gt;
<a href="<?php echo $CLIENT_ROOT . '/collections/harvestparams.php' ?>"><?php echo htmlspecialchars((isset($LANG['NAV_SEARCH']) ? $LANG['NAV_SEARCH'] : 'Search Criteria'), ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE); ?></a> &gt;&gt;
<?php }else{ ?>
<?php
}else{
?>
<a href="<?php echo $CLIENT_ROOT . '/collections/search/index.php' ?>"><?php echo htmlspecialchars((isset($LANG['NAV_SEARCH']) ? $LANG['NAV_SEARCH'] : 'Search Criteria'), ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE); ?></a> &gt;&gt;
<?php } ?>
<?php
}
?>
<b><?php echo (isset($LANG['SPEC_REC_TAB']) ? $LANG['SPEC_REC_TAB'] : 'Specimen Records Table'); ?></b>
</div>
</div>
Expand Down
Loading

0 comments on commit 279ddd6

Please sign in to comment.