Please select either decimal or sexagesimal type! Data have not been saved!
"; }
if($formLatitude != "" and $formLatitude1 != "")
{ $Validation = "FALSE";
$EntryCheck == "true";
echo "Please select either decimal or sexagesimal type! Data have not been saved!
"; }
if($Sp_formInstitutionCode == "")
{ $Validation = "FALSE";
$EntryCheck == "true";
echo "Please enter an institution code! Data have not been saved!
"; }
if($Sp_formCollectionCode == "")
{ $Validation = "FALSE";
$EntryCheck == "true";
echo "Please enter a collection code! Data have not been saved!
"; }
if($formGUID == "" and $Sp_formSpecimenNumber == "")
{ $Validation = "FALSE";
$EntryCheck == "true";
echo "Please enter a specimen number or select GUID checkbox! Data have not been saved!
"; }
/*if($formPrepDate == "YYYY-MM-DD" or $formPrepDate == "") { unset($formPrepDate); }
else { $date = $formPrepDate;
if (!valiDate($date)) {
$Validation = "FALSE";
$EntryCheck == "true";
echo '"Preparation date" incorrect!
'; }
else { $formPrepDate = $formPrepDate; } } */
if($formCollectionDateMin == "YYYY-MM-DD" or $formCollectionDateMin == "") { unset($formCollectionDateMin); }
else { $date = $formCollectionDateMin;
if (!valiDate($date) and $formCollectionDateMin != "unknown" and $formCollectionDateMin != "s.d.") {
$Validation = "FALSE";
$EntryCheck == "true";
echo '"Collection date from" incorrect!
'; }
else { $formCollectionDateMin = $formCollectionDateMin; } }
if($formCollectionDateMax == "YYYY-MM-DD" or $formCollectionDateMax == "") { unset($formCollectionDateMax); }
else { $date = $formCollectionDateMax;
if (!valiDate($date)) {
$Validation = "FALSE";
$EntryCheck == "true";
echo '"Collection date to" incorrect!
'; }
else { $formCollectionDateMax = $formCollectionDateMax; } }
if($Validation != "FALSE") {
if($radioPreferred == 'taxa1')
{$PreferredFlag1 = '1'; }
if($radioPreferred != 'taxa1')
{$PreferredFlag1 = '0'; }
if($radioPreferred == 'taxa2')
{$PreferredFlag2 = '1'; }
if($radioPreferred != 'taxa2')
{$PreferredFlag2 = '0'; }
if($radioPreferred == 'taxa3')
{$PreferredFlag3 = '1'; }
if($radioPreferred != 'taxa3')
{$PreferredFlag3 = '0'; }
if($radioPreferred == 'taxa4')
{$PreferredFlag4 = '1'; }
if($radioPreferred != 'taxa4')
{$PreferredFlag4 = '0'; }
if($Sp_formSpecimenNumber != "")
{
$Exist = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Collection FROM sptoolcollection " .
"WHERE UnitID_Specimen = '$Sp_formSpecimenNumber' " .
" AND InstitutionCode_Specimen = '$Sp_formInstitutionCode' " .
" AND CollectionCode_Specimen = '$Sp_formCollectionCode'");
if(mysqli_affected_rows($GLOBALS["___mysqli_ston"]))
{ echo "This specimen/sample already exist in database! Please check your entry:
Specimen Number: ".$Sp_formSpecimenNumber." Institution Code: ".$Sp_formInstitutionCode." Collection Code: ".$Sp_formCollectionCode."
";
$EntryCheck = "true";
$CheckCopy = "true";} }
if(!mysqli_affected_rows($GLOBALS["___mysqli_ston"]))
{
$Locality = "";
if($formRegion != "")
{ $Locality .= $formRegion.", "; }
if($formLocality != "")
{ $Locality .= $formLocality; }
include("addslashes_sptoolcollection.php");
if(empty($formDepthMin) and empty($formDepthMax)) { unset($formDepthUnit); }
if(empty($formAltitudeMin) and empty($formAltitudeMax)) { unset($formAltitudeUnit); }
/*-- Select year from Collection Date ----------------#
# #
# #
# #
#-----------------------------------------------------*/
for ($i = 1500; $i < 2100; $i++) {
if(substr($sqlCollectionDateMin, 0, -6) == $i)
{$CollectionYear = $i; }}
/*-- End of "Select year from Collection Date" -------#
# #
# #
# #
#-----------------------------------------------------*/
$sql1 = "INSERT INTO sptoolcollection (UnitID_Specimen, InstitutionCode_Specimen, CollectionCode_Specimen, ExpeditionDetails, FK_BiogeographicRegion, FK_Country, FK_SeasAndOceans, Region, Locality, Locality_ID, Habitat, FK_SoilTexture, FK_SoilpH, FK_HabitatCode, FK_LandUseCode, FK_Slope, FK_Aspect, DepthAccuracyStatement, DepthMin, DepthMax, DepthUnit, DepthMethod, DepthRaw, GeodeticDatum, FK_GeocodeMethod, CoordinatesAccuracyStatement, CoordinatesErrorDistance, LongitudeMin, LongitudeMax, LatitudeMin, LatitudeMax, LongitudeRaw, LatitudeRaw, AltitudeAccuracyStatement, AltitudeMin, AltitudeMax, AltitudeUnit, AltitudeMethod, AltitudeRaw, CollectionDateMin, CollectionDateMax, CollectionYear, Collectors, CollectorsNo, CollectionNotes, CollectionMethod, FK_Sex, FK_BasisOfRecord, FK_KindOfUnit, FK_PrepType, PrepDate, FK_PrepStaff, PrepMaterials, PrepProcess, FK_AcquiredFrom, EscapedCoordinates, Permission, Blocked_Until, Blocked_For_Loaning, Blocked_For_Publishing, Loan_Conditions, FK_Type, TypeDesignation, Notes, Notes_Internal, AccessionNo, AccessionName, LifeStage, LifeForm, SampleGroup, GUID, FK_Strat_Series, Qualifier_Series, FK_Strat_Stage, Qualifier_Stage, FossilZone, Formation, SectionDetails, SpecimenDetails, FK_ParentID_Collection, FK_RelationToParent, Created_Who) " .
"VALUES ('$sqlSpecimenNumber','$sqlInstitutionCode','$sqlCollectionCode','$sqlExpedition',$formBiogeoRegion,$formCountry,$formOcean,'$sqlRegion','$sqlLocality','$sqlLocalityID','$sqlHabitat',$formSoilTexture,$formSoilpH,$formHabitatCode,$formLandUseCode,$formSlope,$formAspect,'$sqlDepthAccuracy',$sqlDepthMin2,$sqlDepthMax2,'$sqlDepthUnit','$sqlDepthMethod','$sqlDepthRaw','$sqlGeoDatum',$formGeoMethod,'$sqlCoordinatesAccuracy','$sqlErrorDistance',$sqlLongitudeMin2,$sqlLongitudeMax2,$sqlLatitudeMin2,$sqlLatitudeMax2,'$sqlLongitudeRaw','$sqlLatitudeRaw','$sqlAltitudeAccuracy',$sqlAltitudeMin2,$sqlAltitudeMax2,'$sqlAltitudeUnit','$sqlAltitudeMethod','$sqlAltitudeRaw',$sqlCollectionDateMin,$sqlCollectionDateMax,'$CollectionYear','$sqlCollector','$sqlCollectorsNo','$sqlCollectionNotes','$sqlCollectionMethod',$formSex,$formBasisOfRecord,$formKindOfUnit,$formPrepType,$sqlPrepDate,$formPrepStaff,'$sqlPrepMaterials','$sqlPrepProcess',$formAcquiredFrom,'$radioProtect','$radioPermission',$sqlBlockDate,$formBlockLoan,$formBlockPublish,'$sqlLoanConditions',$formType,'$sqlTypeDesignation','$sqlNotes','$sqlNotesInternal','$sqlAccNo','$sqlAccName','$sqlLifeStage','$sqlLifeForm','$sqlSampleGroup','$GUID',$formSeries,'$sqlQualifierSeries',$formStage,'$sqlQualifierStage','$sqlFossilZone','$sqlFormation','$sqlSectionDetails','$sqlSpecimenDetails',$formParentFK,$formRelation,'$log')";
$result1 = mysqli_query($GLOBALS["___mysqli_ston"], $sql1);
$IDsptoolCollection = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
if($sqlUnitIDAssoc != "")
{
$sql1a = "INSERT INTO sptoolassociatedunits (UnitID_Main, CollectionCode_Main, InstitutionCode_Main, RelationToMainUnit, UnitID, CollectionCode, InstitutionCode, KindOfUnit, FK_BasisOfRecord, FK_Dataset, Notes, Created_Who) VALUES ('$sqlSpecimenNumber','$sqlInstitutionCode','$sqlCollectionCode','Main Unit','$sqlUnitIDAssoc1','$sqlCollCodeAssoc1','$sqlInstCodeAssoc1','$sqlKindOfUnitAssoc1',$formBasisOfRecordAssoc1,$formProviderAssoc1, '$sqlNotesAssoc1', '$log')";
$result1a = mysqli_query($GLOBALS["___mysqli_ston"], $sql1a); }
$NameAuthorYear1 = "";
if($formIdentQualifier1 and $formQualifierBelongs1 == "Genus") { $NameAuthorYear1 .= $formIdentQualifier1." "; }
if($formGenus1) { $NameAuthorYear1 .= $formGenus1; }
if($formSubgenus1) { $NameAuthorYear1 .= " (".$formSubgenus1.")"; }
if($formIdentQualifier1 and $formQualifierBelongs1 == "First Epithet") { $NameAuthorYear1 .= " ".$formIdentQualifier1." "; }
if($formSpecificEpithet1) { $NameAuthorYear1 .= " ".$formSpecificEpithet1; }
if($formRank1) { $NameAuthorYear1 .= " ".$formRank1; }
if($formIdentQualifier1 and $formQualifierBelongs1 == "Second Epithet") { $NameAuthorYear1 .= " ".$formIdentQualifier1." "; }
if($formInfraspecificEpithet1) { $NameAuthorYear1 .= " ".$formInfraspecificEpithet1; }
if($formAuthorParenth1) { $NameAuthorYear1 .= " (".$formAuthorParenth1; }
if($formAuthorYearParenth1) { $NameAuthorYear1 .= ", ".$formAuthorYearParenth1; }
if($formAuthorParenth1) { $NameAuthorYear1 .= ")"; }
if($formAuthor1) { $NameAuthorYear1 .= " ".$formAuthor1; }
if($formAuthorYear1) { $NameAuthorYear1 .= ", ".$formAuthorYear1; }
if($formBreedCultivar1) { $NameAuthorYear1 .= " '".$formBreedCultivar1."'"; }
if($formNameAddendum1) { $NameAuthorYear1 .= " ".$formNameAddendum1; }
#######################################Error 1###############################################################
if(!$result1)
{ $msg = $sql1."\n";
$msg .= "####Error 1####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
}
##################################Identification No. 1#################################################################
if($result1)
{
include("addmultimedia.php");
include("addvoucherref.php");
$sqlIdentQualifier1 = addslashes($formIdentQualifier1);
$sqlQualifierBelongs1 = addslashes($formQualifierBelongs1);
$sqlGenus1 = addslashes($formGenus1);
$sqlSubgenus1 = addslashes($formSubgenus1);
$sqlSpecificEpithet1 = addslashes($formSpecificEpithet1);
$sqlInfraspecificEpithet1 = addslashes($formInfraspecificEpithet1);
$sqlNameAddendum1 = addslashes($formNameAddendum1);
$sqlBreedCultivar1 = addslashes($formBreedCultivar1);
$sqlAuthor1 = addslashes($formAuthor1);
$sqlAuthorYear1 = addslashes($formAuthorYear1);
$sqlAuthorParenth1 = addslashes($formAuthorParenth1);
$sqlAuthorYearParenth1 = addslashes($formAuthorYearParenth1);
$sqlNameAuthorYear1 = addslashes($NameAuthorYear1);
$sqlIdentifier1 = addslashes($formIdentifier1);
$sqlIdentDate1 = addslashes($formIdentificationDate1);
$sqlIdentNotes1 = addslashes($formIdentNotes1);
if($NameAuthorYear1 != "") {
$sql2 = "INSERT INTO sptooltaxa (FK_Collection, Qualifier, QualifierBelongsTo, Genus, Subgenus, SpecificEpithet, AuthorParenth, YearParenth, Author, Year, Rank, InfraspecificEpithet, BreedCultivar, NameAddendum, NameAuthorYear, KindOfIdentification, Identifier, IdentificationDate, PreferredFlag, IdentificationNotes, Created_Who)" .
"VALUES ('$IDsptoolCollection','$sqlIdentQualifier1','$sqlQualifierBelongs1','$sqlGenus1','$sqlSubgenus1','$sqlSpecificEpithet1','$sqlAuthorParenth1','$sqlAuthorYearParenth1','$sqlAuthor1','$sqlAuthorYear1','$formRank1','$sqlInfraspecificEpithet1','$sqlBreedCultivar1','$sqlNameAddendum1','$sqlNameAuthorYear1','$formIdentType1','$sqlIdentifier1','$sqlIdentDate1','$PreferredFlag1','$sqlIdentNotes1','$log')";
$result2 = mysqli_query($GLOBALS["___mysqli_ston"], $sql2);
$IDsptoolTaxa1 = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res); }
}
#######################################Error 2###############################################################
if(!$result2 and $NameAuthorYear1 != "")
{ $msg = $sql2."\n";
$msg .= "####Error 2####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$delete = mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM sptoolcollection WHERE ID_Collection = '$IDsptoolCollection'");
$ERROR_Event = true; }
#############################################################################################################
if($result2)
{
foreach($_POST['formHigherTaxon1'] as $index2 => $HigherTaxaFree1)
{
if(!empty($HigherTaxaFree1)) {
$Rank1 = $_POST['hiddenHigherTaxon1'][$index2];
$sql3 = "INSERT INTO sptoolhighertaxon (FK_TaxonIdentified, HigherTaxon, TaxonRank, Created_Who) " .
"VALUES ('$IDsptoolTaxa1','$HigherTaxaFree1','$Rank1','$log')";
$result3 = mysqli_query($GLOBALS["___mysqli_ston"], $sql3);
#######################################Error 3###############################################################
if(!$result3 and $Rank1 != "")
{ $msg = $sql3."\n";
$msg .= "####Error 3####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$delete1 = mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM sptoolcollection WHERE ID_Collection = '$IDsptoolCollection'");
$delete2 = mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM sptooltaxa WHERE FK_Collection = '$IDsptoolCollection'"); }
#############################################################################################################
}
}
} //if($result2)
include("addfurtheridentifications.php");
if($result1) {
//start Ecological parameters
foreach ($_POST['formValue'] as $index => $Value)
{
$Unit = $_POST['formUnit'][$index];
$Parameter = $_POST['formParameter'][$index];
$Method = $_POST['formMethod'][$index];
if($Value=="")
{ unset($Value);
unset($Unit);
unset($Parameter);
unset($Method); }
else {
$sqlEcology = "INSERT INTO sptoolmeasurementorfact (FK_Collection, Value, Unit, Parameter, Method, Rank, Created_Who) " .
"VALUES ('$IDsptoolCollection','$Value','$Unit','$Parameter','$Method','Ecology','$log')";
$resultEcology = mysqli_query($GLOBALS["___mysqli_ston"], $sqlEcology);
#######################################Error sqlEcology###############################################################
if(!$resultEcology)
{ $msg = $sqlEcology."\n";
$msg .= "####Error sqlEcology####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php"); }
#############################################################################################################
} // foreach ($_POST['formValue'] as $index => $Value)
}
//end Ecological parameters
//start Morphological parameters
foreach ($_POST['formValueM'] as $index => $Value)
{
$Unit = $_POST['formUnitM'][$index];
$Parameter = $_POST['formParameterM'][$index];
$Method = $_POST['formMethodM'][$index];
if($Value=="")
{ unset($Value);
unset($Unit);
unset($Parameter);
unset($Method); }
else {
$sqlEcology = "INSERT INTO sptoolmeasurementorfact (FK_Collection, Value, Unit, Parameter, Method, Rank, Created_Who) " .
"VALUES ('$IDsptoolCollection','$Value','$Unit','$Parameter','$Method','Morphology','$log')";
$resultEcology = mysqli_query($GLOBALS["___mysqli_ston"], $sqlEcology);
#######################################Error sqlEcology###############################################################
if(!$resultEcology)
{ $msg = $sqlEcology."\n";
$msg .= "####Error sqlEcology####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php"); }
#############################################################################################################
} // foreach ($_POST['formValueM'] as $index => $Value)
}
//end Morphological parameters
if($AddHost != "") {
include("addhost.php"); }
//start genetic accession numbers
if (!isset($moreGenBank))
{ unset($formGeneticLocusA);
unset($formGenbankNumberA);
unset($formSampleIDA);
unset($boldA);
unset($formGeneticLocusB);
unset($formGenbankNumberB);
unset($formSampleIDB);
unset($boldB);
unset($formGeneticLocusC);
unset($formGenbankNumberC);
unset($formSampleIDC);
unset($boldC);
unset($formGeneticLocusD);
unset($formGenbankNumberD);
unset($formSampleIDD);
unset($boldD);
unset($formGeneticLocusE);
unset($formGenbankNumberE);
unset($formSampleIDE);
unset($boldE);
}
else {
if($formGenBankNumberA)
{
$sql = "INSERT INTO sptoolgeneticaccessions (FK_Collection, FK_GeneticLocus, GenBankNumber, SampleID, BOLD, Created_Who)" .
"VALUES ('$IDsptoolCollection','$formGeneticLocusA','$sqlGenBankNumberA','$sqlSampleIDA','$boldA','$log')";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
#######################################Error formGenbankNumberA###############################################################
if(!$result)
{ $msg = $sql."\n";
$msg .= "####Error formGenbankNumberA####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
#############################################################################################################
}
if($formGenBankNumberB)
{
$sql = "INSERT INTO sptoolgeneticaccessions (FK_Collection, FK_GeneticLocus, GenBankNumber, SampleID, BOLD, Created_Who)" .
"VALUES ('$IDsptoolCollection','$formGeneticLocusB','$sqlGenBankNumberB','$sqlSampleIDB','$boldB','$log')";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
#######################################Error formGenbankNumberB###############################################################
if(!$result)
{ $msg = $sql."\n";
$msg .= "####Error formGenbankNumberB####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
#############################################################################################################
}
if($formGenBankNumberC)
{
$sql = "INSERT INTO sptoolgeneticaccessions (FK_Collection, FK_GeneticLocus, GenBankNumber, SampleID, BOLD, Created_Who)" .
"VALUES ('$IDsptoolCollection','$formGeneticLocusC','$sqlGenBankNumberC','$sqlSampleIDC','$boldC','$log')";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
#######################################Error formGenbankNumberC###############################################################
if(!$result)
{ $msg = $sql."\n";
$msg .= "####Error formGenbankNumberC####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
#############################################################################################################
}
if($formGenBankNumberD)
{
$sql = "INSERT INTO sptoolgeneticaccessions (FK_Collection, FK_GeneticLocus, GenBankNumber, SampleID, BOLD, Created_Who)" .
"VALUES ('$IDsptoolCollection','$formGeneticLocusD','$sqlGenBankNumberD','$sqlSampleIDD','$boldD','$log')";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
#######################################Error formGenbankNumberD###############################################################
if(!$result)
{ $msg = $sql."\n";
$msg .= "####Error formGenbankNumberD####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
#############################################################################################################
}
if($formGenBankNumberE)
{
$sql = "INSERT INTO sptoolgeneticaccessions (FK_Collection, FK_GeneticLocus, GenBankNumber, SampleID, BOLD, Created_Who)" .
"VALUES ('$IDsptoolCollection','$formGeneticLocusE','$sqlGenBankNumberE','$sqlSampleIDE','$boldE','$log')";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
#######################################Error formGenbankNumberE###############################################################
if(!$result)
{ $msg = $sql."\n";
$msg .= "####Error formGenbankNumberE####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
#############################################################################################################
}
//end genetic accession numbers
}
}
} //else
}
if ($result1 and $ERROR_Event != "true")
{include("../config/RecordHasBeenSaved.php");
echo "Specimen Number: ".$sqlSpecimenNumber."
Institution Code: ".$sqlInstitutionCode."
Collection Code: ".$sqlCollectionCode."
Taxon Name: ".$NameAuthorYear1."
".build_href_blank("query_sptool.php", "sqlType=Detail&ID_Collection=".$IDsptoolCollection, "Show this record (opens in new tab)"); }
}//if ($formSubmitSave)
}
?>