Sorry, as a guest you don't have permission for entering new DNA data! If you want to search for existing DNA data please use the Search function! |
"; }
else {
if($formProviderIntern and $formProviderIntern != "2") { $IDDataset = $formProviderIntern; }
if($formProviderExtern) { $IDDataset = $formProviderExtern; }
if($formProviderIntern == "2") { $IDDataset = $ID_Dataset; } //see Save_GBIF.php
/********************************************************************************************
* at first, check if specimen data are already in cache tables *
* if so, count how many DNA samples are connected to this record already *
********************************************************************************************/
$test = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Cache FROM cachecollection " .
"WHERE UnitID_Specimen = '$sqlUnitID' " .
" AND CollectionCode_Specimen = '$sqlSourceName' " .
" AND InstitutionCode_Specimen = '$sqlSourceInstitutionCode' " .
" AND FK_Dataset_Specimen = '$IDDataset'");
while ($row = mysqli_fetch_object($test))
{ $ID_Cache = $row->ID_Cache; }
$test2 = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_TaxonIdentified, NameAuthorYear FROM cachetaxonidentified WHERE FK_Cache = '$ID_Cache'");
while ($row = mysqli_fetch_object($test2))
{ $View = $row->NameAuthorYear; }
if(mysqli_num_rows($test))
{$IDTableCache = $ID_Cache;
$Exist = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_DNA, DNA_Bank_Number FROM dnabanknumbers " .
"WHERE FK_Cache = '$IDTableCache'");
$count = mysqli_num_rows($Exist);
$Specimen_Saved = "true";
}
if(!mysqli_num_rows($test))
{
if(isset($Identifications) or $formProviderIntern == "2")
{
/********************************************************************************************
* first table to fill is cachecollection *
********************************************************************************************/
$sql4 = "INSERT INTO cachecollection (UnitID_Specimen, CollectionCode_Specimen, InstitutionCode_Specimen, ContinentOrOcean, CountryName, CountryISO2, Collectors, CollectionDate, CollectionDateMin, CollectionDateMax, CollectorsNo, Locality, Longitude, Latitude, Altitude, CollectionInfo_Other, FK_Dataset_Specimen, GUID_Specimen, Created_Who) VALUES
('$sqlUnitID','$sqlSourceName','$sqlSourceInstitutionCode','$sqlContinentOrOcean','$sqlCountryName','$sqlISO2','$sqlPersonName','$sqlCollectionDate','$sqlCollectionDateMin','$sqlCollectionDateMax','$sqlCollectorsNo','$sqlLocality','$sqlLongitude','$sqlLatitude','$sqlAltitude','$sqlGatheringOther','$IDDataset','$sqlUnitGUID','$log')";
$result4 = mysqli_query($GLOBALS["___mysqli_ston"], $sql4);
$IDTableCache=((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
###############################################Error 4####################################################
if(!$result4)
{
$msg = $sql4."\n";
$msg .= "####Error 4####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
#########################################################################################################
if(isset($Identifications)) {
foreach ($Identifications as $IndexIdentification => $Identification) {
/********************************************************************************************
* for each identification tag entering one row in cachetaxonidentified *
********************************************************************************************/
$Genus = $sqlGenus[$IndexIdentification];
$Subgenus = $sqlSubgenus[$IndexIdentification];
$FirstEpithet = $sqlFirstEpithet[$IndexIdentification];
$SecondEpithet = $sqlSecondEpithet[$IndexIdentification];
$Rank = $sqlRank[$IndexIdentification];
$HybridFlag = $sqlHybridFlag[$IndexIdentification];
$NameAuthorYear = $sqlNameAuthorYearString[$IndexIdentification];
$Name_All = $sqlName_All[$IndexIdentification];
$PreferredFlag = $sqlPreferredIdentificationFlag[$IndexIdentification];
$sql5 = "INSERT INTO cachetaxonidentified (FK_Cache, Genus, Subgenus, FirstEpithet, SecondEpithet, Rank, HybridFlag, NameAuthorYear, Other, PreferredFlag, Created_Who) VALUES ('$IDTableCache','$Genus','$Subgenus','$FirstEpithet','$SecondEpithet','$Rank','$HybridFlag','$NameAuthorYear','$Name_All','$PreferredFlag','$log')";
$result5 = mysqli_query($GLOBALS["___mysqli_ston"], $sql5);
$IDTableCacheTaxonIdentified=((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
#################################################Error 5################################################
if(!$result5)
{ $msg = $sql5."\n";
$msg .= "####Error 5####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
########################################################################################################
if(isset($HigherTaxa)) {
foreach ($HigherTaxa as $index => $HigherTaxon) { // more than one HigherTaxon per Identification possible
/********************************************************************************************
* for each identification tag and higher taxon tag entering one row in cachehighertaxa *
********************************************************************************************/
$TaxonHigher = $sqlHigherTaxon[$index];
$RankHigher = $sqlHigherTaxonRank[$index];
$sql6 = "INSERT INTO cachehighertaxa (FK_CacheTaxonIdentified, HigherTaxon, TaxonRank, Created_Who) VALUES ('$IDTableCacheTaxonIdentified','$TaxonHigher','$RankHigher','$log')";
$result6 = mysqli_query($GLOBALS["___mysqli_ston"], $sql6);
#################################################Error 6################################################
if(!$result6)
{ $msg = $sql6."\n";
$msg .= "####Error 6####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
########################################################################################################
}
}} }
else { // GBIF record (no arrays)
$Genus = $sqlGenus;
$FirstEpithet = $sqlFirstEpithet;
$SecondEpithet = $sqlSecondEpithet;
$Rank = $sqlRank;
$NameAuthorYear = $sqlNameAuthorYearString;
$PreferredFlag = $sqlPreferredIdentificationFlag;
$sql5 = "INSERT INTO cachetaxonidentified (FK_Cache, Genus, FirstEpithet, SecondEpithet, Rank, NameAuthorYear, PreferredFlag, Created_Who) VALUES ('$IDTableCache','$Genus','$FirstEpithet','$SecondEpithet','$Rank','$NameAuthorYear','$PreferredFlag','$log')";
$result5 = mysqli_query($GLOBALS["___mysqli_ston"], $sql5);
$IDTableCacheTaxonIdentified=((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
#################################################Error 5################################################
if(!$result5)
{ $msg = $sql5."\n";
$msg .= "####Error 5####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
########################################################################################################
if(isset($sqlHigherTaxon)) {
$TaxonHigher = $sqlHigherTaxon;
$RankHigher = $sqlHigherTaxonRank;
$sql6 = "INSERT INTO cachehighertaxa (FK_CacheTaxonIdentified, HigherTaxon, TaxonRank, Created_Who) VALUES ('$IDTableCacheTaxonIdentified','$TaxonHigher','$RankHigher','$log')";
$result6 = mysqli_query($GLOBALS["___mysqli_ston"], $sql6);
#################################################Error 6################################################
if(!$result6)
{ $msg = $sql6."\n";
$msg .= "####Error 6####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
########################################################################################################
}
} // // GBIF record (no arrays)
if(isset($sqlFileURI))
{
foreach ($sqlFileURI as $MultiMediaObject)
{
/*********************************************************************************************
* for each multimedia tag entering one row in cachemultimedia *
*********************************************************************************************/
$sql7 = "INSERT INTO cachemultimedia (FK_Cache, Multimedia, Created_Who) VALUES ('$IDTableCache','$MultiMediaObject','$log')";
$result7 = mysqli_query($GLOBALS["___mysqli_ston"], $sql7);
#######################################Error 7###############################################################
if(!$result7)
{ $msg = $sql7."\n";
$msg .= "####Error 7####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
#############################################################################################################
}
if(empty($sqlFileURI)) {
foreach ($sqlProductURI as $MultiMediaObject)
{
$sql8= "INSERT INTO cachemultimedia (FK_Cache, Multimedia, Created_Who) VALUES ('$IDTableCache','$MultiMediaObject','$log')";
$result8 = mysqli_query($GLOBALS["___mysqli_ston"], $sql8);
#######################################Error 8###############################################################
if(!$result8)
{ $msg = $sql8."\n";
$msg .= "####Error 8####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
#############################################################################################################
} }
} //if(isset($sqlFileURI))
if(isset($sqlAssUnitID))
{
foreach ($sqlAssUnitID as $index => $AssociatedUnitID)
{
/*********************************************************************************************
* for each UnitAssociation tag entering one row in cacheassociatedunits *
*********************************************************************************************/
$AssociatedInstitutionCode = $sqlAssInstCode[$index];
$AssociatedCollectionCode = $sqlAssCollCode[$index];
$AssociatedType = $sqlAssType[$index];
$AssociatedURL = $sqlAssURL[$index];
$sqlAssociations = "INSERT INTO cacheassociatedunits (FK_Cache, AssociatedUnitID, AssociatedInstitutionCode, AssociatedCollectionCode, AssociationType, WrapperUrl, Created_Who) VALUES ('$IDTableCache','$AssociatedUnitID','$AssociatedInstitutionCode','$AssociatedCollectionCode','$AssociatedType','$AssociatedURL','$log')";
$resultAssociations = mysqli_query($GLOBALS["___mysqli_ston"], $sqlAssociations);
#######################################Error Associations####################################################
if(!$resultAssociations)
{ $msg = $sqlAssociations."\n";
$msg .= "####Error Associations####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
#############################################################################################################
}} //if(isset($sqlAssUnitID))
if($result4) { $Specimen_Saved = "true"; }
}
else {
$sql7 = "INSERT INTO cachecollection (UnitID_Specimen, CollectionCode_Specimen, InstitutionCode_Specimen, ContinentOrOcean, CountryName, Collectors, CollectionDate, CollectionDateMin, CollectionDateMax, CollectorsNo, Locality, Longitude, Latitude, Altitude, FK_Dataset_Specimen, Created_Who) VALUES ('$sqlUnitID','$sqlSourceName','$sqlSourceInstitutionCode','$sqlContinentOrOcean','$sqlCountryName','$sqlPersonName','$sqlCollectionDate','$sqlCollectionDateMin','$sqlCollectionDateMax','$sqlCollectorsNo','$sqlLocality','$sqlLongitude','$sqlLatitude','$sqlAltitude','$IDDataset','$log')";
$result7 = mysqli_query($GLOBALS["___mysqli_ston"], $sql7);
$IDTableCache=((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
#######################################Error 7###############################################################
if(!$result7)
{ $msg = $sql7."\n";
$msg .= "####Error 7####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
#############################################################################################################
if($result7)
{
$sql8 = "INSERT INTO cachetaxonidentified (FK_Cache, Genus, Subgenus, FirstEpithet, SecondEpithet, Rank, NameAuthorYear, Created_Who) VALUES ('$IDTableCache','$sqlGenus','$sqlSubgenus','$sqlFirstEpithet','$sqlSecondEpithet','$sqlRank','$sqlNameAuthorYearString','$log')";
$result8 = mysqli_query($GLOBALS["___mysqli_ston"], $sql8);
######################################################Error 8###########################################
if(!$result8)
{ $msg = $sql8."\n";
$msg .= "####Error 8####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
########################################################################################################
$IDTableCacheTaxonIdentified=((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
if(isset($sqlHigherTaxon)) {
foreach ($sqlHigherTaxon as $index => $HigherTaxa) { // more than one HigherTaxon per Identification possible
if(!empty($sqlHigherTaxon[$index])) {
$TaxonHigher = $sqlHigherTaxon[$index];
$RankHigher = $sqlHigherTaxonRank[$index];
$sql9 = "INSERT INTO cachehighertaxa (FK_CacheTaxonIdentified, HigherTaxon, TaxonRank, Created_Who) VALUES ('$IDTableCacheTaxonIdentified','$TaxonHigher','$RankHigher','$log')";
$result9 = mysqli_query($GLOBALS["___mysqli_ston"], $sql9);
########################################################Error 9###########################################
if(!$result9)
{ $msg = $sql9."\n";
$msg .= "####Error 9####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
##########################################################################################################
} } }
if(isset($sqlFileURI))
{
foreach ($sqlFileURI as $MultiMediaObject)
{
$sql10 = "INSERT INTO cachemultimedia (FK_Cache, Multimedia, Created_Who) VALUES ('$IDTableCache','$MultiMediaObject','$log')";
$result10 = mysqli_query($GLOBALS["___mysqli_ston"], $sql10);
#######################################Error 10###############################################################
if(!$result10)
{ $msg = $sql10."\n";
$msg .= "####Error 10####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
#############################################################################################################
}
if(empty($sqlFileURI))
{
foreach ($sqlProductURI as $MultiMediaObject)
{
$sql11= "INSERT INTO cachemultimedia (FK_Cache, Multimedia, Created_Who) VALUES ('$IDTableCache','$MultiMediaObject','$log')";
$result11 = mysqli_query($GLOBALS["___mysqli_ston"], $sql11);
#######################################Error 11###############################################################
if(!$result11)
{ $msg = $sql11."\n";
$msg .= "####Error 11####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
#############################################################################################################
} } }
} }
}
}
?>