Source for file query_clean.php

Documentation is available at query_clean.php

  1. <?php
  2. /**
  3. * Data Cleaning query
  4. @author Gabriele Droege, DNA Bank Network <contact@dnabank-network.org>
  5. @version 2.0
  6. @package Data_Cleaning
  7. @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org<br>The contents of this file are subject to the Mozilla Public License Version 1.1
  8. @filesource
  9. @license http://www.mozilla.org/MPL/ MPL
  10. */
  11.  
  12.     /**
  13.     * calling connection to database
  14.     */
  15.     include ("../config/head.php");
  16.  
  17.     /**
  18.     * calling authorisation script
  19.     */
  20.     include ("../auth.php");
  21.  
  22.     /********************************************************************************************
  23.     * Setting cookies after submitting search query                                             *
  24.     *********************************************************************************************/
  25.     
  26.     if($formSubmitSearch)
  27.     {setcookie("formSpecimenNumber""");
  28.      setcookie("formProviderIntern""");
  29.      setcookie("formProviderExtern""");
  30.      setcookie("formHigherTaxon""");
  31.      setcookie("formTaxonName""");
  32.      setcookie("formGenus""");
  33.      setcookie("formSpecificEpithet""");
  34.      setcookie("formCountryList""");
  35.      setcookie("formCountryListISO""");
  36.      setcookie("formContinent""");
  37.      setcookie("formLocality""");
  38.      setcookie("formLatFrom""");
  39.      setcookie("formLatTo""");
  40.      setcookie("formLongFrom""");
  41.      setcookie("formLongTo""");
  42.      setcookie("formDnaBankNumber""");
  43.      setcookie("formRelation""");
  44.      setcookie("formType""");
  45.      setcookie("formPreservation""");
  46.      setcookie("formTissue""");
  47.      setcookie("formExtractionMethod""");
  48.      setcookie("formExtractionDateFrom""");
  49.      setcookie("formExtractionDateTo""");
  50.      setcookie("formExtractionStaff""");
  51.      setcookie("formPurificationMethod""");
  52.      setcookie("formAbsorbance280From""");
  53.      setcookie("formAbsorbance280To""");
  54.      setcookie("formAbsorbance230From""");
  55.      setcookie("formAbsorbance230To""");
  56.      setcookie("formConcentrationFrom""");
  57.      setcookie("formConcentrationTo""");
  58.      setcookie("formDegradation""");
  59.      setcookie("formCheckDateFrom""");
  60.      setcookie("formCheckDateTo""");
  61.      setcookie("formNumberAliquots""");
  62.      setcookie("formQuantityAliquotsFrom""");
  63.      setcookie("formQuantityAliquotsTo""");
  64.      setcookie("formGeneticLocus""");
  65.      setcookie("formGenBankNumber""");
  66.      setcookie("formGenBankNumberA""");
  67.      setcookie("formGenBankNumberB""");
  68.      setcookie("formGenBankNumberC""");
  69.      setcookie("formGenBankNumberD""");
  70.      setcookie("formGenBankLink""");
  71.      setcookie("formGenBankLinkA""");
  72.      setcookie("formGenBankLinkB""");
  73.      setcookie("formGenBankLinkC""");
  74.      setcookie("formGenBankLinkD""");                    
  75.      setcookie("radioGenBank""");
  76.      setcookie("formStockFridge""");
  77.      setcookie("formStockRack""");
  78.      setcookie("formStockBox""");
  79.      setcookie("formProvider""");
  80.      setcookie("formAliquotsFridge""");
  81.      setcookie("formAliquotsRack""");
  82.      setcookie("formAliquotsBox""");
  83.      setcookie("radioSource""");
  84.      setcookie("radioStock""");
  85.      setcookie("radioBackup""");
  86.      setcookie("formBlockDateFrom""");
  87.      setcookie("formBlockDateTo""");
  88.      setcookie("formBlockGeneral""");
  89.      setcookie("formRequest""");
  90.      setcookie("formNotes""");
  91.      setcookie("formBarcodeAliquot""");
  92.      setcookie("formPositionAliquot""");
  93.      setcookie("formBarcodeStock""");
  94.      setcookie("formPositionStock""");
  95.     
  96.      setcookie("formSpecimenNumber"$formSpecimenNumber);
  97.      setcookie("formProviderIntern"$formProviderIntern);
  98.      setcookie("formProviderExtern"$formProviderExtern);
  99.      setcookie("formHigherTaxon"$formHigherTaxon);
  100.      setcookie("formTaxonName"$formTaxonName);
  101.      setcookie("formGenus"$formGenus);   
  102.      setcookie("formSpecificEpithet"$formSpecificEpithet);   
  103.      setcookie("formCountryList"$formCountryList);
  104.      setcookie("formCountryListISO"$formCountryListISO);
  105.      setcookie("formContinent"$formContinent);
  106.      setcookie("formLocality"$formLocality);
  107.      setcookie("formLatFrom"$formLatFrom);
  108.      setcookie("formLatTo"$formLatTo);
  109.      setcookie("formLongFrom"$formLongFrom);
  110.      setcookie("formLongTo"$formLongTo);
  111.      setcookie("formDnaBankNumber"$formDnaBankNumber);
  112.      setcookie("formRelation"$formRelation);
  113.      setcookie("formType"$formType);
  114.      setcookie("formPreservation"$formPreservation);
  115.      setcookie("formTissue"$formTissue);
  116.      setcookie("formExtractionMethod"$formExtractionMethod);
  117.      setcookie("formExtractionDateFrom"$formExtractionDateFrom);
  118.      setcookie("formExtractionDateTo"$formExtractionDateTo);
  119.      setcookie("formExtractionStaff"$formExtractionStaff);
  120.      setcookie("formPurificationMethod"$formPurificationMethod);
  121.      setcookie("formAbsorbance280From"$formAbsorbance280From);
  122.      setcookie("formAbsorbance280To"$formAbsorbance280To);
  123.      setcookie("formAbsorbance230From"$formAbsorbance230From);
  124.      setcookie("formAbsorbance230To"$formAbsorbance230To);
  125.      setcookie("formConcentrationFrom"$formConcentrationFrom);
  126.      setcookie("formConcentrationTo"$formConcentrationTo);
  127.      setcookie("formDegradation"$formDegradation);
  128.      setcookie("formCheckDateFrom"$formCheckDateFrom);
  129.      setcookie("formCheckDateTo"$formCheckDateTo);
  130.      setcookie("formNumberAliquots"$formNumberAliquots);
  131.      setcookie("formQuantityAliquotsFrom"$formQuantityAliquotsFrom);
  132.      setcookie("formQuantityAliquotsTo"$formQuantityAliquotsTo);
  133.      setcookie("formGeneticLocus"$formGeneticLocus);
  134.      setcookie("formGenBankNumber"$formGenBankNumber);
  135.      setcookie("formGenBankNumberA"$formGenBankNumberA);
  136.      setcookie("formGenBankNumberB"$formGenBankNumberB);
  137.      setcookie("formGenBankNumberC"$formGenBankNumberC);
  138.      setcookie("formGenBankNumberD"$formGenBankNumberD);
  139.      setcookie("formGenBankLink"$formGenBankLink);
  140.      setcookie("formGenBankLinkA"$formGenBankLinkA);
  141.      setcookie("formGenBankLinkB"$formGenBankLinkB);
  142.      setcookie("formGenBankLinkC"$formGenBankLinkC);
  143.      setcookie("formGenBankLinkD"$formGenBankLinkD);
  144.      setcookie("radioGenBank"$radioGenBank);
  145.      setcookie("formStockFridge"$formStockFridge);
  146.      setcookie("formStockRack"$formStockRack);
  147.      setcookie("formStockBox"$formStockBox);
  148.      setcookie("formProvider"$formProvider);
  149.      setcookie("formAliquotsFridge"$formAliquotsFridge);
  150.      setcookie("formAliquotsRack"$formAliquotsRack);
  151.      setcookie("formAliquotsBox"$formAliquotsBox);
  152.      setcookie("radioSource"$radioSource);
  153.      setcookie("radioStock"$radioStock);
  154.      setcookie("radioBackup"$radioBackup);
  155.      setcookie("formBlockDateFrom"$formBlockDateFrom);
  156.      setcookie("formBlockDateTo"$formBlockDateTo);
  157.      setcookie("formBlockGeneral"$formBlockGeneral);
  158.      setcookie("formRequest"$formRequest);
  159.      setcookie("formNotes"$formNotes);
  160.      setcookie("formBarcodeAliquot"$formBarcodeAliquot);
  161.      setcookie("formPositionAliquot"$formPositionAliquot);
  162.      setcookie("formBarcodeStock"$formBarcodeStock);
  163.      setcookie("formPositionStock"$formBarcodeAliquot);
  164.      
  165.      }
  166.     
  167. ?>
  168. <html>
  169.  
  170. <head>
  171. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  172. <title>DNA Module - Data Cleaning Results</title>
  173. <link rel="stylesheet" type="text/css" href="../format.css">
  174. <link rel="stylesheet" type="text/css" href="../input/XSLT/Styles.css">
  175. <SCRIPT LANGUAGE="JavaScript1.1" src="../Functions.js"></SCRIPT>
  176. <NOSCRIPT>Please enable Javascript!</NOSCRIPT>
  177.  
  178. </head>
  179.  
  180. <body>
  181. <div align="center">
  182. <?php 
  183.     /**
  184.     * including navigation menu
  185.     */
  186.     include("../tablenavi.php")?>
  187. <table id="tablemain" border="0" class="search">
  188.     <tr>
  189.   <td id="tdLogo"><img border="0" src="../images/Logo-DNA-Bank-Network.png" width="123" height="78"></td>
  190.         <td id="tdtitle">
  191.     <?php if ($formSubmitUpdate or $formSubmitVerifyecho "<h1>Edit Dataset</h1>"}
  192.     
  193.     else echo "<h1>Search Results</h1>"?>
  194.     
  195.     </td>
  196.     <td id="tdLogo2"><?php echo $Path_Logo?></td>
  197.     </tr>
  198.   <tr>
  199.   <td colspan="3"><?php
  200.     echo "Logged in as: ";
  201.     $log $_SESSION["log"];
  202.     echo $log;
  203.     ?></td>
  204.   </tr>
  205.   <form name="formular" method="POST" action="query_clean.php?ID_DNA=<?php echo $ID_DNA?>">
  206.     <tr>
  207.         <td colspan="3" valign="top" align="center">
  208. <?php
  209.  
  210.     /********************************************************************************************
  211.     * Number of records per site                                                                *
  212.     *********************************************************************************************/
  213.     if($recordspage != ""{
  214.     $pagesize $recordspage}
  215.     else {$pagesize 50}
  216.  
  217.     $page $_GET['page'];
  218.     if(!$page || $page<|| !is_numeric($page))
  219.     $page 1}
  220.     elseif($page<1)
  221.     $page 1;
  222.     elseif(!is_numeric($page))
  223.     unset($page);
  224.    
  225.     /********************************************************************************************
  226.     * Create temporary table for hitlist                                                        *
  227.     *********************************************************************************************/
  228.    
  229.    $sql "";
  230.    $sqlcreate "CREATE TEMPORARY TABLE tmpDnaIDs AS ";
  231.    if($_GET['page']!= "")
  232.    $sqllimit "LIMIT " (($page-1$pagesize"," ($pagesize 1);
  233.    else
  234.     $sqllimit "LIMIT " ($pagesize 1);
  235.  
  236.     
  237. if($formSubmitUpdate or $formSubmitVerify)
  238.     /**
  239.     * during editing process calling this script
  240.     */
  241.     include("update_clean.php")
  242.  
  243. else // if(!$formSubmitUpdate and !$formSubmitVerify)
  244.     
  245.     
  246.     /********************************************************************************************
  247.     * building search query                                                                     *
  248.     * START                                                                                     *
  249.     *********************************************************************************************/
  250.     
  251.     /********************************************************************************************
  252.     * $_REQUEST['sort'] is defined in lines 397-407, user can sort hitlist by several parameters*
  253.     *********************************************************************************************/
  254.     
  255. if($formSubmitSearch or $_REQUEST['hitlist'== "true" or $_REQUEST['sort'!= "")
  256. {
  257.     $tr "=";
  258.     $no "!=";
  259.     $lk "like";
  260.     $bt ">=";
  261.     $st "<=";
  262.     if($_REQUEST['hitlist'== "true")
  263.     {$parr $_COOKIE;}
  264.     if($_REQUEST['hitlist'== "")
  265.     {$parr $_POST}
  266.     array($parr);
  267.     foreach ($parr as $varorigin)
  268.     {   $var addslashes($varorigin);
  269.         $i ++;
  270.         if(!empty($varand $var!="Search" and $var != $DNANo and key($parr)!="PHPSESSID")
  271.         {
  272.             switch (key($parr))
  273.             {
  274.                 case 'formDnaBankNumber':
  275.                     $str "(dnabanknumbers.DNA_Bank_Number = '' OR dnabanknumbers.DNA_Bank_Number IS NULL) OR ";
  276.                     $description " DNA Extraction No = ";
  277.                     $value "empty";
  278.                     break;
  279.                 case 'formRelation':
  280.                     $str "(dnabanknumbers.ID_RelationDNA_Voucher = '0' OR dnabanknumbers.ID_RelationDNA_Voucher = '' OR dnabanknumbers.ID_RelationDNA_Voucher IS NULL) OR ";
  281.                     $description " Relation to Voucher = ";
  282.                     $value "empty";                    
  283.                     break;
  284.                 case 'formNoVoucherData':
  285.                     $str "dnabanknumbers.ID_Cache NOT IN (SELECT ID_Cache FROM cachecollection) OR ";
  286.                     $description " DNA samples ";
  287.                     $value "without voucher data";
  288.                     break;    
  289.                 case 'formType':
  290.                     $str "(dnabanknumbers.ID_Type = '0' OR dnabanknumbers.ID_Tissue = '' OR dnabanknumbers.ID_Tissue IS NULL) OR ";
  291.                     $description " DNA Type = ";
  292.                     $value "empty";                    
  293.                     break;
  294.                 case 'formPreservation':
  295.                     $str "(dnabanknumbers.ID_Preservation = '0' OR dnabanknumbers.ID_Preservation = '' OR dnabanknumbers.ID_Preservation IS NULL) OR ";
  296.                     $description " Preservation = ";
  297.                     $value "empty";                    
  298.                     break;
  299.                 case 'formTissue':
  300.                     $str "(dnabanknumbers.ID_Tissue = '0' OR dnabanknumbers.ID_Tissue = '' OR dnabanknumbers.ID_Tissue IS NULL) OR ";
  301.                     $description " Tissue = ";
  302.                     $value "empty";                    
  303.                     break;
  304.                 case 'formExtractionMethod':
  305.                     $str "(dnabanknumbers.ID_Extraction_Method = '0' OR dnabanknumbers.ID_Extraction_Method = '' OR dnabanknumbers.ID_Extraction_Method IS NULL) AND ";
  306.                     $description " Extraction Method = ";
  307.                     $value "empty";                    
  308.                     break;
  309.                 case 'formExtractionDate':
  310.                     $str "(dnabanknumbers.Extraction_Date IS NULL OR dnabanknumbers.Extraction_Date = '') OR "
  311.                     $description " Extraction Date = ";
  312.                     $value "empty";                    
  313.                     break;
  314.                 case 'formExtractionStaff':
  315.                     $str "dnabanknumbers.ID_Extraction_Staff = '0' OR ";
  316.                     $description " Extraction Staff = ";
  317.                     $value "empty";                    
  318.                     break;
  319.                 case 'formPurificationMethod':
  320.                     $str "dnabanknumbers.ID_Purification = '0' OR ";
  321.                     $description " Purification Method = ";
  322.                     $value "empty";                    
  323.                     break;
  324.                 case 'formAbsorbance280':
  325.                     $str "(dnabanknumbers.Absorbance280 IS NULL OR dnabanknumbers.Absorbance280 = '') OR ";
  326.                     $description " Absorbance 280/260 = ";
  327.                     $value "empty";                    
  328.                     break;
  329.                 case 'formAbsorbance230':
  330.                     $str "(dnabanknumbers.Absorbance230 IS NULL OR dnabanknumbers.Absorbance230 = '') OR ";
  331.                     $description " Absorbance 230/260 = ";
  332.                     $value "empty";                    
  333.                     break;
  334.                 case 'formConcentration':
  335.                     $str "(dnabanknumbers.Concentration IS NULL OR dnabanknumbers.Concentration = '') OR ";
  336.                     $description " Concentration = ";
  337.                     $value "empty";                    
  338.                     break;
  339.                 case 'formDegradation':
  340.                     $str "(dnabanknumbers.ID_Degradation = '0' OR dnabanknumbers.ID_Degradation = '' OR dnabanknumbers.ID_Degradation IS NULL) OR ";
  341.                     $description " Quality = ";
  342.                     $value "empty";                    
  343.                     break
  344.                 case 'formCheckDate':
  345.                     $str "(dnabanknumbers.Check_Date IS NULL OR dnabanknumbers.Check_Date = '') OR "
  346.                     $description " Quality Check Date = ";
  347.                     $value "empty";                    
  348.                     break;
  349.                 case 'formStock':
  350.                     $str "(dnabanknumbers.ID_Location_Stock = '0' OR dnabanknumbers.ID_Location_Stock = '' OR dnabanknumbers.ID_Location_Stock IS NULL) OR ";
  351.                     $description " Stock Fridge = ";
  352.                     $value "empty";                    
  353.                     break;
  354.             }           
  355.             $where[$i$str;
  356.             $descriptionall[$i$description;
  357.             $valueall[$i$value;
  358.         }
  359.         next($parr);
  360.     }
  361.  
  362.     if(empty($str))
  363.     {  echo "<table  border='0' id='tablesearch'><tr><td colspan='5'><b>No search key entered.</b></td></tr>";
  364.     echo "<tr><td colspan='5'><a class='red' href=\"data_cleaning.php\">Back to Data Cleaning Overwiew.</a></td></tr></table>"}
  365.     else {
  366.  
  367.     foreach($where AS $a$string .= $a;
  368.  
  369.         $l=strlen ($string);
  370.         $max $l-3;
  371.         $where_str substr($string0$max);
  372.         $wherestr ' WHERE ' $where_str;
  373.         
  374.         /********************************************************************************************
  375.         * Further restriction for members of group "Guest"                                          *
  376.         * Guests don't have access to blocked samples                                               *
  377.         *********************************************************************************************/
  378.         
  379.         if (isset($_SESSION['guest']|| $_SESSION['guest']{
  380.         $wherestr .= ' AND dnabanknumbers.Block_General = "0"';    }
  381.         
  382.         /********************************************************************************************
  383.         * Further restriction for members of group "Project"                                        *
  384.         * Project members don't have access to blocked samples that are not created by themselves   *
  385.         *********************************************************************************************/
  386.         
  387.         if (isset($_SESSION['project']|| $_SESSION['project']{
  388.         $wherestr .= " AND ((dnabanknumbers.Created_Who != '".$log."' AND dnabanknumbers.Block_General = '0') OR dnabanknumbers.Created_Who = '".$log."') ";    }
  389.      
  390.     mysql_query("DROP TABLE IF EXISTS tmpDnaIDs")
  391.     
  392.         /********************************************************************************************
  393.         * Sorting query                                                                             *
  394.         *********************************************************************************************/
  395.   
  396.              if($_REQUEST['sort'== "DU" or $_REQUEST['sort'== "" or $Sorting == ""$OrderBy " ORDER BY LENGTH(dnabanknumbers.Dna_Bank_Number),dnabanknumbers.DNA_Bank_Number "}
  397.              if($_REQUEST['sort'== "DD"$OrderBy " ORDER BY LENGTH(dnabanknumbers.Dna_Bank_Number),dnabanknumbers.DNA_Bank_Number DESC "}             
  398.              if($_REQUEST['sort'== "SU"$OrderBy " ORDER BY cachecollection.UnitID_Specimen "}
  399.              if($_REQUEST['sort'== "SD"$OrderBy " ORDER BY cachecollection.UnitID_Specimen DESC "}
  400.              if($_REQUEST['sort'== "CU"$OrderBy " ORDER BY cachecollection.CollectionCode_Specimen "}
  401.              if($_REQUEST['sort'== "CD"$OrderBy " ORDER BY cachecollection.CollectionCode_Specimen DESC "}
  402.              if($_REQUEST['sort'== "IU"$OrderBy " ORDER BY cachecollection.InstitutionCode_Specimen "}             
  403.              if($_REQUEST['sort'== "ID"$OrderBy " ORDER BY cachecollection.InstitutionCode_Specimen DESC "}             
  404.              if($_REQUEST['sort'== "TU"$OrderBy " ORDER BY cachetaxonidentified.NameAuthorYear "}                          
  405.              if($_REQUEST['sort'== "TD"$OrderBy " ORDER BY cachetaxonidentified.NameAuthorYear DESC "}    
  406.              
  407.             
  408.             /********************************************************************************************
  409.             * building main query for hitlist ($sqlType == "Dna")                                        *
  410.             *********************************************************************************************/
  411.             
  412.             $sqlType "Dna";
  413.             $sql $sqlcreate .
  414.             $sql "SELECT DISTINCT dnabanknumbers.ID_DNA FROM dnabanknumbers 
  415.                     LEFT JOIN cachecollection ON dnabanknumbers.ID_Cache = cachecollection.ID_Cache
  416.                     LEFT JOIN cachetaxonidentified ON cachecollection.ID_Cache = cachetaxonidentified.ID_Cache
  417.                     LEFT JOIN cachehighertaxa ON cachetaxonidentified.ID_TaxonIdentified = cachehighertaxa.ID_CacheTaxonidentified
  418.                     LEFT JOIN amplifications ON dnabanknumbers.ID_DNA = amplifications.ID_DNA 
  419.                     LEFT JOIN location_stock ON location_stock.ID_Location_Stock = dnabanknumbers.ID_Location_Stock 
  420.                     LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.ID_DNA 
  421.                     LEFT JOIN request ON dnabanknumbers.ID_DNA = request.ID_DNA " .
  422.                    $wherestr.$OrderBy.$sqllimit;  
  423.  
  424.            $result mysql_query($sql);
  425.            
  426.            /********************************************************************************************
  427.            * building main query for counting records                                                  *
  428.            *********************************************************************************************/
  429.            
  430.            $sqlcount "SELECT DISTINCT dnabanknumbers.ID_DNA FROM dnabanknumbers 
  431.                     LEFT JOIN cachecollection ON dnabanknumbers.ID_Cache = cachecollection.ID_Cache
  432.                     LEFT JOIN cachetaxonidentified ON cachecollection.ID_Cache = cachetaxonidentified.ID_Cache
  433.                     LEFT JOIN cachehighertaxa ON cachetaxonidentified.ID_TaxonIdentified = cachehighertaxa.ID_CacheTaxonidentified
  434.                     LEFT JOIN amplifications ON dnabanknumbers.ID_DNA = amplifications.ID_DNA 
  435.                     LEFT JOIN location_stock ON location_stock.ID_Location_Stock = dnabanknumbers.ID_Location_Stock 
  436.                     LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.ID_DNA 
  437.                     LEFT JOIN request ON dnabanknumbers.ID_DNA = request.ID_DNA " .
  438.                    $wherestr;
  439.  
  440.            $resultcount mysql_query($sqlcount);
  441.            $sum mysql_num_rows($resultcount);
  442.  
  443.  
  444.     } } //if($formSubmitSearch)
  445.     
  446.     /********************************************************************************************
  447.     * building search query                                                                     *
  448.     * Code for "Show Hitlist" see line 1596                                                     *
  449.     * Code for "Building main query for details of single record" see line 1148                 *
  450.     * Code for "Show details of single record" see line 1709                                    *
  451.     * END                                                                                       *
  452.     *********************************************************************************************/
  453.     
  454. else
  455. {
  456.     
  457.     /********************************************************************************************
  458.     * Saving edited record                                                                      *
  459.     * 1. insert old record into _log_-tables                                                    *
  460.     * 2. update tables with new parameters                                                      * 
  461.     * 3. show details of record again                                                           *
  462.     * record is locked for editing when another user is editing the same record at the same time*
  463.     * START                                                                                     *
  464.     *********************************************************************************************/
  465.  
  466.  
  467. if($formSubmitSave)
  468. {
  469.  
  470. $Current_Date date('Y-m-d H:i:s');  
  471.  
  472.        $result2a mysql_query
  473.         ("SELECT dnabanknumbers.ID_DNA, " .
  474.          "       people.Name_All " .
  475.          "  FROM dnabanknumbers, people " .
  476.          " WHERE dnabanknumbers.ID_Extraction_Staff = people.ID_People " .
  477.          "   AND dnabanknumbers.ID_DNA = '$ID_DNA'");
  478.        
  479.        while($row mysql_fetch_object($result2a))
  480.        $Extraction_Staff_old $row->Name_All}   
  481.        
  482.         $result3a mysql_query
  483.         ("SELECT dnabanknumbers.ID_DNA, " .
  484.          "       people.Name_All " .
  485.          "  FROM dnabanknumbers, people " .
  486.          " WHERE dnabanknumbers.ID_Provided_By_People = people.ID_People " .
  487.          "   AND dnabanknumbers.ID_DNA = '$ID_DNA'");
  488.        
  489.        while($row mysql_fetch_object($result3a))
  490.        $Provided_By_People_old $row->Name_All}
  491.        
  492.         $result4a mysql_query
  493.         ("SELECT dnabanknumbers.ID_DNA, " .
  494.          "       stock_fridge.Stock_Fridge, " .
  495.          "       stock_rack.Stock_Rack, " .
  496.          "       stock_box.Stock_Box, " .
  497.          "       location_stock.ID_Stock_Fridge, " .
  498.          "       location_stock.ID_Stock_Rack, " .
  499.          "       location_stock.ID_Stock_Box, " 
  500.          "       location_stock.Origin_Quantity, " .         
  501.          "       location_stock.Rest_Quantity, " .
  502.          "       location_stock.Stock_Barcode, " .
  503.          "       location_stock.Stock_Position " .
  504.          "  FROM dnabanknumbers " .
  505.          "  LEFT JOIN location_stock ON dnabanknumbers.ID_Location_Stock = location_stock.ID_Location_Stock " .
  506.          "  LEFT JOIN stock_fridge ON location_stock.ID_Stock_Fridge = stock_fridge.ID_Stock_Fridge " .
  507.          "  LEFT JOIN stock_rack ON location_stock.ID_Stock_Rack = stock_rack.ID_Stock_Rack " .
  508.          "  LEFT JOIN stock_box ON location_stock.ID_Stock_Box = stock_box.ID_Stock_Box " .
  509.          " WHERE dnabanknumbers.ID_DNA = '$ID_DNA'");
  510.        
  511.        while($row mysql_fetch_object($result4a))
  512.        $Stock_Fridge $row->Stock_Fridge
  513.          $Stock_Rack $row->Stock_Rack;
  514.          $Stock_Box $row->Stock_Box
  515.          $ID_Stock_Fridge_old $row->ID_Stock_Fridge
  516.          $ID_Stock_Rack_old $row->ID_Stock_Rack
  517.          $ID_Stock_Box_old $row->ID_Stock_Box
  518.          $Stock_Origin_old $row->Origin_Quantity;
  519.          $Stock_Rest_old $row->Rest_Quantity;}
  520.          $Location_Stock_old "Fridge: " $Stock_Fridge " Drawer: " $Stock_Box " Rack: " $Stock_Rack " Position: " $Stock_Position " Barcode: " $Stock_Barcode;
  521.          
  522.          $result6a mysql_query
  523.          ("SELECT dnabanknumbers.Dna_Bank_Number, " .
  524.             "dnabanknumbers.ID_Cache, " .
  525.             "dnabanknumbers.Extraction_Date, " .
  526.             "dnabanknumbers.NoExtractDate, " .
  527.             "dnabanknumbers.Check_Date, " .
  528.             "dnabanknumbers.Concentration, " .
  529.             "dnabanknumbers.Absorbance280, " .
  530.             "dnabanknumbers.Absorbance230, " .
  531.             "dnabanknumbers.Stock_Gone, " .
  532.             "dnabanknumbers.Source_Gone, " .
  533.             "dnabanknumbers.Notes, " .
  534.             "dnabanknumbers.Block_Until, " .
  535.             "dnabanknumbers.Block_General, " .
  536.             "dnabanknumbers.Backup_Aliquot, " .
  537.             "dnabanknumbers.ID_Type, " .
  538.             "dnabanknumbers.ID_Tissue, " .          
  539.             "dnabanknumbers.ID_RelationDNA_Voucher, " .
  540.             "dnabanknumbers.ID_Preservation, " .
  541.             "dnabanknumbers.ID_Extraction_Method, " .
  542.             "dnabanknumbers.ID_Purification, " .
  543.             "dnabanknumbers.ID_Degradation, " .
  544.             "dnabanknumbers.ID_Extraction_Staff, " .
  545.             "dnabanknumbers.ID_Provided_By_People, " .
  546.             "dnabanknumbers.ID_Location_Stock, " .
  547.             "dnatype.Type, " .
  548.             "tissue.Tissue, " .
  549.             "relationdna_voucher.RelationDNA_Voucher, " .
  550.             "preservation.Preservation, " .
  551.             "extractionmethod.Method AS Extraction_Method, " .
  552.             "purification.Method AS Purification_Method, " .
  553.             "degradation.Degradation " .
  554.             "FROM dnabanknumbers " .
  555.             "LEFT JOIN dnatype ON dnabanknumbers.ID_Type = dnatype.ID_Type " .
  556.             "LEFT JOIN tissue ON dnabanknumbers.ID_Tissue = tissue.ID_Tissue " .   
  557.             "LEFT JOIN relationdna_voucher ON dnabanknumbers.ID_RelationDNA_Voucher = relationdna_voucher.ID_RelationDNA_Voucher " .
  558.             "LEFT JOIN preservation ON dnabanknumbers.ID_Preservation = preservation.ID_Preservation " .
  559.             "LEFT JOIN extractionmethod ON dnabanknumbers.ID_Extraction_Method = extractionmethod.ID_Method " .
  560.             "LEFT JOIN purification ON dnabanknumbers.ID_Purification = purification.ID_Purification " 
  561.             "LEFT JOIN degradation ON dnabanknumbers.ID_Degradation = degradation.ID_Degradation " .                       
  562.             "WHERE dnabanknumbers.ID_DNA = '$ID_DNA'");
  563.             
  564.           while($row mysql_fetch_object($result6a))
  565.           $Dna_Bank_Number_old $row->Dna_Bank_Number;
  566.             $ID_Cache_old $row->ID_Cache;
  567.             $Extraction_Date_old $row->Extraction_Date;
  568.             $NoExtractDate_old $row->NoExtractDate;
  569.             $Check_Date_old $row->Check_Date;
  570.             $Concentration_old $row->Concentration;
  571.             $Absorbance280_old $row->Absorbance280;
  572.             $Absorbance230_old $row->Absorbance230;
  573.             $Stock_Gone_old $row->Stock_Gone;
  574.             $Source_Gone_old $row->Source_Gone;
  575.             $Backup_Aliquot_old $row->Backup_Aliquot;
  576.             $Notes_old $row->Notes;
  577.             $Block_Until_old $row->Block_Until;
  578.             $BlockGeneral_old $row->Block_General;
  579.             $Type_old $row->Type;
  580.             $ID_Type_old $row->ID_Type;
  581.             $Tissue_old $row->Tissue
  582.             $ID_Tissue_old $row->ID_Tissue;
  583.             $RelationDNA_Voucher_old $row->RelationDNA_Voucher
  584.             $ID_RelationDNA_Voucher_old $row->ID_RelationDNA_Voucher;
  585.             $Preservation_old $row->Preservation;
  586.             $ID_Preservation_old $row->ID_Preservation;
  587.             $Extraction_Method_old $row->Extraction_Method;
  588.             $ID_Extraction_Method_old $row->ID_Extraction_Method;
  589.             $Purification_Method_old $row->Purification_Method;
  590.             $ID_Extraction_Staff_old $row->ID_Extraction_Staff;
  591.             $ID_Purification_Method_old $row->ID_Purification
  592.             $Degradation_old $row->Degradation;
  593.             $ID_Degradation_old $row->ID_Degradation
  594.             $ID_Provided_By_People_old $row->ID_Provided_By_People
  595.             $ID_Location_Stock_old $row->ID_Location_Stock}
  596. if(!empty($formAmplificationID))
  597.  {
  598.  
  599.        foreach ($formAmplificationID as $index => $AmplificationIDTest
  600.        
  601.         $LinkTest $formLink[$index];
  602.         $GenBankNumberTest $formGenBankNo[$index];
  603.         $FragmentIDTest $formFragment[$index];
  604.         
  605.        $resultAmplification mysql_query
  606.         ("SELECT dnabanknumbers.ID_DNA, " .
  607.          "       amplifications.GenBankNumber AS GenBankNumber, " .
  608.          "       amplifications.Link AS Link, " .
  609.          "       amplifications.ID_Fragment, " .
  610.          "       fragment.Fragment AS Fragment " .
  611.          "  FROM dnabanknumbers " .
  612.          "  LEFT JOIN amplifications ON dnabanknumbers.ID_DNA = amplifications.ID_DNA " .
  613.          "  LEFT JOIN fragment ON amplifications.ID_Fragment = fragment.ID_Fragment " .
  614.          " WHERE amplifications.ID_Amplification = '$AmplificationIDTest.
  615.          " ORDER BY amplifications.ID_Amplification");
  616.  
  617.      if(!empty($AmplificationIDTest))
  618.      {
  619.       while($row mysql_fetch_object($resultAmplification))         
  620.     
  621.       $GenBankNumber_old $row->GenBankNumber;
  622.       $Link_old $row->Link;
  623.       $Fragment_old $row->Fragment;
  624.       
  625.       
  626.     if ($row->Link != $LinkTest or $row->GenBankNumber != $GenBankNumberTest or $row->ID_Fragment != $FragmentIDTest)
  627.        
  628.          $sql1 "INSERT INTO _log_amplifications (ID_Amplification, ID_DNA, Fragment, GenBankNumber, Link, Update_Created_Who, Source_Created_Who, Source_Created_When) " .
  629.                       " (SELECT amplifications.ID_Amplification, " .
  630.                       "amplifications.ID_DNA, " .
  631.                       "'$Fragment_old', .
  632.                       "'$GenBankNumber_old', .
  633.                       "'$Link_old', .
  634.                       "'$log', .
  635.                       "amplifications.Created_Who, " .
  636.                       "amplifications.Created_When " .
  637.                       "FROM amplifications " .
  638.                       "WHERE amplifications.ID_Amplification = '$AmplificationIDTest')";
  639.          $result1 mysql_query($sql1);
  640.                       
  641. #######################################Error 1###############################################################
  642.  
  643. if(!$result1)
  644. $msg $sql1."\n";
  645.   $msg .= "####Error 1####";
  646.   trigger_error($msgE_USER_ERROR);
  647.   $test1 "false1";   }
  648.   
  649. #############################################################################################################                        
  650.  
  651.          if ($result1)
  652.          {
  653.          $sql2 "UPDATE amplifications SET GenBankNumber = '$GenBankNumberTest', .
  654.                            "Link = '$LinkTest', .
  655.                            "ID_Fragment = '$FragmentIDTest', .
  656.                            "Update_Who = '$log', .
  657.                            "Update_When = '$Current_Date.
  658.                            "WHERE amplifications.ID_Amplification = '$AmplificationIDTest'";
  659.          $result2 mysql_query($sql2);
  660. #######################################Error 2###############################################################
  661.  
  662. if(!$result2)
  663. $msg $sql2."\n";
  664.   $msg .= "####Error 2####";
  665.   trigger_error($msgE_USER_ERROR);
  666.   $test1 "false2";   }
  667.   
  668. #############################################################################################################   
  669. }
  670.       
  671.        }    
  672.        //while($row = mysql_fetch_object($resultAmplification))
  673.        }
  674.       //foreach End $formGenBankID
  675.       }
  676. $QuantityAliquots array_sum($_POST['formRestQuantity']);
  677.        foreach ($formLocationAliquotsID as $index => $AliquotsID
  678.        {  
  679.         $AliquotsFridge $formAliquotsFridge[$index];
  680.         $AliquotsRack $formAliquotsRack[$index];
  681.         $AliquotsBox $formAliquotsBox[$index];
  682.         $RestQuantity $formRestQuantity[$index];
  683.         $SourceQuantity $formSourceQuantity[$index];
  684.         $Positions $_POST['PositionAliquot'][$index];
  685.         $Barcodes $_POST['BarcodeAliquot'][$index];
  686.         
  687.        $resultAliquots mysql_query
  688.         ("SELECT dnabanknumbers.ID_DNA, " .
  689.          "       aliquots.Aliquot_Number, " .
  690.          "       aliquots_fridge.Aliquots_Fridge, " .
  691.          "       aliquots.ID_Aliquots_Fridge, " .
  692.          "       aliquots_rack.Aliquots_Rack, " .
  693.          "       aliquots.ID_Aliquots_Rack, " .         
  694.          "       aliquots_box.Aliquots_Box, " .
  695.          "       aliquots.Rest_Quantity, " .
  696.          "       aliquots.Origin_Quantity, " .
  697.          "       aliquots.ID_Aliquots_Box, " .         
  698.          "       aliquots.Aliquot_Barcode, " .         
  699.          "       aliquots.Aliquot_Position " .         
  700.          "  FROM dnabanknumbers " .
  701.          "  LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.ID_DNA " .
  702.          "  LEFT JOIN aliquots_fridge ON aliquots.ID_Aliquots_Fridge = aliquots_fridge.ID_Aliquots_Fridge " .
  703.          "  LEFT JOIN aliquots_rack ON aliquots.ID_Aliquots_Rack = aliquots_rack.ID_Aliquots_Rack " .
  704.          "  LEFT JOIN aliquots_box ON aliquots.ID_Aliquots_Box = aliquots_box.ID_Aliquots_Box " .                  
  705.          " WHERE aliquots.ID_Aliquots = '$AliquotsID.
  706.          " ORDER BY aliquots.ID_Aliquots");    
  707.  
  708.      if(empty($AliquotsID))
  709.      {
  710.      $AliquotNumber $formDnaBankNumber.'-A'
  711.      $sql3a "INSERT INTO aliquots (ID_DNA, ID_Aliquots_Box, ID_Aliquots_Rack, ID_Aliquots_Fridge, Origin_Quantity, Rest_Quantity, Aliquot_Number, Aliquot_Barcode, Aliquot_Position, Created_Who) " .
  712.                       " VALUES('$ID_DNA','$AliquotsBox','$AliquotsRack','$AliquotsFridge','$SourceQuantity','$RestQuantity','$AliquotNumber','$Barcodes','$Positions','$log')";
  713.         $result3a mysql_query($sql3a);
  714.         
  715. #######################################Error 3a/3b##############################################################
  716.  
  717. if(!$result3a)
  718. $msg $sql3a."\n";
  719.   $msg .= "####Error 3a####";
  720.   trigger_error($msgE_USER_ERROR);
  721.   $test1 "false1";   }
  722.   
  723. #############################################################################################################       
  724. }  
  725.      else {
  726.  
  727.       while($row mysql_fetch_object($resultAliquots))
  728.     
  729.       $Aliquot_Number_old $row->Aliquot_Number;
  730.       $Aliquots_Fridge_old $row->Aliquots_Fridge;
  731.       $Aliquots_Rack_old $row->Aliquots_Rack;
  732.       $Aliquots_Box_old $row->Aliquots_Box;
  733.       $Origin_Quantity_old $row->Origin_Quantity;
  734.       $Rest_Quantity_old $row->Rest_Quantity;
  735.       $Barcode_old $row->Aliquot_Barcode;
  736.       $Position_old $row->Aliquot_Position;
  737.       
  738.     if ($row->ID_Aliquots_Fridge != $AliquotsFridge or $row->ID_Aliquots_Rack != $AliquotsRack or $row->ID_Aliquots_Box != $AliquotsBox or $Rest_Quantity_old != $RestQuantity or $Position_old != $Positions)
  739.        {
  740.         $sql3 "INSERT INTO _log_aliquots (ID_Aliquots, ID_DNA, Aliquots_Box, Aliquots_Rack, Aliquots_Fridge, Aliquot_Number, Origin_Quantity, Rest_Quantity, Aliquot_Barcode, Aliquot_Position, Update_Created_Who, Source_Created_Who, Source_Created_When) " .
  741.                       " (SELECT aliquots.ID_Aliquots, " .
  742.                       "aliquots.ID_DNA, " .
  743.                       "'$Aliquots_Box_old', .
  744.                       "'$Aliquots_Rack_old', .
  745.                       "'$Aliquots_Fridge_old', .
  746.                       "aliquots.Aliquot_Number, " .
  747.                       "aliquots.Origin_Quantity, " .
  748.                       "aliquots.Rest_Quantity, " .
  749.                       "'$Barcode_old', .
  750.                       "'$Position_old', .
  751.                       "'$log', .
  752.                       "aliquots.Created_Who, " .
  753.                       "aliquots.Created_When " .
  754.                       "FROM aliquots " .
  755.                       "WHERE aliquots.ID_Aliquots = '$AliquotsID')";
  756.         $result3 mysql_query($sql3);
  757.         
  758. #######################################Error 3###############################################################
  759.  
  760. if(!$result3)
  761. $msg $sql3."\n";
  762.   $msg .= "####Error 3####";
  763.   trigger_error($msgE_USER_ERROR);
  764.   $test1 "false1";   }
  765.   
  766. #############################################################################################################  
  767.          if ($result3)
  768.          
  769.  
  770.         $sql4 "UPDATE aliquots SET ID_Aliquots_Fridge = '$AliquotsFridge', .
  771.                            "ID_Aliquots_Rack = '$AliquotsRack', .
  772.                            "ID_Aliquots_Box = '$AliquotsBox', .
  773.                            "Origin_Quantity = '$SourceQuantity', .
  774.                            "Rest_Quantity = '$RestQuantity', .
  775.                            "Aliquot_Position = '$Positions', .
  776.                            "Aliquot_Barcode = '$Barcodes', .
  777.                            "Update_Who = '$log', .
  778.                            "Update_When = '$Current_Date.
  779.                            "WHERE aliquots.ID_Aliquots = '$AliquotsID'";    
  780.         $result4 mysql_query($sql4);    
  781.                                              
  782. #######################################Error 4###############################################################
  783.  
  784. if(!$result4)
  785. $msg $sql4."\n";
  786.   $msg .= "####Error 4####";
  787.   trigger_error($msgE_USER_ERROR);
  788.   $test1 "false2";   }
  789.   
  790. ############################################################################################################# 
  791.  }
  792.        }    
  793.        //while($row = mysql_fetch_object($resultAliquots))
  794.        }
  795.       //foreach End $formLocationAliquotsID
  796.  
  797.     if (isset($_REQUEST['c'])) 
  798.    {
  799.    reset($_REQUEST['c']);
  800.    foreach ($_REQUEST['c'as $b)
  801.    {
  802.    if ($b == "SourceGone")
  803.    $SourceGone "1";
  804.    if ($b == "StockGone")
  805.    $StockGone "1";
  806.    if ($b == "BlockGeneral")
  807.    $BlockGeneral "1";
  808.    if ($b == "Aliquot")
  809.    $Aliquot "1";
  810.    if ($b == "Backup")
  811.    $Backup "1";
  812.    }
  813.    }
  814.  
  815.  
  816.  if($formGenBankNumberA)
  817.  {
  818.   $sql "INSERT INTO amplifications (ID_DNA, ID_Fragment, GenBankNumber, Link, Created_Who)" .
  819.                           "VALUES ('$ID_DNA','$formFragmentA','$formGenBankNumberA','$formGenBankLinkA','$log')";
  820.   $result mysql_query($sql);
  821.                           
  822. #######################################Error formGenbankNumberA###############################################################
  823.  
  824. if(!$result)
  825. $msg $sql."\n";
  826.   $msg .= "####Error formGenBankNumberA####";
  827.   trigger_error($msgE_USER_ERROR);
  828.   /**
  829.   * calling Error message
  830.   */
  831.   include ("../config/Errorreport.php");   }
  832.   
  833. #############################################################################################################                           
  834.  }
  835.  if($formGenBankNumberB)
  836.  {
  837.   $sql "INSERT INTO amplifications (ID_DNA, ID_Fragment, GenBankNumber, Link, Created_Who)" .
  838.                           "VALUES ('$ID_DNA','$formFragmentB','$formGenBankNumberB','$formGenBankLinkB','$log')";
  839.   $result mysql_query($sql);
  840.                           
  841. #######################################Error formGenbankNumberB###############################################################
  842.  
  843. if(!$result)
  844. $msg $sql."\n";
  845.   $msg .= "####Error formGenBankNumberB####";
  846.   trigger_error($msgE_USER_ERROR);
  847.   /**
  848.   * calling Error message
  849.   */
  850.   include ("../config/Errorreport.php");   }
  851.   
  852. #############################################################################################################         
  853.  }  
  854.  if($formGenBankNumberC)
  855.  {
  856.   $sql "INSERT INTO amplifications (ID_DNA, ID_Fragment, GenBankNumber, Link, Created_Who)" .
  857.                           "VALUES ('$ID_DNA','$formFragmentC','$formGenBankNumberC','$formGenBankLinkC','$log')";
  858.   $result mysql_query($sql);
  859.                           
  860. #######################################Error formGenbankNumberC###############################################################
  861.  
  862. if(!$result)
  863. $msg $sql."\n";
  864.   $msg .= "####Error formGenBankNumberC####";
  865.   trigger_error($msgE_USER_ERROR);
  866.   /**
  867.   * calling Error message
  868.   */
  869.   include ("../config/Errorreport.php");   }
  870.   
  871. #############################################################################################################                           
  872.  }   
  873.  if($formGenBankNumberD)
  874.  {
  875.   $sql "INSERT INTO amplifications (ID_DNA, ID_Fragment, GenBankNumber, Link, Created_Who)" .
  876.                           "VALUES ('$ID_DNA','$formFragmentD','$formGenBankNumberD','$formGenBankLinkD','$log')";
  877.   $result mysql_query($sql);
  878.                           
  879. #######################################Error formGenbankNumberD###############################################################
  880.  
  881. if(!$result)
  882. $msg $sql."\n";
  883.   $msg .= "####Error formGenBankNumberD####";
  884.   trigger_error($msgE_USER_ERROR);
  885.   /**
  886.   * calling Error message
  887.   */
  888.   include ("../config/Errorreport.php");   }
  889.   
  890. #############################################################################################################  
  891.  }      
  892.  
  893. if (isset($_REQUEST['Aliquot']))
  894.   
  895. foreach ($_POST['x'as $v => $value)
  896. {
  897.  
  898.      $rack $_POST['y'][$v];
  899.      $box $_POST['z'][$v];
  900.      
  901.      $SourceQuantity $AliquotSourceQuantity[$v];
  902.      $RestQuantity $AliquotRestQuantity[$v];
  903.      $Barcode $BarcodeAliquot[$v];
  904.      $Position $PositionAliquot[$v];
  905.      
  906.        
  907.      if (!isset($_REQUEST['Aliquot']))
  908.      unset($value);
  909.        unset($rack);
  910.        unset($box)
  911.        unset($SourceQuantity);   
  912.        unset($RestQuantity);
  913.        unset($Barcode)
  914.        unset($Position);    }
  915.       
  916.      else {
  917.        
  918.        if($value=="")
  919.      unset($value);
  920.        unset($rack)
  921.        unset($box)
  922.        unset($SourceQuantity);   
  923.        unset($RestQuantity);
  924.        unset($Barcode)
  925.        unset($Position);  }
  926.        else {
  927.     
  928.  
  929.      $resultLastAliquotsNumber mysql_query("SELECT Aliquot_Number FROM aliquots WHERE ID_DNA = '$ID_DNA' ORDER BY Aliquot_Number DESC LIMIT 0,1")
  930.  
  931.     if(!$resultLastAliquotsNumber)
  932.   
  933.    $letter A
  934.      $lettercount $letter++;
  935.      $AliquotNumber $formDnaBankNumber.'-'.$lettercount
  936. }
  937.  
  938.     else {  
  939.  
  940.   
  941.    while($row mysql_fetch_object($resultLastAliquotsNumber))
  942. {
  943.     $Number $row->Aliquot_Number;
  944.     $array explode("-",$Number);
  945.     $letter $array[1]}
  946.  
  947.      $lettercount $letter++;
  948.      $AliquotNumber $formDnaBankNumber.'-'.$letter++
  949.      
  950.      $sql10 "INSERT INTO aliquots (ID_DNA, ID_Aliquots_Fridge, ID_Aliquots_Rack, ID_Aliquots_Box, 
  951.                    Aliquot_Number, Origin_Quantity, Rest_Quantity, Aliquot_Barcode, Aliquot_Position, Created_Who) " .
  952.                   "VALUES ('$ID_DNA','$value','$rack','$box','$AliquotNumber','$SourceQuantity','$SourceQuantity','$Barcode','$Position','$log')";
  953.      $result10 mysql_query($sql10);
  954.                   
  955. #######################################Error 10###############################################################
  956.  
  957. if(!$result10)
  958. $msg $sql10."\n";
  959.   $msg .= "####Error 10####";
  960.   trigger_error($msgE_USER_ERROR);
  961.   $test1 "false2";   }
  962.   
  963. #############################################################################################################   
  964. } } }
  965.  
  966.    
  967.     }
  968.  
  969. //foreach ($_POST['x'] as $v => $value)
  970.  
  971.            
  972.  
  973.  
  974.       $sql11 "INSERT INTO _log_dnabanknumbers (ID_DNA, ID_Cache, Dna_Bank_Number, Extraction_Date, NoExtractDate, Check_Date, Concentration, Absorbance280, Absorbance230, Quantity_Aliquots, Stock_Gone, Source_Gone, Notes, Block_Until, Block_General, Number_Aliquots, Source_Created_When, Source_Created_Who, Type, Tissue, Preservation, Purification, Extraction_Method, Degradation, RelationDNA_Voucher, Extraction_Staff, Provided_By_People, Update_Created_Who, Location_Stock, Backup_Aliquot) " .
  975.             "(SELECT dnabanknumbers.ID_DNA, " .
  976.             "'$ID_Cache_old', .
  977.             "'$Dna_Bank_Number_old', .
  978.             "'$Extraction_Date_old', .
  979.             "'$NoExtractDate_old', .
  980.             "'$Check_Date_old', .
  981.             "'$Concentration_old', .
  982.             "'$Absorbance280_old', .
  983.             "'$Absorbance230_old', .
  984.             "'$Quantity_Aliquots_old', .
  985.             "'$Stock_Gone_old', .
  986.             "'$Source_Gone_old', .
  987.             "'$Notes_old', .
  988.             "'$Block_Until_old', .
  989.             "'$BlockGeneral_old', .
  990.             "'$Number_Aliquots_old', .
  991.             "dnabanknumbers.Created_When, " .
  992.             "dnabanknumbers.Created_Who, " .
  993.             "'$Type_old', .
  994.             "'$Tissue_old', .
  995.             "'$Preservation_old', .
  996.             "'$Purification_Method_old', .
  997.             "'$Extraction_Method_old', .
  998.             "'$Degradation_old', .
  999.             "'$RelationDNA_Voucher_old', .
  1000.             "'$Extraction_Staff_old', .
  1001.             "'$Provided_By_People_old', .
  1002.             "'$log', .
  1003.             "'$Location_Stock_old', .
  1004.             "'$Backup_Aliquot_old.
  1005.             "FROM dnabanknumbers " .
  1006.             "WHERE dnabanknumbers.ID_DNA = '$ID_DNA')";    
  1007.       $result11 mysql_query($sql11);
  1008.             $IDDnaLog=mysql_insert_id()
  1009.             
  1010. #######################################Error 11###############################################################
  1011.  
  1012. if(!$result11)
  1013. $msg $sql11."\n";
  1014.   $msg .= "####Error 11####";
  1015.   trigger_error($msgE_USER_ERROR);
  1016.   $test1 "false1";   }
  1017.   
  1018. ############################################################################################################# 
  1019.             
  1020.       if ($result11)
  1021.       {   
  1022.       if($_POST['formExtractionDate'== "YYYY-MM-DD" or $_POST['formExtractionDate'== ""{unset($formExtractionDate);}
  1023.       if($_POST['formCheckDate'== "YYYY-MM-DD" or $_POST['formCheckDate'== ""{unset($formCheckDate);}
  1024.       if($_POST['formBlockDate'== "YYYY-MM-DD" or $_POST['formBlockDate == ""']{unset($formBlockDate);}      
  1025.       
  1026.       
  1027.       if($_POST['formExtractionDate'== "YYYY-MM-DD" or $_POST['formExtractionDate'== ""unset($_POST['formExtractionDate'])}
  1028.       else $date $_POST['formExtractionDate'];
  1029.       if (!valiDate($date)) {  
  1030.           $Validation "FALSE";
  1031.           echo '<span class="error">Extraction date incorrect!</span><br>';  }
  1032.       else $_POST['formExtractionDate'$_POST['formExtractionDate']} }
  1033.  
  1034.       if($_POST['formCheckDate'== "YYYY-MM-DD" or $_POST['formCheckDate'== ""unset($_POST['formCheckDate'])}
  1035.       else $date $_POST['formCheckDate'];
  1036.       if (!valiDate($date)) {  
  1037.           $Validation "FALSE";
  1038.           echo '<span class="error">Quality check date incorrect!</span><br>';  }
  1039.       else $_POST['formCheckDate'$_POST['formCheckDate']} }
  1040.  
  1041.       if($_POST['formBlockDate'== "YYYY-MM-DD" or $_POST['formBlockDate'== ""unset($_POST['formBlockDate'])}
  1042.       else $date $_POST['formBlockDate'];
  1043.       if (!valiDate($date)) {  
  1044.           $Validation "FALSE";
  1045.           echo '<span class="error">Block date incorrect!</span><br>';  }
  1046.       else $_POST['formBlockDate'$_POST['formBlockDate']} }
  1047.       
  1048.       
  1049.       
  1050.           $sql12 "UPDATE dnabanknumbers SET DNA_Bank_Number = '$formDnaBankNumber', .
  1051.                            "Extraction_Date = '$formExtractionDate', .
  1052.                            "NoExtractDate = '$formNoExtractDate', .
  1053.                            "Check_Date = '$formCheckDate', .
  1054.                            "Concentration = '$formConcentration', .
  1055.                            "Absorbance280 = '$formAbsorbance280', .
  1056.                            "Absorbance230 = '$formAbsorbance230', .
  1057.                            "Notes = '$formNotes', .
  1058.                            "Notes_Intern = '$formNotesIntern', .
  1059.                            "Block_Until = '$formBlockDate', .
  1060.                            "ID_Type = '$formType', .
  1061.                            "ID_Tissue = '$formTissue', .
  1062.                            "ID_RelationDNA_Voucher = '$formRelation', .
  1063.                            "ID_Preservation = '$formPreservation', .
  1064.                            "ID_Extraction_Method = '$formExtractionMethod', .
  1065.                            "ID_Extraction_Staff = '$formExtractionStaff', .
  1066.                            "ID_Purification = '$formPurificationMethod', .
  1067.                            "ID_Degradation = '$formDegradation', .
  1068.                            "ID_Provided_By_People = '$formProvidedBy', .
  1069.                            "Stock_Gone = '$StockGone', .
  1070.                            "Source_Gone = '$SourceGone', .
  1071.                            "Block_General = '$BlockGeneral', .
  1072.                            "Block_Until = '$formBlockDate', .
  1073.                            "Backup_Aliquot = '$Backup', .
  1074.                            "Update_Who = '$log', .
  1075.                            "Update_When = '$Current_Date.
  1076.                            "WHERE dnabanknumbers.ID_DNA = '$ID_DNA'";      
  1077.           $result12 mysql_query($sql12);
  1078.             
  1079.             if(empty($ID_Stock_Fridge_oldor empty($ID_Stock_Rack_oldor empty($ID_Stock_Box_old))
  1080.             
  1081.               $sql13a "INSERT INTO location_stock (ID_Stock_Fridge, ID_Stock_Rack, ID_Stock_Box, Origin_Quantity, Rest_Quantity, Created_Who) " .
  1082.                            "VALUES ('$formStockFridge','$formStockRack','$formStockBox','$formStockQuantity','$formStockRest','$log')";
  1083.               $result13a mysql_query($sql13a)
  1084.  
  1085.               $ID_Location_Stock_New mysql_insert_id();
  1086.             
  1087.               $sql13b "UPDATE dnabanknumbers SET ID_Location_Stock = '$ID_Location_Stock_New.
  1088.                            "WHERE dnabanknumbers.ID_DNA = '$ID_DNA'";
  1089.               $result13b mysql_query($sql13b);
  1090.             #######################################Error 13a/13b###############################################################
  1091.  
  1092. if(!$result13a or !$result13b)
  1093. $msg $sql13a."\n";
  1094.   $msg .= $sql13b"\n";
  1095.   $msg .= "####Error 13a/13b####";
  1096.   trigger_error($msgE_USER_ERROR);
  1097.   $test1 "false2";   
  1098.   }
  1099.   
  1100. #############################################################################################################         
  1101.               
  1102.             
  1103.                            
  1104.            $sql13 "UPDATE location_stock SET ID_Stock_Fridge = '$formStockFridge', .
  1105.                            "ID_Stock_Rack = '$formStockRack', .
  1106.                            "ID_Stock_Box = '$formStockBox', .
  1107.                            "Origin_Quantity = '$formStockQuantity', .
  1108.                            "Rest_Quantity = '$formStockRest', .
  1109.                            "Stock_Position = '$formPositionStock', .
  1110.                            "Update_Who = '$log', .
  1111.                            "Update_When = '$Current_Date.
  1112.                            "WHERE location_stock.ID_Location_Stock = '$ID_Location_Stock_old'";   
  1113.            $result13 mysql_query($sql13)
  1114.  
  1115.            
  1116. #######################################Error 12/13###############################################################
  1117.  
  1118. if(!$result12 or !$result13)
  1119. $msg $sql12."\n";
  1120.   $msg .= $sql13"\n";
  1121.   $msg .= "####Error 12/13####";
  1122.   trigger_error($msgE_USER_ERROR);
  1123.   $test1 "false2";   }
  1124.   
  1125. #############################################################################################################           
  1126.              /********************************************************************************************
  1127.              * Creating main query for details of single record after saving edits                       *
  1128.              *********************************************************************************************/          
  1129.                           
  1130.  mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
  1131.           
  1132.           $sqlType "Detail";
  1133.           $sql $sqlcreate .
  1134.           $sql "SELECT DISTINCT dnabanknumbers.ID_DNA FROM dnabanknumbers 
  1135.                     LEFT JOIN cachecollection ON dnabanknumbers.ID_Cache = cachecollection.ID_Cache 
  1136.                     LEFT JOIN cachetaxonidentified ON cachecollection.ID_Cache = cachetaxonidentified.ID_Cache
  1137.                     LEFT JOIN cachehighertaxa ON cachetaxonidentified.ID_TaxonIdentified = cachehighertaxa.ID_CacheTaxonidentified
  1138.                     LEFT JOIN amplifications ON dnabanknumbers.ID_DNA = amplifications.ID_DNA 
  1139.                     LEFT JOIN location_stock ON location_stock.ID_Location_Stock = dnabanknumbers.ID_Location_Stock 
  1140.                     LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.ID_DNA 
  1141.                     LEFT JOIN request ON dnabanknumbers.ID_DNA = request.ID_DNA " .
  1142.                  "WHERE dnabanknumbers.ID_DNA = '$ID_DNA";
  1143.            if (isset($_SESSION['guest']|| $_SESSION['guest'])  {
  1144.            $sql .= " AND dnabanknumbers.Block_General = '0' "}
  1145.            if (isset($_SESSION['project']|| $_SESSION['project'])  {
  1146.            $sql .= " AND ((dnabanknumbers.Created_Who != '".$log."' AND dnabanknumbers.Block_General = '0') OR dnabanknumbers.Created_Who = '".$log."') "}
  1147.            $sql .= $sqllimit;                             
  1148.       }                     
  1149.  
  1150. // if (isset($_REQUEST['Aliquot']))
  1151.  
  1152.     
  1153.  
  1154.    /********************************************************************************************
  1155.     * Creating main query for details of single record                                          *
  1156.     * START                                                                                     *
  1157.     *********************************************************************************************/ 
  1158. else {
  1159.  
  1160.      mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
  1161.           
  1162.           $sqlType "Detail";
  1163.           $sql $sqlcreate .
  1164.           $sql "SELECT DISTINCT dnabanknumbers.ID_DNA FROM dnabanknumbers 
  1165.                     LEFT JOIN cachecollection ON dnabanknumbers.ID_Cache = cachecollection.ID_Cache 
  1166.                     LEFT JOIN cachetaxonidentified ON cachecollection.ID_Cache = cachetaxonidentified.ID_Cache
  1167.                     LEFT JOIN cachehighertaxa ON cachetaxonidentified.ID_TaxonIdentified = cachehighertaxa.ID_CacheTaxonidentified
  1168.                     LEFT JOIN amplifications ON dnabanknumbers.ID_DNA = amplifications.ID_DNA 
  1169.                     LEFT JOIN location_stock ON location_stock.ID_Location_Stock = dnabanknumbers.ID_Location_Stock 
  1170.                     LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.ID_DNA 
  1171.                     LEFT JOIN request ON dnabanknumbers.ID_DNA = request.ID_DNA " .
  1172.                  "WHERE dnabanknumbers.ID_DNA = '$ID_DNA";
  1173.            if (isset($_SESSION['guest']|| $_SESSION['guest'])  {
  1174.            $sql .= " AND dnabanknumbers.Block_General = '0' "}
  1175.            if (isset($_SESSION['project']|| $_SESSION['project'])  {
  1176.            $sql .= " AND ((dnabanknumbers.Created_Who != '".$log."' AND dnabanknumbers.Block_General = '0') OR dnabanknumbers.Created_Who = '".$log."') "}
  1177.            $sql .= $sqllimit;                             
  1178.     }
  1179.  
  1180.     /********************************************************************************************
  1181.     * Creating main query for details of single record                                          *
  1182.     * END                                                                                       *
  1183.     *********************************************************************************************/
  1184.   // if(!$formSubmitUpdate and !$formSubmitVerify)
  1185.     
  1186.     /********************************************************************************************
  1187.     * Show data                                                                                 *
  1188.     * START                                                                                     *
  1189.     *********************************************************************************************/
  1190.     
  1191. $Dnacount=0;
  1192.  
  1193. if(!empty($sql)) 
  1194.  {
  1195.     /********************************************************************************************
  1196.     * just in case it is still here: drop tmpDnaIDs                                             *
  1197.     ********************************************************************************************/
  1198.     mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
  1199.  
  1200.     mysql_query($sql);
  1201.    if(!mysql_affected_rows()) 
  1202.    {
  1203.     echo "<table border='0' id='tablesearch'><tr><td colspan='5'><a class='red' href=\"data_cleaning.php\">Back to Data Cleaning Overview.</a></td></tr>"
  1204.     /********************************************************************************************
  1205.     * Further message for guests and project members when query was wrong                       *
  1206.     *********************************************************************************************/
  1207.    if (isset($_SESSION['guest']|| $_SESSION['guest'|| isset($_SESSION['project']|| $_SESSION['project'])  {
  1208.            echo "<tr><td colspan='5'><span class='error'>Sorry, you don't have permission to see this record.</span></td></tr></table>"}
  1209.            
  1210.    else {    //user has access to data
  1211.  
  1212.     
  1213.     /********************************************************************************************
  1214.     * Search key string                                                                         *
  1215.     *********************************************************************************************/
  1216.     
  1217.     echo "<tr><td colspan='5'><b>No hits found for:</b>";
  1218.       
  1219.       foreach($descriptionall as $index => $descriptiontest)
  1220.       $valuetest $valueall[$index];
  1221.         echo $descriptiontest."[<b>".$valuetest."</b>]"}
  1222.       echo "</td></tr></table>"}
  1223.     
  1224.     //END if(!mysql_affected_rows()) 
  1225.     else 
  1226.     {
  1227.       $result1 mysql_query
  1228.         ("SELECT dnabanknumbers.ID_DNA, " .
  1229.          "       dnabanknumbers.ID_Cache, " .
  1230.          "       dnabanknumbers.DNA_Bank_Number, " .
  1231.          "       dnabanknumbers.Extraction_Date, " .
  1232.          "       dnabanknumbers.NoExtractDate, " .
  1233.          "       dnabanknumbers.Absorbance280, " .
  1234.          "       dnabanknumbers.Absorbance230, " .
  1235.          "       dnabanknumbers.Concentration, " .
  1236.          "       dnabanknumbers.Check_Date, " .
  1237.          "       dnabanknumbers.Created_Who, " .
  1238.          "       dnabanknumbers.Created_When, " .
  1239.          "       dnabanknumbers.Stock_Gone, " .
  1240.          "       dnabanknumbers.Source_Gone, " .         
  1241.          "       dnabanknumbers.Block_Until, " .
  1242.          "       dnabanknumbers.Block_General, " .
  1243.          "       dnabanknumbers.Notes, " .
  1244.          "       dnabanknumbers.Notes_Intern, " .         
  1245.          "       dnabanknumbers.Backup_Aliquot, " .
  1246.          "       dnabanknumbers.Update_Who, " .
  1247.          "       dnabanknumbers.Update_When, " .
  1248.          "       relationdna_voucher.RelationDNA_Voucher, " 
  1249.          "       dnatype.Type, " .
  1250.          "       preservation.Preservation, " .
  1251.          "       tissue.Tissue, " .
  1252.          "       extractionmethod.Method, " .
  1253.          "       extractionmethod.Company, " .
  1254.          "       purification.Method, " .
  1255.          "       purification.Company, " .
  1256.          "       degradation.Degradation, " .
  1257.          "       cachecollection.ID_Dataset_Specimen, " .
  1258.          "       cachecollection.UnitID_Specimen, " .
  1259.          "       cachecollection.CollectionCode_Specimen, " .
  1260.          "       cachecollection.InstitutionCode_Specimen, " 
  1261.          "       cachecollection.ContinentOrOcean, " .
  1262.          "       cachecollection.CountryName, " 
  1263.          "       cachecollection.CountryISO2, " 
  1264.          "       cachecollection.Collectors, " 
  1265.          "       cachecollection.CollectionDate, " 
  1266.          "       cachecollection.CollectorsNo, " 
  1267.          "       cachecollection.Locality, " .
  1268.          "       cachecollection.Altitude, " 
  1269.          "       cachecollection.Longitude, " .
  1270.          "       cachecollection.Latitude, " 
  1271.          "       cachecollection.CollectionInfo_Other, " .
  1272.          "       cachecollection.TypeStatus, " .
  1273.          "       dataset.Display AS SpecimenDatabase, " .
  1274.          "       dataset.ID_Dataset, " .
  1275.          "       schemata.QueryPart1b, " .
  1276.          "       schemata.QueryPart1_1, " .
  1277.          "       schemata.QueryPart1_2b, " .
  1278.          "       schemata.QueryPart2, " .
  1279.          "       schemata.QueryPart3, " .
  1280.          "       schemata.QueryPart4, " 
  1281.          "       schemata.QueryPart5, " 
  1282.          "       provider.Provider, " .
  1283.          "       dataset.Digir_Resource, " .
  1284.          "       dataset.Digir_Source, " .
  1285.          "       provider.Provider, " 
  1286.          "       provider.ID_Schema " .
  1287.          "  FROM dnabanknumbers JOIN tmpDnaIDs " .
  1288.          "       LEFT JOIN cachecollection ON dnabanknumbers.ID_Cache = cachecollection.ID_Cache " .
  1289.          "       LEFT JOIN relationdna_voucher ON dnabanknumbers.ID_RelationDNA_Voucher = relationdna_voucher.ID_RelationDNA_Voucher " .
  1290.          "       LEFT JOIN dnatype ON dnabanknumbers.ID_Type = dnatype.ID_Type " .
  1291.          "       LEFT JOIN preservation ON dnabanknumbers.ID_Preservation = preservation.ID_Preservation " .
  1292.          "       LEFT JOIN tissue ON dnabanknumbers.ID_Tissue = tissue.ID_Tissue " .
  1293.          "       LEFT JOIN extractionmethod ON dnabanknumbers.ID_Extraction_Method = extractionmethod.ID_Method " .
  1294.          "       LEFT JOIN purification ON dnabanknumbers.ID_Purification = purification.ID_Purification " .
  1295.          "       LEFT JOIN people ON dnabanknumbers.ID_Extraction_Staff = people.ID_People " .
  1296.          "       LEFT JOIN degradation ON dnabanknumbers.ID_Degradation = degradation.ID_Degradation " .
  1297.          "       LEFT JOIN dataset ON cachecollection.ID_Dataset_Specimen = dataset.ID_Dataset " .
  1298.          "       LEFT JOIN provider ON dataset.ID_Provider = provider.ID_Provider " 
  1299.          "       LEFT JOIN schemata ON provider.ID_Schema = schemata.ID_Schema " .
  1300.          " WHERE dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
  1301.          
  1302.      $result2 mysql_query
  1303.         ("SELECT dnabanknumbers.ID_DNA AS ID_DNA, " .
  1304.          "       dnabanknumbers.ID_Cache, " .
  1305.          "       cachecollection.ID_Cache, " .
  1306.          "       cachetaxonidentified.NameAuthorYear AS NameAuthorYear, " .
  1307.          "       cachetaxonidentified.PreferredFlag AS PreferredFlag " .
  1308.          "  FROM cachecollection, cachetaxonidentified, dnabanknumbers, tmpDnaIDs " .
  1309.          " WHERE cachetaxonidentified.ID_Cache = cachecollection.ID_Cache " .
  1310.          "   AND cachecollection.ID_Cache = dnabanknumbers.ID_Cache " .
  1311.          "   AND cachetaxonidentified.PreferredFlag != '' " .
  1312.          "   AND dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
  1313.         
  1314.      while($row mysql_fetch_object($result2))
  1315.        {
  1316.        if(isset($PreferredFlag[$row->ID_DNA]))
  1317.          $Flag $PreferredFlag[$row->ID_DNA];
  1318.            if($Flag == 'true' or $Flag == '1'{$Preferred "(preferred species name)";}
  1319.            else {$Preferred ""}
  1320.          }
  1321.         else
  1322.          $PreferredFlag[$row->ID_DNA""}
  1323.          
  1324.        if(isset($NameAuthorYear[$row->ID_DNA]))
  1325.          $NameAuthorYear[$row->ID_DNA.= " " $Preferred ", Other Identifications: "}
  1326.         else
  1327.          $NameAuthorYear[$row->ID_DNA""}
  1328.         
  1329.         
  1330.         $tmp $row->NameAuthorYear;
  1331.         $NameAuthorYear[$row->ID_DNA.= $tmp;
  1332.         
  1333.         $tmp2 $row->PreferredFlag;
  1334.         $PreferredFlag[$row->ID_DNA.= $tmp2}
  1335.                 
  1336.          
  1337.         $result3 mysql_query
  1338.         ("SELECT dnabanknumbers.ID_DNA AS ID_DNA, " .
  1339.          "       dnabanknumbers.ID_Cache, " .
  1340.          "       cachecollection.ID_Cache, " .
  1341.          "       cachetaxonidentified.ID_TaxonIdentified, " .
  1342.          "       cachehighertaxa.HigherTaxon AS HigherTaxon, " .
  1343.          "       cachehighertaxa.TaxonRank AS TaxonRank " .
  1344.          "  FROM cachecollection, cachetaxonidentified, cachehighertaxa, dnabanknumbers, tmpDnaIDs " .
  1345.          " WHERE cachehighertaxa.ID_CacheTaxonIdentified = cachetaxonidentified.ID_TaxonIdentified " .
  1346.          "   AND cachetaxonidentified.ID_Cache = cachecollection.ID_Cache " .
  1347.          "   AND cachecollection.ID_Cache = dnabanknumbers.ID_Cache " .
  1348.          "   AND dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
  1349.         
  1350.  while($row mysql_fetch_object($result3))
  1351.        {
  1352.        if(isset($TaxonRank[$row->ID_DNA]))
  1353.        $TaxonRank[$row->ID_DNA.= "<br>"}
  1354.        
  1355.        else $TaxonRank[$row->ID_DNA""}
  1356.        
  1357.        
  1358.        if(isset($HigherTaxon[$row->ID_DNA]))
  1359.          
  1360.            $HigherTaxon[$row->ID_DNA.= "<br>";
  1361.          }
  1362.         else
  1363.          $HigherTaxon[$row->ID_DNA""}
  1364.          
  1365.         $tmp $row->HigherTaxon;
  1366.         $HigherTaxon[$row->ID_DNA.= $tmp;       
  1367.         
  1368.         $tmp2 $row->TaxonRank;
  1369.         $TaxonRank[$row->ID_DNA.= $tmp2
  1370.  
  1371.         }
  1372.  
  1373.         $result3a mysql_query
  1374.         ("SELECT dnabanknumbers.ID_DNA AS ID_DNA, " .
  1375.          "       dnabanknumbers.ID_Cache, " .
  1376.          "       cacheimages.ID_Cache, " .
  1377.          "       cacheimages.Images " .
  1378.          "  FROM cacheimages, dnabanknumbers, tmpDnaIDs " .
  1379.          " WHERE cacheimages.ID_Cache = dnabanknumbers.ID_Cache " .
  1380.          "   AND dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
  1381.          
  1382.          while($row mysql_fetch_object($result3a))
  1383.          {
  1384.          if(isset($ImageLink[$row->ID_DNA]))
  1385.          $ImageLink .= build_href1($row->Images,$row->Images"<br>"}
  1386.          else
  1387.          {$ImageLink .= build_href1($row->Images,$row->Images"<br>"}
  1388.          }
  1389.         
  1390.  
  1391.        
  1392.        $result5 mysql_query
  1393.         ("SELECT dnabanknumbers.ID_DNA, " .
  1394.          "       people.Name_All AS Name_All_Extraction " .
  1395.          "  FROM dnabanknumbers,people, tmpDnaIDs " .
  1396.          " WHERE dnabanknumbers.ID_Extraction_Staff = people.ID_People " .
  1397.          "   AND dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
  1398.        
  1399.        while($row mysql_fetch_object($result5))
  1400.        $Extraction_Staff $row->Name_All_Extraction}
  1401.        
  1402.        $result6 mysql_query
  1403.         ("SELECT dnabanknumbers.ID_DNA, " .
  1404.          "       people.Name_All AS Name_All_Provided_By " .
  1405.          "  FROM dnabanknumbers,people, tmpDnaIDs " .
  1406.          " WHERE dnabanknumbers.ID_Provided_By_People = people.ID_People " .
  1407.          "   AND dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
  1408.        
  1409.        while($row mysql_fetch_object($result6))
  1410.        $Provided_By_People $row->Name_All_Provided_By}
  1411.        
  1412.        
  1413.        
  1414.         $result7 mysql_query
  1415.         ("SELECT dnabanknumbers.ID_DNA, " .
  1416.          "       amplifications.GenBankNumber AS GenBankNumber, " .
  1417.          "       amplifications.Link AS Link, " .
  1418.          "       geneticlocus.GeneticLocus AS GeneticLocus " .
  1419.          "  FROM dnabanknumbers JOIN tmpDnaIDs " .
  1420.          "  LEFT JOIN amplifications ON dnabanknumbers.ID_DNA = amplifications.ID_DNA " .
  1421.          "  LEFT JOIN geneticlocus ON amplifications.ID_GeneticLocus = geneticlocus.ID_GeneticLocus " .
  1422.          " WHERE dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
  1423.  
  1424.       
  1425.        while($row mysql_fetch_object($result7))
  1426.        {
  1427.         
  1428.          if(isset($Link[$row->ID_DNA]))
  1429.          if($formSubmitSave{}
  1430.          else $Link[$row->ID_DNA.= ""}
  1431.           $Link2 .= build_href1($row->Link,$row->GenBankNumber"<br>";
  1432.          }
  1433.         else
  1434.          
  1435.            $Link[$row->ID_DNA"";
  1436.            $Link2 .= build_href1($row->Link,$row->GenBankNumber"<br>";
  1437.         
  1438.         if(empty($row->Link)) $Link2 ""}
  1439.          
  1440.          
  1441.         if(isset($GeneticLocus[$row->ID_DNA]))
  1442.          
  1443.            $GeneticLocus[$row->ID_DNA.= "<br>";
  1444.          }
  1445.         else
  1446.          $GeneticLocus[$row->ID_DNA""}  
  1447.          
  1448.          
  1449.         if($formSubmitSave{}
  1450.           else {
  1451.           $tmp $row->Link;
  1452.           $Link[$row->ID_DNA.= $tmp}
  1453.         
  1454.           $tmp $row->GeneticLocus;
  1455.           $GeneticLocus[$row->ID_DNA.= $tmp;        
  1456.          
  1457.        }
  1458.        
  1459.         $result8 mysql_query
  1460.         ("SELECT dnabanknumbers.ID_DNA, " .
  1461.          "       stock_box.Stock_Box, " .
  1462.          "       stock_rack.Stock_Rack, " .
  1463.          "       stock_fridge.Stock_Fridge, " .         
  1464.          "       location_stock.Origin_Quantity AS Location_Volume, " .
  1465.          "       location_stock.Rest_Quantity AS Location_Rest, " .
  1466.          "       location_stock.Stock_Barcode, " .
  1467.          "       location_stock.Stock_Position " .
  1468.          "  FROM dnabanknumbers JOIN tmpDnaIDs " .
  1469.          "  LEFT JOIN location_stock ON dnabanknumbers.ID_Location_Stock = location_stock.ID_Location_Stock " .
  1470.          "  LEFT JOIN stock_box ON stock_box.ID_Stock_Box = location_stock.ID_Stock_Box " .
  1471.          "  LEFT JOIN stock_rack ON stock_rack.ID_Stock_Rack = location_stock.ID_Stock_Rack " .
  1472.          "  LEFT JOIN stock_fridge ON stock_fridge.ID_Stock_Fridge = location_stock.ID_Stock_Fridge " .      
  1473.          " WHERE dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
  1474.               
  1475.        
  1476.        while($row mysql_fetch_object($result8))
  1477.        $Location_Box $row->Stock_Box
  1478.          $Location_Rack $row->Stock_Rack
  1479.          $Location_Fridge $row->Stock_Fridge;
  1480.          $Location_Volume $row->Location_Volume;
  1481.          $Location_Rest $row->Location_Rest;
  1482.          $Stock_Barcode $row->Stock_Barcode;
  1483.          $Stock_Position $row->Stock_Position;
  1484.        }
  1485.   
  1486.         $result9 mysql_query
  1487.         ("SELECT dnabanknumbers.ID_DNA, " .
  1488.          "       aliquots_box.Aliquots_Box, " .
  1489.          "       aliquots_rack.Aliquots_Rack, " .
  1490.          "       aliquots_fridge.Aliquots_Fridge, " .         
  1491.          "       aliquots.Aliquot_Number, " .
  1492.          "       aliquots.Origin_Quantity AS Aliquot_Origin, " .
  1493.          "       aliquots.Rest_Quantity AS Aliquot_Rest, " .
  1494.          "       aliquots.Aliquot_Barcode, " 
  1495.          "       aliquots.Aliquot_Position, " 
  1496.          "       aliquots.Price, " 
  1497.          "       aliquots.Currency " 
  1498.          "  FROM dnabanknumbers JOIN tmpDnaIDs " .
  1499.          "  LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.ID_DNA " .
  1500.          "  LEFT JOIN aliquots_box ON aliquots_box.ID_Aliquots_Box = aliquots.ID_Aliquots_Box " .
  1501.          "  LEFT JOIN aliquots_rack ON aliquots_rack.ID_Aliquots_Rack = aliquots.ID_Aliquots_Rack " .
  1502.          "  LEFT JOIN aliquots_fridge ON aliquots_fridge.ID_Aliquots_Fridge = aliquots.ID_Aliquots_Fridge " .      
  1503.          " WHERE dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA " .
  1504.          " ORDER BY aliquots.Aliquot_Number");
  1505.        
  1506.        
  1507.         $result10 mysql_query
  1508.         ("SELECT dnabanknumbers.ID_DNA, " .
  1509.          "       request.Request_Date, " .
  1510.          "       request.Request_Number_Aliquots, " .
  1511.          "       request.Request_Notes, " .
  1512.          "       people.Name_All AS Customer " .
  1513.          "  FROM dnabanknumbers JOIN tmpDnaIDs " .
  1514.          "  LEFT JOIN request ON dnabanknumbers.ID_DNA = request.ID_DNA " .
  1515.          "  LEFT JOIN people ON request.ID_People = people.ID_People " .
  1516.          " WHERE dnabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
  1517.        
  1518.        while($row mysql_fetch_object($result10))
  1519.        {
  1520.         if(isset($Request_Date[$row->ID_DNA]))
  1521.          $Request_Date[$row->ID_DNA.= ""
  1522.            $DateRequest .= $row->Request_Date "<br>";
  1523.          }
  1524.         else
  1525.          $Request_Date[$row->ID_DNA""
  1526.            $DateRequest .= $row->Request_Date "<br>"}
  1527.          
  1528.         if(isset($Request_Number_Aliquots[$row->ID_DNA]))
  1529.          $Request_Number_Aliquots[$row->ID_DNA.= "<br>"}
  1530.         else
  1531.          $Request_Number_Aliquots[$row->ID_DNA""}
  1532.  
  1533.         if(isset($Request_Notes[$row->ID_DNA]))
  1534.          $Request_Notes[$row->ID_DNA.= "<br>"}
  1535.         else
  1536.          $Request_Notes[$row->ID_DNA""}
  1537.  
  1538.         if(isset($Customer[$row->ID_DNA]))
  1539.          $Customer[$row->ID_DNA.= "<br>"}
  1540.         else
  1541.          $Customer[$row->ID_DNA""}
  1542.          
  1543.          $tmp $row->Request_Date;
  1544.          $Request_Date[$row->ID_DNA.= $tmp;
  1545.        
  1546.          $tmp $row->Request_Number_Aliquots;
  1547.          $Request_Number_Aliquots[$row->ID_DNA.= $tmp;
  1548.        
  1549.          $tmp $row->Request_Notes;
  1550.          $Request_Notes[$row->ID_DNA.= $tmp;
  1551.        
  1552.          $tmp $row->Customer;
  1553.          $Customer[$row->ID_DNA.= $tmp}
  1554.          
  1555.  
  1556.         $result11 mysql_query
  1557.         ("SELECT publications_amplifications.ID_DNA, " .
  1558.          "  publications_amplifications.Paper_Cache, " .
  1559.          "  publications_amplifications.GeneticLocus AS GeneticLocusPub, " .
  1560.          "  publications.Link AS LinkPub " .
  1561.          "  FROM publications_amplifications JOIN tmpDnaIDs " .
  1562.          " LEFT JOIN publications ON publications_amplifications.ID_Publications = publications.ID_Publications " .
  1563.          " WHERE publications_amplifications.ID_DNA = tmpDnaIDs.ID_DNA");
  1564.          
  1565.        while($row mysql_fetch_object($result11))
  1566.        
  1567.         if(isset($Paper_Cache[$row->ID_DNA]))
  1568.          $Paper_Cache[$row->ID_DNA.= "<br>"}
  1569.         else
  1570.          $Paper_Cache[$row->ID_DNA""}
  1571.  
  1572.         if(isset($GeneticLocusPub[$row->ID_DNA]))
  1573.          $GeneticLocusPub[$row->ID_DNA.= "<br>"}
  1574.         else
  1575.          $GeneticLocusPub[$row->ID_DNA""}
  1576.       
  1577.         if(isset($LinkPub[$row->ID_DNA]))
  1578.          if($formSubmitSave{}
  1579.          else $LinkPub[$row->ID_DNA.= ""}
  1580.           $LinkPub2 .= build_href1($row->LinkPub,"document""<br>";
  1581.          }
  1582.         else
  1583.          
  1584.            $LinkPub[$row->ID_DNA"";
  1585.            $LinkPub2 .= build_href1($row->LinkPub,"document""<br>";
  1586.         
  1587.  
  1588.          $tmp $row->Paper_Cache;
  1589.          $Paper_Cache[$row->ID_DNA.= $tmp;
  1590.        
  1591.          $tmp $row->GeneticLocusPub;
  1592.          $GeneticLocusPub[$row->ID_DNA.= $tmp;
  1593.          
  1594.          if($formSubmitSave{}
  1595.           else {
  1596.           $tmp $row->LinkPub;
  1597.           $LinkPub[$row->ID_DNA.= $tmp}
  1598.         }       
  1599.     
  1600.     /********************************************************************************************
  1601.     * Show hitlist  ($sqlType == "Dna")                                                         *
  1602.     * START                                                                                     *
  1603.     *********************************************************************************************/
  1604.     
  1605.     if($sqlType=="Dna"
  1606.     
  1607.  
  1608.       echo "<table border='0' id='tablesearch'><tr><td colspan='5'><a class='red' href=\"data_cleaning.php\">Back to Data Cleaning Overview.</a></td></tr>"
  1609.       $pagesum mysql_num_rows($result1);
  1610.       echo "<tr><td colspan='5' align='center'><b>".$sum;
  1611.       if($sum == 1{echo " entry "else echo " entries ";}
  1612.       echo "found for:</b>";
  1613.       
  1614.       foreach($descriptionall as $index => $descriptiontest)
  1615.       $valuetest $valueall[$index];
  1616.         echo $descriptiontest."[<b>".$valuetest."</b>]"}
  1617.       echo ".<input type='hidden' name='page' value='".$page."'></td></tr>";
  1618.        /**
  1619.        * paging hitlist
  1620.        */
  1621.        include("pages.php");  
  1622.       echo "<tr><td colspan='5'><hr /></td></tr></table>";
  1623.       $Dnacount=0;
  1624.        
  1625.       echo "<table border='0' id='tablesearch'>";
  1626.       echo "<th></th><th width='120'><a href='query_clean.php?hitlist=true&sort=DU";
  1627.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1628.       echo "'><img src='../images/";
  1629.       if($_GET['sort'== "DU" or $_GET['sort'== ""echo "upg.jpg"}
  1630.       else echo "up.jpg"}
  1631.       echo "' border='0'/></a>DNA Bank No<a href='query_clean.php?hitlist=true&sort=DD";
  1632.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1633.       echo"'><img src='../images/";
  1634.       if($_GET['sort'== "DD"echo "downg.jpg"}
  1635.       else echo "down.jpg"}
  1636.       echo "' border='0'/></a></th><th width='160'><a href='query_clean.php?hitlist=true&sort=SU";
  1637.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1638.       echo "'><img src='../images/";
  1639.       if($_GET['sort'== "SU"echo "upg.jpg"}
  1640.       else echo "up.jpg"}
  1641.       echo "' border='0'/></a>UnitID/Specimen No<a href='query_clean.php?hitlist=true&sort=SD";
  1642.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1643.       echo "'><img src='../images/";
  1644.       if($_GET['sort'== "SD"echo "downg.jpg"}
  1645.       else echo "down.jpg"}
  1646.       echo "' border='0'/></a></th><th width='200'><a href='query_clean.php?hitlist=true&sort=CU";
  1647.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1648.       echo "'><img src='../images/";
  1649.       if($_GET['sort'== "CU"echo "upg.jpg"}
  1650.       else echo "up.jpg"}
  1651.       echo "' border='0'/></a>Collection<a href='query_clean.php?hitlist=true&sort=CD";
  1652.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1653.       echo "'><img src='../images/";
  1654.       if($_GET['sort'== "CD"echo "downg.jpg"}
  1655.       else echo "down.jpg"}
  1656.       echo "' border='0'/></a></th><th width='120'><a href='query_clean.php?hitlist=true&sort=IU";
  1657.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1658.       echo "'><img src='../images/";
  1659.       if($_GET['sort'== "IU"echo "upg.jpg"}
  1660.       else echo "up.jpg"}
  1661.       echo "' border='0'/></a>Institution<a href='query_clean.php?hitlist=true&sort=ID";
  1662.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1663.       echo "'><img src='../images/";
  1664.       if($_GET['sort'== "ID"echo "downg.jpg"}
  1665.       else echo "down.jpg"}
  1666.       echo "' border='0'/></a></th><th><a href='query_clean.php?hitlist=true&sort=TU";
  1667.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1668.       echo "'><img src='../images/";
  1669.       if($_GET['sort'== "TU"echo "upg.jpg"}
  1670.       else echo "up.jpg"}
  1671.       echo "' border='0'/></a>Taxon<a href='query_clean.php?hitlist=true&sort=TD";
  1672.        if($_GET['page'!= ""echo "&page=".$_GET['page']}
  1673.       echo "'><img src='../images/";
  1674.       if($_GET['sort'== "TD"echo "downg.jpg"}
  1675.       else echo "down.jpg"}
  1676.       echo "' border='0'/></a></th>";
  1677.       echo "<tr><td colspan='6'><hr/></td></tr>";
  1678.       
  1679.       for ($i=1$i<=$pagesum$i++{
  1680.       $row=mysql_fetch_array($result1);
  1681.       {
  1682.         $Dnacount++;
  1683.         if($Dnacount<=$pagesize
  1684.          {
  1685.           $ID $row['ID_DNA'];
  1686.           $LinkSpecimen "sqlType=Detail&ID_DNA=".$ID;
  1687.           if($_GET['page'1$LinkSpecimen .= "&Page=".$_GET['page']}
  1688.           $number ($page-1)*$pagesize+$i;
  1689.           
  1690.           echo "<tr style='border-top-width:1px;border-top-style:solid;border-color:#CCCCCC;'><td valign='top' align='right'><b>".$number.".</b></td><td valign='top'><b><span style='margin-left:10px;'>".build_href("query_clean.php",
  1691.                       $LinkSpecimen,
  1692.                       $row['DNA_Bank_Number']"</span></b></td><td valign='top'><span style='margin-left:10px;'>".$row['UnitID_Specimen']."</span></td><td valign='top'><span style='margin-left:10px;'>".$row['CollectionCode_Specimen']."</a></td><td valign='top'><span style='margin-left:10px;'>".$row['InstitutionCode_Specimen']."</a></td><td valign='top'>";
  1693.  
  1694. echo $NameAuthorYear[$row['ID_DNA']];
  1695.         
  1696. echo "</td></tr>";
  1697.            
  1698.  
  1699.           }
  1700.         } } // for ($i=1; $i<=$pagesum; $i++) 
  1701.         
  1702.               echo "</table>";
  1703.       // if($sqlType=="Dna") 
  1704.  
  1705.       /********************************************************************************************
  1706.       * Show hitlist  ($sqlType == "Dna")                                                         *
  1707.       * END                                                                                       *
  1708.       *********************************************************************************************/
  1709.       
  1710.       /********************************************************************************************
  1711.       * Show details of a single record  ($sqlType == "Detail")                                   *
  1712.       * 1. Selecting DNA data from database                                                       *
  1713.       * 2. Selecting reference to specimen record                                                 *
  1714.       * 3. Getting specimen data live from original provider                                      *
  1715.       * 3a. When specimen provider is not available, show specimen data from cache tables         *
  1716.       * 3b. When specimen data recorded in Specimen Tool and not yet available via wrapper use    *
  1717.       *     another script (see line 1894)                                                        *
  1718.       * START                                                                                     *
  1719.       *********************************************************************************************/
  1720.       
  1721.      if($sqlType=="Detail")
  1722.      {
  1723.  
  1724.       echo "<table border='0' id='tablesearch'><tr><td width='80'><a class='red' href='query_clean.php'>Back to Data Cleaning Overview</a></td>"
  1725.       if($formSubmitSave)
  1726.       echo "<td><a class='red' href='query_clean.php?hitlist=true' name='formBackToHitlist'>Back to Hitlist</a></td>";
  1727.          if ($test1 == 'false1' or $test1 == 'false2')echo "<td>"
  1728.          /**
  1729.          * calling Error message
  1730.          */
  1731.          include("../config/Errorreport.php")}         
  1732.          
  1733.         if ($test1 != 'false1' and $test1 != 'false2'echo "<td align='right'><div class='background3'><span class='fine'>Changes accepted.</span></div>"}
  1734.         echo "</td></tr>"}
  1735.       else {
  1736.       echo "<td><a class='red' href='query_clean.php?hitlist=true";
  1737.        if($_GET['Page'!= ""echo "&page=".$_GET['Page']}
  1738.       
  1739.       echo "'>Back to Hitlist</a></td></tr>"}
  1740.       echo "</table>";
  1741.       
  1742.         /********************************************************************************************
  1743.         * Building table for DNA details                                                            *
  1744.         * START                                                                                     *
  1745.         *********************************************************************************************/
  1746.       
  1747.       echo "<table border='0' id='tabledetails' class='main'>";
  1748.  
  1749.       $Dnacount=0;
  1750.       while($row mysql_fetch_object($result1)) 
  1751.       {
  1752.         $Dnacount++;
  1753.         $ID_Cache $row->ID_Cache;
  1754.         
  1755.         /********************************************************************************************
  1756.         * Select further DNA samples from same voucher  ($test)                                     *
  1757.         * See also line 1960                                                                        *
  1758.         *********************************************************************************************/
  1759.         
  1760.         $test mysql_query("SELECT dnabanknumbers.ID_DNA, dnabanknumbers.DNA_Bank_Number, " .
  1761.                             "dnabanknumbers.Extraction_Date FROM dnabanknumbers, tmpDnaIDs " .
  1762.                             "WHERE dnabanknumbers.ID_Cache = '$ID_Cache.
  1763.                             "  AND dnabanknumbers.ID_DNA != tmpDnaIDs.ID_DNA " .
  1764.                             "ORDER BY LENGTH(dnabanknumbers.DNA_Bank_Number),dnabanknumbers.DNA_Bank_Number");
  1765.         
  1766.         if($Dnacount<=$pagesize
  1767.          {
  1768.           
  1769.           if($row->NoExtractDate == '1')
  1770.           $NoExtractDate "No Extraction Date available."}
  1771.           echo "<tr><td colspan='7'><hr></td></tr>",
  1772.           "<tr><td colspan='7'><h6>DNA details </h6></td></tr>",
  1773.  
  1774. "<tr><td id='DescriptionBlack2'>Extraction No</td><td colspan='2'><span class='details'>" $row->DNA_Bank_Number "</span></td>",
  1775. $row->Type "<td id='DescriptionBlack2'>DNA Type</td><td colspan='3'><span class='DescriptionGreen2'>" $row->Type "</span></td></tr>" "<td colspan='2'></td></tr>",
  1776.  
  1777. "<tr><td><h4>Relation to voucher </h4></td><td colspan='6'><h4>" $row->RelationDNA_Voucher "</h4></td></tr>",
  1778. "<tr>",
  1779. $row->Tissue "<td id='DescriptionBlack2'>Tissue</td><td colspan='2'><span class='DescriptionGreen2'>" $row->Tissue "</span></td>" "",
  1780. $row->Source_Gone "<td id='DescriptionBlack2'>Tissue source material gone</td><td colspan='3'><span class='DescriptionGreen2'>Yes</span></td>" "",
  1781. "</tr>",
  1782. $row->Preservation "<tr><td id='DescriptionBlack2'>Preservation</td><td colspan='6'><span class='DescriptionGreen2'>" $row->Preservation "</span></td></tr>" "",
  1783.  
  1784. "<tr><td colspan='7'><h4>Extraction </h4></td></tr>",
  1785.  
  1786. $row->Extraction_Date || $row->NoExtractDate "<tr><td id='DescriptionBlack2'>Extraction Date</td><td colspan='5'><span class='DescriptionGreen2'>" $row->Extraction_Date $NoExtractDate "</span></td></tr>" "",
  1787. "<tr>",
  1788. $row->Extraction_Method "<td id='DescriptionBlack2'>Extraction Method</td><td colspan='2'><span class='DescriptionGreen2'>" $row->Extraction_Method " (" $row->Extraction_Company ")</span></td>" "",
  1789. $Extraction_Staff "<td id='DescriptionBlack2'>Extraction Staff</td><td colspan='3'><span class='DescriptionGreen2'>" $Extraction_Staff "</span></td>" "",
  1790. "</tr>",
  1791.  
  1792. $row->Absorbance280 || $row->Absorbance230 || $row->Concentration || $row->Purification_Method || $row->Degradation || $row->Check_Date ?"<tr><td colspan='7'><h4>Quality </h4></td></tr>" "",
  1793.  
  1794. $row->Absorbance280 || $row->Absorbance230 "<tr><td id='DescriptionBlack2'>Ratio of Absorbance</td>" "",
  1795. $row->Absorbance280 "<td colspan='2'><span class='DescriptionGreen2'>" $row->Absorbance280 " OD<sub>260nm</sub>/OD<sub>280nm</sub></span></td>" "",
  1796. $row->Absorbance230 "<td></td><td colspan='3'><span class='DescriptionGreen2'>" $row->Absorbance230 " OD<sub>260nm</sub>/OD<sub>230nm</sub></span></td>" "",
  1797. $row->Absorbance280 || $row->Absorbance230 "</tr>" "",
  1798.  
  1799. "<tr>",
  1800. $row->Concentration "<td id='DescriptionBlack2'>Concentration</td><td colspan='2'><span class='DescriptionGreen2'>" $row->Concentration " ng/&#956;l</span></td>" "",
  1801. $row->Purification_Method "<td id='DescriptionBlack2'>Purification Method</td><td colspan='3'><span class='DescriptionGreen2'>" $row->Purification_Method " (" $row->Purificaton_Company ")</span></td>" "",
  1802. "</tr>",
  1803. "<tr>",
  1804. $row->Degradation "<td id='DescriptionBlack2'>Quality</td><td colspan='2'><span class='DescriptionGreen2'>" $row->Degradation "</span></td>" "",
  1805. $row->Check_Date "<td id='DescriptionBlack2'>Quality Check Date</td><td colspan='3'><span class='DescriptionGreen2'>" $row->Check_Date "</span></td>" "",
  1806. "</tr>",
  1807.  
  1808. $Link2 || $Fragment[$row->ID_DNA"<tr><td colspan='7'><h4>GenBank Entries </h4></td></tr>" "",
  1809. "<tr>",
  1810. $Fragment[$row->ID_DNA"<td id='DescriptionBlack2'>Genetic Locus</td><td colspan='6'><span class='DescriptionGreen2'>" $Fragment[$row->ID_DNA"</span></td>" "",
  1811. "</tr>",
  1812. $Link2 "<tr><td id='DescriptionBlack2' valign='top'>GenBank Acc.No/<br/>BOLD Process ID</td><td colspan='6'>" .$Link2 "</td></tr>" "",
  1813.  
  1814. $Provided_By_People || $row->Block_Until || $row->Block_General || $row->Notes "<tr><td colspan='7'><h4>Notes </h4></td></tr>" "",
  1815. $Provided_By_People "<tr><td id='DescriptionBlack2'>DNA Sample Provided By</td><td colspan='6'><span class='DescriptionGreen2'>" $Provided_By_People "</span></td></tr>" "",
  1816. "<tr>",
  1817. $row->Block_Until "<td id='DescriptionBlack2'>Blocked Until</td><td colspan='2'><span class='DescriptionGreen2'>" $row->Block_Until "</span></td>" "",
  1818. $row->Block_General "<td id='DescriptionBlack2'>Blocked in General</td><td colspan='3'><span class='DescriptionGreen2'>Yes</span></td>" "",
  1819. "</tr>",
  1820. "<tr>",
  1821. $row->Notes "<tr><td id='DescriptionBlack2'>Remarks for Customers</td><td colspan='6' valign='top'><span class='DescriptionGreen2'>" $row->Notes "</span></td>" "";
  1822. if ((isset($_SESSION['guest']&& $_SESSION['guest']|| ((isset($_SESSION['project']|| $_SESSION['project']&& $row->Created_Who != $log) ) 
  1823. {}
  1824. else {
  1825. echo $row->Notes_Intern "<tr><td id='DescriptionBlack2'>Internal Remarks</td><td colspan='6' valign='top'><span class='DescriptionGreen2'>" $row->Notes_Intern "</span></td>" ""}
  1826. echo "</tr>";
  1827.  
  1828. if ((isset($_SESSION['guest']&& $_SESSION['guest']|| ((isset($_SESSION['project']|| $_SESSION['project']&& $row->Created_Who != $log) ) 
  1829. {}
  1830. else {
  1831.  
  1832. echo "<tr class='background1'><td><h4>Stock/Aliquots</h4></td><td align='center'><h4>Fridge/Rack/Box</h4></td><td align='center'><h4>Barcode</h4></td><td align='center'><h4>Position</h4></td><td align='center'><h4>Source (&micro;l)</h4></td><td align='center'><h4>Remaining (&micro;l)</h4></td><td><h4>Price</h4></td></tr>",
  1833.  
  1834. $row->Stock_Gone "<tr><td id='DescriptionBlack2'>Stock material gone</td><td colspan='6'><span class='DescriptionGreen2'>Yes</span></td></tr>" "",
  1835. $Location_Fridge || $Location_Rack || $Location_Box || $Location_Volume || $Stock_Barcode || $Stock_Position "<tr><td id='DescriptionBlack2'><span class='DescriptionGreen2'>Stock ".$row->DNA_Bank_Number."&nbsp;&nbsp;&nbsp;</span></td><td align='center'><span class='DescriptionGreen2'>" $Location_Fridge "/" $Location_Rack " /" $Location_Box "</span></td><td align='center'><span class='DescriptionGreen2'> ".$Stock_Barcode."</span></td><td align='center'><span class='DescriptionGreen2'>".$Stock_Position."</span></td><td align='center'><span class='DescriptionGreen2'>" .$Location_Volume "</span></td><td align='center'><span class='DescriptionGreen2'>" $Location_Rest "</span></td></tr>" "<tr><td id='DescriptionBlack2'><span class='DescriptionGreen2'>Stock ".$row->DNA_Bank_Number."&nbsp;&nbsp;&nbsp;</span></td><td colspan='6'><span class='error'>No Stock made</span></td></tr>";
  1836.  
  1837. while($row2 mysql_fetch_object($result9))
  1838.        {         
  1839.          $Test4[$row2->Aliquots_Box;
  1840.          $Test5[$row2->Aliquots_Rack;
  1841.          $Test6[$row2->Aliquots_Fridge;
  1842.          $Test7[$row2->Aliquot_Number;
  1843.          $Test9[$row2->Aliquot_Origin;
  1844.          $Test10[$row2->Aliquot_Rest;
  1845.          $Test11[$row2->Aliquot_Barcode;
  1846.          $Test12[$row2->Aliquot_Position
  1847.          $Test13[$row2->Price." ".$row2->Currency;      }    
  1848.        
  1849. foreach($Test7 as $index => $NumberTest)
  1850. {
  1851.       $RackTest $Test5[$index];
  1852.       $FridgeTest $Test6[$index];
  1853.       $BoxTest $Test4[$index];
  1854.       $SourceQuantity $Test9[$index];
  1855.       $RestQuantity $Test10[$index];
  1856.       $Barcode $Test11[$index];
  1857.       $Position $Test12[$index];
  1858.       $Price $Test13[$index];
  1859.          
  1860.   
  1861.  
  1862. echo "<tr><td id='DescriptionBlack2'>Aliquot ".$NumberTest."</td><td valign='top' align='center'><span class='DescriptionGreen2'>".$FridgeTest."/".$RackTest."/".$BoxTest;
  1863.     echo "</span></td><td align='center'><span class='DescriptionGreen2'>".$Barcode."</span></td><td align='center'><span class='DescriptionGreen2'>".$Position."</span></td><td align='center'><span class='DescriptionGreen2'>".$SourceQuantity."</span></td><td align='center'><span class='DescriptionGreen2'>".$RestQuantity."</span></td><td align='center'><span class='DescriptionGreen2'>".$Price."</span></td></tr>";    }
  1864. // END if (!isset($_SESSION['guest']) && !$_SESSION['guest'])
  1865.  
  1866. echo $row->Backup_Aliquot "<tr><td id='DescriptionBlack2'>Backup Aliquot made</td><td colspan='6'><span class='DescriptionGreen2'>Yes</span></td></tr>" "<tr><td id='DescriptionBlack2'>Backup Aliquot made</td><td colspan='6'><span class='DescriptionGreen2'>No</span></td></tr>";
  1867.  
  1868. echo $Paper_Cache[$row->ID_DNA"<tr><td valign='top'><h4 class='background1'>Publications </h4></td><td valign='top'><b>Fragment</b><br><span class='DescriptionGreen2'>" $FragmentPub[$row->ID_DNA"</span></td><td colspan='4'><b>Publication</b><br><span class='DescriptionGreen2'>" $Paper_Cache[$row->ID_DNA"</span></td>" "",
  1869. $LinkPub[$row->ID_DNA&& $Paper_Cache[$row->ID_DNA"<td><br>" $LinkPub2 ."</td></tr>" "";
  1870.  
  1871. if (!isset($_SESSION['guest']&& !$_SESSION['guest'&& !isset($_SESSION['project']&& !$_SESSION['project']{
  1872.  
  1873. echo $Customer[$row->ID_DNA"<tr><td valign='top'><h4 class='background1'>Requests </h4></td><td colspan='3'><b>Customer</b><br><span class='DescriptionGreen2'>" $Customer[$row->ID_DNA"</span></td><td><b>Date</b><br><span class='DescriptionGreen2'>" $DateRequest "</span></td><td><b>Aliquot No</b><br><span class='DescriptionGreen2'>" $Request_Number_Aliquots[$row->ID_DNA"<(span></td><td valign='top'><b>Notes</b><br><span class='DescriptionGreen2'>" $Request_Notes[$row->ID_DNA"</span></td></tr>" ""}
  1874.  
  1875.           echo "</table>";
  1876.           
  1877.           /********************************************************************************************
  1878.           * Building table for DNA details                                                            *
  1879.           * END                                                                                       *
  1880.           *********************************************************************************************/
  1881.           
  1882.           /********************************************************************************************
  1883.           * Building table for specimen/voucher details                                               *
  1884.           * START                                                                                     *
  1885.           *********************************************************************************************/
  1886.           
  1887.           echo  "<table border='0' id='tablesearch'>";
  1888.            echo "<tr><td colspan='5'>";
  1889.           
  1890.           $ID_Dataset $row->ID_Dataset;      
  1891.           $Provider $row->Provider
  1892.           $QueryPart1b $row->QueryPart1b;
  1893.           $QueryPart1_1 $row->QueryPart1_1;
  1894.           $QueryPart1_2b $row->QueryPart1_2b;
  1895.           $QueryPart2 $row->QueryPart2;
  1896.           $QueryPart3 $row->QueryPart3;
  1897.           $QueryPart4 $row->QueryPart4;
  1898.           $QueryPart5 $row->QueryPart5;
  1899.           $Digir_Resource1 urlencode($row->Digir_Resource);
  1900.           $Digir_Source1 urlencode($row->Digir_Source);
  1901.           $ID_Schema $row->ID_Schema;
  1902.           $SourceUnitID urlencode($row->UnitID_Specimen);
  1903.           $SourceInstitutionCode urlencode($row->InstitutionCode_Specimen);
  1904.           $SourceCode urlencode($row->CollectionCode_Specimen);
  1905.           
  1906.           
  1907.          if($ID_Dataset == '1' and $Provider == '')
  1908.           {  /**
  1909.              * when specimen data are recorded in Specimen Tool ($ID_Dataset == '1') and this data are
  1910.              * not yet available via wrapper ($Provider == '') include another script
  1911.              */
  1912.              include ("../sptool/sptool.php");  }
  1913.  
  1914. else {  //data availabe via wrapper
  1915.           $searchform true;
  1916.           /**
  1917.           * calling script verify.php for getting specimen data from original data provider
  1918.           * sending parameter $searchform = true in opposite to calling same script during Input package
  1919.           * see script verify.php for more details
  1920.           */
  1921.           include ("../input/verify.php");
  1922.       
  1923. if($ProviderCheck == true{         
  1924.           
  1925.   echo "<h6>Specimen details (voucher) </h6></td></tr>",
  1926.   "<tr><td id='DescriptionGreen'>Specimen Number/UnitID</td><td>" $row->UnitID_Specimen "</td><td id='DescriptionGreen'>Specimen database</td><td colspan='2'>" $row->SpecimenDatabase "</td></tr>",            
  1927.   "<tr><td id='DescriptionGreen'>Collection Code</td><td>" $row->CollectionCode_Specimen "</td><td id='DescriptionGreen'>Institution Code</td><td colspan='2'>" $row->InstitutionCode_Specimen "</td></tr>"
  1928.   "<tr><td colspan='5'><h4 class='background1'>Identifications</h4></td></tr>",
  1929.   "<tr><td valign='top' id='DescriptionGreen'>Taxon Name </td><td valign='top'>";
  1930.   echo $NameAuthorYear[$row->ID_DNA];
  1931.  echo "</td>",
  1932.  $HigherTaxon[$row->ID_DNA"<td valign='top' id='DescriptionGreen'>Higher Taxon</td><td valign='top'>" $HigherTaxon[$row->ID_DNA"</td><td valign='top'>" $TaxonRank[$row->ID_DNA"</td></tr>" "",
  1933.  
  1934.   "<tr><td colspan='5'><h4 class='background1'>Gathering</h4></td></tr>",
  1935.   "<tr>",
  1936.   $row->CountryName "<td id='DescriptionGreen'>Country</td><td>" $row->CountryName "</td>" "",
  1937.   $row->CountryISO2 "<td id='DescriptionGreen'>Country ISO Code</td><td colspan='2'>" $row->CountryISO2 "</td>" "",   
  1938.   "</tr>",
  1939.   "<tr>"
  1940.   $row->ContinentOrOcean "<td id='DescriptionGreen'>Continent/Ocean</td><td>" $row->ContinentOrOcean "</b></td>" "",
  1941.   $row->Locality "<td id='DescriptionGreen' valign='top'>Locality</td><td colspan='2'>" $row->Locality "</td>" "",
  1942.   "</tr>",
  1943.   "<tr>",
  1944.   $row->Longitude || $row->Latitude "<td id='DescriptionGreen'>Long | Lat </td><td>" $row->Longitude " | ".$row->Latitude."</td>" "",
  1945.   $row->Altitude "<td id='DescriptionGreen'>Altitude</td><td colspan='2'>" $row->Altitude "</td>" "",
  1946.   "</tr>",
  1947.   "<tr>",
  1948.   $row->Collectors "<td id='DescriptionGreen'>Collector(s)</td><td>" $row->Collectors "</td>" "",
  1949.   $row->CollectionDate "<td id='DescriptionGreen'>Collection Date</td><td colspan='2'>" $row->CollectionDate "</td>" "",
  1950.   "</tr>",
  1951.   "<tr>",
  1952.   $row->CollectorsNo "<td id='DescriptionGreen'>Collectors' Number</td><td>" $row->CollectorsNo "</td>" "",
  1953.   $row->CollectionInfo_Other "<td id='DescriptionGreen'>Collection</td><td colspan='2'>" $row->CollectionInfo_Other "</td>" "",
  1954.   "</tr>",
  1955.  
  1956.   $ImageLink "<tr><td id='DescriptionGreen'>Multimedia</td><td colspan='4'>" $ImageLink "</td></tr>" "",
  1957.   
  1958.   $row->TypeStatus "<tr><td id='DescriptionGreen'>Type Status</td><td colspan='4'>" $row->TypeStatus "</td></tr>" ""
  1959.   // if($ProviderCheck == true)
  1960.  
  1961. //data availabe via wrapper
  1962.   echo "<tr><td colspan='5'><hr></td></tr></table>";
  1963.  
  1964.           /********************************************************************************************
  1965.           * Building table for specimen/voucher details                                               *
  1966.           * END                                                                                       *
  1967.           *********************************************************************************************/
  1968.  
  1969.           /********************************************************************************************
  1970.           * Building table for related DNA samples (source = same voucher/specimen) and details about *
  1971.           * creation date and staff of record and date and staff of last edit process                 *
  1972.           * START                                                                                     *
  1973.           *********************************************************************************************/
  1974.   
  1975.   echo "<table border='0' id='tablesearch' class='main'>";
  1976.  
  1977. if(mysql_num_rows($test0)
  1978.   {  echo "<tr><td colspan='7'><h6>Other DNA Samples from this voucher</h6></td></tr>"
  1979.    while($roww mysql_fetch_object($test))
  1980.   $Test_ID $roww->ID_DNA;
  1981.   echo "<tr><td id='DescriptionBlack2'>Extraction No</td><td colspan='6'>".build_href("query_clean.php","sqlType=Detail&ID_DNA=$Test_ID",$roww->DNA_Bank_Number)."</td></tr>"}
  1982.    echo "<tr><td colspan='7'><hr /></td></tr>"}
  1983.  
  1984. echo "<tr><td colspan='7'><h4>Dataset </h4></td></tr>",
  1985.  
  1986. "<tr><td id='DescriptionBlack2'>Created by</td><td colspan='6'><span class='DescriptionGreen2'>" $row->Created_Who " (" $row->Created_When ")</span></td></tr>",
  1987. $row->Update_Who "<tr><td id='DescriptionBlack2'>Last modified by</td><td colspan='6'><span class='DescriptionGreen2'>" $row->Update_Who " (" $row->Update_When ")</span></td></tr>" "",   
  1988. "<tr><td colspan='7' align='right'>";
  1989. if($formSubmitSave)
  1990. {$sql0 "UPDATE dnabanknumbers SET Lock_Who = '', Lock_When = '' WHERE dnabanknumbers.ID_DNA = '$ID_DNA'";
  1991.     $result0 mysql_query($sql0);}
  1992. else 
  1993.  
  1994. if ((isset($_SESSION['guest']&& $_SESSION['guest']|| ((isset($_SESSION['project']|| $_SESSION['project']&& $row->Created_Who != $log) ) 
  1995. {}
  1996.  
  1997. else {
  1998.  
  1999.           /********************************************************************************************
  2000.           * Locking record if another user is editing the same record at the same time                *
  2001.           * see also update_clean.php line 29                                                         *
  2002.           *********************************************************************************************/
  2003.  
  2004. $sql10 "SELECT ID_DNA, Lock_Who, Lock_When FROM dnabanknumbers WHERE ID_DNA = '$ID_DNA'";
  2005. $result10 mysql_query($sql10);
  2006.  
  2007. while($row mysql_fetch_object($result10))
  2008. $TestWho $row->Lock_Who
  2009.   $TestWhen $ow->Lock_When;}
  2010. if($TestWho == "")
  2011. echo "<input type='submit' name='formSubmitUpdate' value='Edit Dataset'></td></tr>"}
  2012. if($TestWho != "")
  2013. {
  2014. $TestWhen2 $TestWhen "0000-00-00 00:30:00";
  2015. if($TestWhen2 >= $Current_Date)
  2016. if($TestWho != $log)
  2017. {echo "Dataset temporarily not editable."}
  2018. }
  2019. if($TestWhen2 $Current_Date or $TestWho == $log)
  2020. $sql11 "UPDATE dnabanknumbers SET Lock_Who = '', Lock_When = '' WHERE dnabanknumbers.ID_DNA = '$ID_DNA'";
  2021.   $result11 mysql_query($sql11);
  2022.   echo "<input type='submit' name='formSubmitUpdate' value='Edit Dataset'></td></tr>";  
  2023.     }}
  2024.     
  2025.  } }
  2026. echo "</table>"
  2027.  
  2028.          /********************************************************************************************
  2029.           * Building table for related DNA samples (source = same voucher/specimen) and details about *
  2030.           * creation date and staff of record and date and staff of last edit process                 *
  2031.           * END                                                                                       *
  2032.           *********************************************************************************************/
  2033.           
  2034.           // if($Dnacount<=$pagesize) 
  2035.         //$Dnacount=0;  while($row = mysql_fetch_object($result1)) 
  2036.       }  //  if($sqlType=="Detail")
  2037.       
  2038.       /********************************************************************************************
  2039.       * Show details of a single record  ($sqlType == "Detail")                                   *
  2040.       * END                                                                                       *
  2041.       *********************************************************************************************/
  2042.       
  2043.     mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
  2044.  
  2045.  
  2046. //user has access to data
  2047. //if(!empty($sql))
  2048.  
  2049. }  /********************************************************************************************
  2050.     * Saving edited record                                                                      *
  2051.     * END                                                                                       *
  2052.     *********************************************************************************************/
  2053.  
  2054. ?>
  2055.  
  2056. </td>
  2057. </tr>
  2058. </form>
  2059. </table>
  2060. <?php
  2061.     /**
  2062.     * including footer
  2063.     */
  2064.     include("../footer.php")?> 
  2065. </div>
  2066. </body>
  2067. </html>

Documentation generated on Tue, 29 Nov 2011 10:45:04 +0100 by phpDocumentor 1.4.3