Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from BioKIC/master
Browse files Browse the repository at this point in the history
Pull from bioKIC/Symbiota
GregoryPost authored Oct 12, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 94314b8 + 8bdf509 commit 730beca
Showing 5 changed files with 32 additions and 14 deletions.
1 change: 1 addition & 0 deletions classes/DwcArchiverCore.php
Original file line number Diff line number Diff line change
@@ -942,6 +942,7 @@ private function writeMetaFile(){
$occCnt = 1;
$termArr = $this->occurrenceFieldArr['terms'];
if ($this->schemaType == 'dwc' || $this->schemaType == 'pensoft') {
unset($termArr['eventDate2']);
unset($termArr['localitySecurity']);
}
if ($this->schemaType == 'dwc' || $this->schemaType == 'pensoft' || $this->schemaType == 'backup') {
6 changes: 4 additions & 2 deletions classes/ImageLibrarySearch.php
Original file line number Diff line number Diff line change
@@ -34,21 +34,23 @@ public function getImageArr($pageRequest,$cntPerPage){
$retArr = Array();
$this->setSqlWhere();
$this->setRecordCnt();
$sql = 'SELECT DISTINCT i.imgid, i.tid, IFNULL(t.sciname,o.sciname) as sciname, i.url, i.thumbnailurl, i.originalurl, i.photographeruid, i.caption, i.occid ';
$sql = 'SELECT i.imgid, i.tid, IFNULL(t.sciname,o.sciname) as sciname, i.url, i.thumbnailurl, i.originalurl, i.photographeruid, i.caption, i.occid ';
/*
$sql = 'SELECT DISTINCT i.imgid, o.tidinterpreted, t.tid, t.sciname, i.url, i.thumbnailurl, i.originalurl, i.photographeruid, i.caption, '.
'o.occid, o.stateprovince, o.catalognumber, CONCAT_WS("-",c.institutioncode, c.collectioncode) as instcode ';
*/
$sqlWhere = $this->sqlWhere;
if($this->imageCount == 'taxon') $sqlWhere .= 'GROUP BY sciname ';
elseif($this->imageCount == 'specimen') $sqlWhere .= 'GROUP BY i.occid ';
if($this->sqlWhere) $sqlWhere .= 'ORDER BY sciname ';
if($this->sqlWhere) $sqlWhere .= 'ORDER BY o.sciname ';
$bottomLimit = ($pageRequest - 1)*$cntPerPage;
$sql .= $this->getSqlBase().$sqlWhere.'LIMIT '.$bottomLimit.','.$cntPerPage;
//echo '<div>Spec sql: '.$sql.'</div>';
$occArr = array();
$result = $this->conn->query($sql);
$imgId = 0;
while($r = $result->fetch_object()){
if($imgId == $r->imgid) continue;
$imgId = $r->imgid;
$retArr[$imgId]['imgid'] = $r->imgid;
//$retArr[$imgId]['tidaccepted'] = $r->tidinterpreted;
2 changes: 1 addition & 1 deletion classes/OccurrenceCollectionProfile.php
Original file line number Diff line number Diff line change
@@ -215,7 +215,7 @@ public function batchTriggerGBIFCrawl($collIdArr){
}

public function triggerGBIFCrawl($dwcUri, $collid, $collectionName){
if(isset($GLOBALS['GBIF_USERNAME'])){
if(isset($GLOBALS['GBIF_USERNAME']) && $GLOBALS['GBIF_USERNAME']){
if($this->organizationKey){
if(!$this->logFH){
$this->setVerboseMode(3);
3 changes: 3 additions & 0 deletions classes/OccurrenceIndividual.php
Original file line number Diff line number Diff line change
@@ -117,6 +117,7 @@ public function getOccData($fieldKey = ""){
}

public function setOccurData(){
/*
$sql = 'SELECT o.occid, o.collid, o.institutioncode, o.collectioncode, '.
'o.occurrenceid, o.catalognumber, o.occurrenceremarks, o.tidinterpreted, o.family, o.sciname, '.
'o.scientificnameauthorship, o.identificationqualifier, o.identificationremarks, o.identificationreferences, o.taxonremarks, '.
@@ -128,6 +129,8 @@ public function setOccurData(){
'o.typestatus, o.dbpk, o.habitat, o.substrate, o.associatedtaxa, o.dynamicProperties, o.reproductivecondition, o.cultivationstatus, o.establishmentmeans, '.
'o.ownerinstitutioncode, o.othercatalognumbers, o.disposition, o.informationwithheld, o.modified, o.observeruid, o.recordenteredby, o.dateentered, o.datelastmodified '.
'FROM omoccurrences o ';
*/
$sql = 'SELECT o.*, MAKEDATE(YEAR(o.eventDate),o.enddayofyear) AS eventdateend FROM omoccurrences o ';
if($this->occid) $sql .= 'WHERE (o.occid = '.$this->occid.')';
elseif($this->collid && $this->dbpk) $sql .= 'WHERE (o.collid = '.$this->collid.') AND (o.dbpk = "'.$this->dbpk.'")';
else{
34 changes: 23 additions & 11 deletions config/schema-1.0/dev/db_schema_patch-dev.sql
Original file line number Diff line number Diff line change
@@ -410,6 +410,7 @@ ALTER TABLE `omoccurdatasets`
CHANGE COLUMN `sortsequence` `sortSequence` INT(11) NULL DEFAULT NULL ,
CHANGE COLUMN `initialtimestamp` `initialTimestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ;


ALTER TABLE `omoccurdeterminations`
DROP FOREIGN KEY `FK_omoccurdets_idby`;

@@ -430,14 +431,25 @@ ALTER TABLE `omoccurdeterminations`
ADD COLUMN `taxonRank` VARCHAR(45) NULL AFTER `verbatimTaxonRank`,
ADD COLUMN `infraSpecificEpithet` VARCHAR(45) NULL AFTER `taxonRank`,
ADD COLUMN `securityStatus` INT NOT NULL DEFAULT 0 AFTER `appliedStatus`,
ADD COLUMN `securityStatusReason` VARCHAR(100) NULL AFTER `securityStatus`,
ADD COLUMN `identificationVerificationStatus` VARCHAR(45) NULL AFTER `taxonRemarks`,
ADD COLUMN `taxonConceptID` VARCHAR(45) NULL AFTER `scientificNameID`,
ADD COLUMN `taxonConceptID` VARCHAR(45) NULL AFTER `identificationVerificationStatus`,
ADD COLUMN `recordID` VARCHAR(45) NULL AFTER `sortSequence`,
CHANGE COLUMN `identifiedBy` `identifiedBy` VARCHAR(60) NOT NULL DEFAULT 'unknown' ,
CHANGE COLUMN `dateIdentified` `dateIdentified` VARCHAR(45) NOT NULL DEFAULT 's.d.' ,
CHANGE COLUMN `sourceIdentifier` `identificationID` VARCHAR(45) NULL DEFAULT NULL ,
ADD INDEX `FK_omoccurdets_agentID_idx` (`identifiedByAgentID` ASC);

ALTER TABLE `omoccurdeterminations`
CHANGE COLUMN `identifiedBy` `identifiedBy` VARCHAR(255) NOT NULL ,
CHANGE COLUMN `family` `family` VARCHAR(255) NULL DEFAULT NULL ,
CHANGE COLUMN `sciname` `sciname` VARCHAR(255) NOT NULL ,
CHANGE COLUMN `scientificNameAuthorship` `scientificNameAuthorship` VARCHAR(255) NULL DEFAULT NULL ,
CHANGE COLUMN `identificationQualifier` `identificationQualifier` VARCHAR(255) NULL DEFAULT NULL ,
CHANGE COLUMN `identificationReferences` `identificationReferences` VARCHAR(2000) NULL DEFAULT NULL ,
CHANGE COLUMN `identificationRemarks` `identificationRemarks` VARCHAR(2000) NULL DEFAULT NULL ,
CHANGE COLUMN `taxonRemarks` `taxonRemarks` VARCHAR(2000) NULL DEFAULT NULL;

ALTER TABLE `omoccurdeterminations`
ADD CONSTRAINT `FK_omoccurdets_agentID` FOREIGN KEY (`identifiedByAgentID`) REFERENCES `agents` (`agentID`) ON DELETE SET NULL ON UPDATE CASCADE;

@@ -463,7 +475,7 @@ FROM omoccurrences;
INSERT IGNORE INTO omoccurdeterminations(occid, identifiedBy, dateIdentified, family, sciname, verbatimIdentification, scientificNameAuthorship, tidInterpreted,
identificationQualifier, genus, specificEpithet, verbatimTaxonRank, infraSpecificEpithet, isCurrent, identificationReferences, identificationRemarks,
taxonRemarks)
SELECT o.occid, IFNULL(identifiedBy, "unknown"), IFNULL(dateIdentified, "s.d."), o.family, IFNULL(o.sciname, "undefined"), o.scientificName, o.scientificNameAuthorship, o.tidInterpreted,
SELECT o.occid, IFNULL(o.identifiedBy, "unknown"), IFNULL(o.dateIdentified, "s.d."), o.family, IFNULL(o.sciname, "undefined"), o.scientificName, o.scientificNameAuthorship, o.tidInterpreted,
o.identificationQualifier, o.genus, o.specificEpithet, o.taxonRank, o.infraSpecificEpithet, 1 as isCurrent, o.identificationReferences, o.identificationRemarks,
o.taxonRemarks
FROM omoccurrences o LEFT JOIN omoccurdeterminations d ON o.occid = d.occid
@@ -736,10 +748,6 @@ ALTER TABLE `taxalinks`
ALTER TABLE `taxalinks`
DROP INDEX `Index_unique` ;

ALTER TABLE `uploadspectemp`
ADD COLUMN `eventTime` VARCHAR(45) NULL AFTER `verbatimEventDate`,
CHANGE COLUMN `LatestDateCollected` `eventDate2` DATE NULL DEFAULT NULL AFTER `eventDate`;

ALTER TABLE `uploadspecparameters`
DROP FOREIGN KEY `FK_uploadspecparameters_coll`;

@@ -764,18 +772,22 @@ ALTER TABLE `uploadspecparameters`
ADD CONSTRAINT `FK_uploadspecparameters_coll` FOREIGN KEY (`collid`) REFERENCES `omcollections` (`collID`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `uploadspectemp`
ADD COLUMN `eventTime` VARCHAR(45) NULL AFTER `verbatimEventDate`,
ADD COLUMN `observeruid` INT NULL AFTER `language`,
ADD COLUMN `dateEntered` DATETIME NULL AFTER `recordEnteredBy`,
ADD COLUMN `eventID` VARCHAR(45) NULL AFTER `fieldnumber`,
CHANGE COLUMN `taxonRemarks` `taxonRemarks` VARCHAR(2000) NULL DEFAULT NULL ,
CHANGE COLUMN `identificationReferences` `identificationReferences` VARCHAR(2000) NULL DEFAULT NULL ,
CHANGE COLUMN `identificationRemarks` `identificationRemarks` VARCHAR(2000) NULL DEFAULT NULL ,
CHANGE COLUMN `establishmentMeans` `establishmentMeans` VARCHAR(150) NULL DEFAULT NULL,
CHANGE COLUMN `disposition` `disposition` varchar(250) NULL DEFAULT NULL,
ADD COLUMN `observeruid` INT NULL AFTER `language`,
ADD COLUMN `dateEntered` DATETIME NULL AFTER `recordEnteredBy`;

ALTER TABLE `uploadspectemp`
ADD COLUMN `eventID` VARCHAR(45) NULL AFTER `fieldnumber`;
CHANGE COLUMN `LatestDateCollected` `eventDate2` DATE NULL DEFAULT NULL AFTER `eventDate`;

ALTER TABLE `uploadspectemp`
DROP COLUMN `materialSampleID`,
ADD COLUMN `materialSampleJSON` TEXT NULL AFTER `paleoJSON`;


UPDATE userroles SET tablename = "fmprojects" WHERE tablename = "fmproject";


0 comments on commit 730beca

Please sign in to comment.