* preparation script, used only for changing reference to voucher
* @author Gabriele Droege, DNA Bank Network
* @version 2.0
* @package Search
* @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org
The contents of this file are subject to the Mozilla Public License Version 1.1
* @filesource
* @license http://www.mozilla.org/MPL/ MPL
*/
/********************************************************************************************
* saving specimen data *
* START *
*******************************************************************************************/
$variable1 = $_POST['formUnitID'][0];
$CatalogNoText = $_POST['CatalogNoText'][0];
$variable2 = $_POST['formSourceInstitutionID'][0];
$variable3 = $_POST['formSourceID'][0];
$variable4 = $_POST['formProviderExtern'][0];
$variable5 = $_POST['formTest'][0];
$variable6 = $_POST['formProviderIntern'][0];
if($variable1 != "" and !$formSubmitVerify)
{
if(!empty($variable4))
{
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT dataset.ID_Dataset AS ID_Dataset, " .
" schemata.QueryPart1b AS QueryPart1b, " .
" schemata.QueryPart1_1 AS QueryPart1_1, " .
" schemata.QueryPart1_2b AS QueryPart1_2b, " .
" schemata.QueryPart2 AS QueryPart2, " .
" schemata.QueryPart3 AS QueryPart3, " .
" schemata.QueryPart4 AS QueryPart4, " .
" schemata.QueryPart5 AS QueryPart5, " .
" provider.Provider AS Provider, " .
" dataset.Digir_Resource AS Digir_Resource, " .
" dataset.Digir_Source AS Digir_Source, " .
" provider.Provider AS Provider, " .
" provider.FK_Schema " .
" FROM dataset " .
" LEFT JOIN provider ON dataset.FK_Provider = provider.ID_Provider " .
" LEFT JOIN schemata ON provider.FK_Schema = schemata.ID_Schema " .
" WHERE dataset.ID_Dataset = '$variable4'");
}
if(!empty($variable6))
{
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT dataset.ID_Dataset AS ID_Dataset, " .
" schemata.QueryPart1b AS QueryPart1b, " .
" schemata.QueryPart1_1 AS QueryPart1_1, " .
" schemata.QueryPart1_2b AS QueryPart1_2b, " .
" schemata.QueryPart2 AS QueryPart2, " .
" schemata.QueryPart2a AS QueryPart2a, " .
" schemata.QueryPart3 AS QueryPart3, " .
" schemata.QueryPart4 AS QueryPart4, " .
" schemata.QueryPart5 AS QueryPart5, " .
" provider.Provider AS Provider, " .
" dataset.Digir_Resource AS Digir_Resource, " .
" dataset.Digir_Source AS Digir_Source, " .
" provider.Provider AS Provider, " .
" provider.FK_Schema " .
" FROM dataset " .
" LEFT JOIN provider ON dataset.FK_Provider = provider.ID_Provider " .
" LEFT JOIN schemata ON provider.FK_Schema = schemata.ID_Schema " .
" WHERE dataset.ID_Dataset = '$variable6'");
}
if(!empty($formProviderIntern) or !empty($formProviderExtern))
{
while($row = mysqli_fetch_object($result))
{
$ID_Dataset = $row->ID_Dataset;
$Provider = $row->Provider;
$QueryPart1b = $row->QueryPart1b;
$QueryPart1_1 = $row->QueryPart1_1;
$QueryPart1_2b = $row->QueryPart1_2b;
$QueryPart2 = $row->QueryPart2;
$QueryPart2a = $row->QueryPart2a;
$QueryPart3 = $row->QueryPart3;
$QueryPart4 = $row->QueryPart4;
$QueryPart5 = $row->QueryPart5;
$Digir_Resource = $row->Digir_Resource;
$Digir_Source = $row->Digir_Source;
$ID_Schema = $row->FK_Schema;
}
$SourceUnitID = urlencode($variable1);
$SourceInstitutionCode = urlencode($variable2);
$SourceCode = urlencode($variable3);
$Digir_Resource1 = urlencode($Digir_Resource);
$Digir_Source1 = urlencode($Digir_Source);
}
if($formSpecimenNumber != "")
{
if($variable6 != '')
{$test1 = 'true'; }
if($variable4 != '1' and $variable4 != '')
{$test2 = 'true'; }
if($test1 == 'true' or $test2 == 'true')
{
if($ID_Schema == 3 and $CatalogNoText[$mykey] == "True")
{
$file = $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."CatalogNumberText%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumberText".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5; }
if($ID_Schema == 3 and $CatalogNoText[$mykey] != "True")
{
$file = $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."CatalogNumber%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumber".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5; }
if($ID_Schema != 3) {
$file = $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b.$SourceUnitID.$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5; }
//echo $file;
$dom = new DOMDocument();
$dom->Load($file);
if($ID_Schema == 1) {
/**
* calling specific script for saving data in ABCD1.2 format
*/
include ("../input/Save_ABCD1.2.php");}
if($ID_Schema == 2) {
/**
* calling specific script for saving data in ABCD2.06 format
*/
include ("../input/Save_ABCD2.06.php");}
if($ID_Schema == 3 or $ID_Schema == 6) {
/**
* calling specific script for saving data in DarwinCore format
*/
include ("../input/Save_DarwinCore.php");}
if($ID_Schema == 4) {
/**
* calling specific script for saving data in ABCD2.05 format
*/
include ("../input/Save_ABCD2.05.php");}
}
}
if(empty($formUnitID[0]) and $ID_Dataset != '')
{ echo "No hits. Please verify your entry and selection of specimen database. DNA data have not been saved!";}
if($formTest[0] != "")
{ echo "Please select a specimen or verify your entry!";}
}
if(empty($formTest[0])) {
if($formSpecimenNumber!="")
{
if($formProviderIntern!="" or $formProviderExtern!="")
{
/**
* include separate script for saving the final specimen data
*/
include ("Save_New_Specimen_Step2.php"); } }
if($error == "true")
{ $msg = "####Error in Save_Specimen.php####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
/*******************************************************************************************
* saving specimen data *
* END *
*******************************************************************************************/
}
?>