Source for file update_clean.php

Documentation is available at update_clean.php

  1. <?php
  2. /**
  3. * Editing records
  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.         <table border="0" id="table2">
  13.     <tr>
  14.     <tr><td colspan="4"><a class="red" href="data_cleaning.php">Back to Data Cleaning Overview.</a></td></tr>
  15.     <tr><td colspan="4"><a class="red" href="query_clean.php?hitlist=true" name="formBackToHitlist">Back to Hitlist</a></td></tr>
  16.     <td colspan="6">
  17. <?php if (($formSubmitUpdate or $formSubmitVerifyand (!isset($_SESSION['guest']&& !$_SESSION['guest']))
  18. {
  19.           /********************************************************************************************
  20.           * guests don't have permission for editing records                                          *
  21.           *********************************************************************************************/
  22.     
  23.     $Current_Date date('Y-m-d H:i:s');  
  24.     
  25.           /********************************************************************************************
  26.           * Locking record if another user is editing the same record at the same time                *
  27.           * see also query_clean.php line 1986                                                        *
  28.           *********************************************************************************************/
  29.     
  30.     $result0 "UPDATE dnabanknumbers SET Lock_Who = '$log', Lock_When = '$Current_Date' WHERE dnabanknumbers.ID_DNA = '$ID_DNA'";
  31.     $sql0 mysql_query($result0);
  32.     
  33.     
  34.           /********************************************************************************************
  35.           * Selecting all data from database, including specimen data from cache tables               *
  36.           * Note: Currently only DNA data can be edited; reference to voucher/specimen can not be 
  37.           * changed so far                                                                            *
  38.           *********************************************************************************************/
  39.  $result1 mysql_query
  40.         ("SELECT dnabanknumbers.ID_DNA, " .
  41.          "       dnabanknumbers.ID_Cache, " .
  42.          "       dnabanknumbers.Dna_Bank_Number, " .
  43.          "       dnabanknumbers.Extraction_Date, " .
  44.          "       dnabanknumbers.NoExtractDate, " .
  45.          "       dnabanknumbers.Absorbance280, " .
  46.          "       dnabanknumbers.Absorbance230, " .
  47.          "       dnabanknumbers.Concentration, " .
  48.          "       dnabanknumbers.Check_Date, " .
  49.          "       dnabanknumbers.Created_Who, " .
  50.          "       dnabanknumbers.Created_When, " .
  51.          "       dnabanknumbers.Stock_Gone, " .
  52.          "       dnabanknumbers.Source_Gone, " .         
  53.          "       dnabanknumbers.Block_Until, " .
  54.          "       dnabanknumbers.Block_General, " .
  55.          "       dnabanknumbers.Notes, " .
  56.          "       dnabanknumbers.Notes_Intern, " .
  57.          "       dnabanknumbers.Backup_Aliquot, " .
  58.          "       dnabanknumbers.Update_Who, " .
  59.          "       dnabanknumbers.Update_When, " .
  60.          "       dnabanknumbers.ID_RelationDNA_Voucher, " 
  61.          "       dnabanknumbers.ID_Type, " .
  62.          "       dnabanknumbers.ID_Preservation, " .
  63.          "       dnabanknumbers.ID_Tissue, " .
  64.          "       dnabanknumbers.ID_Extraction_Method, " .
  65.          "       dnabanknumbers.ID_Extraction_Staff, " .
  66.          "       dnabanknumbers.ID_Purification, " .
  67.          "       dnabanknumbers.ID_Degradation, " .
  68.          "       dnabanknumbers.ID_Provided_By_People AS ProvidedBy, " .
  69.          "       cachecollection.ID_Dataset_Specimen, " .
  70.          "       cachecollection.UnitID_Specimen, " .
  71.          "       cachecollection.CollectionCode_Specimen, " .
  72.          "       cachecollection.InstitutionCode_Specimen, " 
  73.          "       cachecollection.ContinentOrOcean, " .
  74.          "       cachecollection.CountryName, " 
  75.          "       cachecollection.CountryISO2, " 
  76.          "       cachecollection.Collectors, " 
  77.          "       cachecollection.CollectorsNo, " .          
  78.          "       cachecollection.CollectionDate, " 
  79.          "       cachecollection.Locality, " .
  80.          "       cachecollection.Altitude, " 
  81.          "       cachecollection.Longitude, " .
  82.          "       cachecollection.Latitude, " 
  83.          "       cachecollection.CollectionInfo_Other, " .
  84.          "       dataset.Display AS SpecimenDatabase " .
  85.          "  FROM dnabanknumbers " .
  86.          "       LEFT JOIN cachecollection ON dnabanknumbers.ID_Cache = cachecollection.ID_Cache " .
  87.          "       LEFT JOIN people ON dnabanknumbers.ID_Extraction_Staff = people.ID_People " .
  88.          "       LEFT JOIN dataset ON cachecollection.ID_Dataset_Specimen = dataset.ID_Dataset " .         
  89.          " WHERE dnabanknumbers.ID_DNA = '$ID_DNA'");
  90.         
  91.         $result4 mysql_query
  92.         ("SELECT dnabanknumbers.ID_DNA, " .
  93.          "       amplifications.GenBankNumber AS GenBankNumber, " .
  94.          "       amplifications.Link AS Link, " .
  95.          "       geneticlocus.GeneticLocus AS GeneticLocus " .
  96.          "  FROM dnabanknumbers " .
  97.          "  LEFT JOIN amplifications ON dnabanknumbers.ID_DNA = amplifications.ID_DNA " .
  98.          "  LEFT JOIN geneticlocus ON amplifications.ID_GeneticLocus = geneticlocus.ID_GeneticLocus " .
  99.          " WHERE amplifications.ID_DNA = '$ID_DNA.
  100.          " ORDER BY amplifications.ID_Amplification");
  101.          
  102.         $result5 mysql_query
  103.         ("SELECT dnabanknumbers.ID_DNA, " .
  104.          "       location_stock.Origin_Quantity AS Location_Volume, " .
  105.          "       location_stock.Rest_Quantity AS Location_Rest, " .
  106.          "       location_stock.Stock_Barcode AS Stock_Barcode, " .
  107.          "       location_stock.Stock_Position AS Stock_Position, " .         
  108.          "       location_stock.ID_Stock_Box AS Location_Box, " .
  109.          "       location_stock.ID_Stock_Rack AS Location_Rack, " .
  110.          "       location_stock.ID_Stock_Fridge AS Location_Fridge " .
  111.          "  FROM dnabanknumbers " .
  112.          "  LEFT JOIN location_stock ON dnabanknumbers.ID_Location_Stock = location_stock.ID_Location_Stock " .
  113.          " WHERE dnabanknumbers.ID_DNA = '$ID_DNA'");
  114.          
  115.        while($row mysql_fetch_object($result5))
  116.        $Stock_Box $row->Location_Box
  117.          $Stock_Rack $row->Location_Rack
  118.          $Stock_Fridge $row->Location_Fridge
  119.          $Stock_Source_Volume $row->Location_Volume;
  120.          $Stock_Rest_Volume $row->Location_Rest
  121.          $Stock_Barcode $row->Stock_Barcode;
  122.          $Stock_Position $row->Stock_Position;}
  123.          
  124.         $result7 mysql_query
  125.         ("SELECT dnabanknumbers.ID_DNA, " .
  126.          "       aliquots_box.Aliquots_Box AS Aliquots_Box, " .
  127.          "       aliquots_rack.Aliquots_Rack AS Aliquots_Rack, " .
  128.          "       aliquots_fridge.Aliquots_Fridge AS Aliquots_Fridge, " .         
  129.          "       aliquots.Aliquot_Number AS Aliquot_Number, " .
  130.          "       aliquots.Origin_Quantity AS Aliquot_Origin, " .
  131.          "       aliquots.Rest_Quantity AS Aliquot_Rest, " .
  132.          "       aliquots.Aliquot_Position AS Aliquot_Position, " .
  133.          "       aliquots.Aliquot_Barcode AS Aliquot_Barcode, " .
  134.          "       aliquots.ID_Aliquots " .
  135.          "  FROM dnabanknumbers " .
  136.          "  LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.ID_DNA " .
  137.          "  LEFT JOIN aliquots_box ON aliquots_box.ID_Aliquots_Box = aliquots.ID_Aliquots_Box " .
  138.          "  LEFT JOIN aliquots_rack ON aliquots_rack.ID_Aliquots_Rack = aliquots.ID_Aliquots_Rack " .
  139.          "  LEFT JOIN aliquots_fridge ON aliquots_fridge.ID_Aliquots_Fridge = aliquots.ID_Aliquots_Fridge " .      
  140.          " WHERE dnabanknumbers.ID_DNA = '$ID_DNA'");
  141.        
  142.         $result8 mysql_query
  143.         ("SELECT dnabanknumbers.ID_DNA AS ID_DNA, " .
  144.          "       dnabanknumbers.ID_Cache, " .
  145.          "       cachecollection.ID_Cache, " .
  146.          "       cachetaxonidentified.NameAuthorYear AS NameAuthorYear, " .
  147.          "       cachetaxonidentified.PreferredFlag AS PreferredFlag " .
  148.          "  FROM cachecollection, cachetaxonidentified, dnabanknumbers " .
  149.          " WHERE cachetaxonidentified.ID_Cache = cachecollection.ID_Cache " .
  150.          "   AND cachecollection.ID_Cache = dnabanknumbers.ID_Cache " .
  151.          "   AND dnabanknumbers.ID_DNA = $ID_DNA");
  152.  
  153.      while($row mysql_fetch_object($result8))
  154.        {
  155.          $NameAuthorYear[$row->NameAuthorYear
  156.          $PreferredFlag[$row->PreferredFlag}
  157.  
  158.         $result9 mysql_query
  159.         ("SELECT dnabanknumbers.ID_DNA AS ID_DNA, " .
  160.          "       dnabanknumbers.ID_Cache, " .
  161.          "       cachecollection.ID_Cache, " .
  162.          "       cachetaxonidentified.ID_TaxonIdentified, " .
  163.          "       cachehighertaxa.HigherTaxon AS HigherTaxon, " .
  164.          "       cachehighertaxa.TaxonRank AS TaxonRank " .
  165.          "  FROM cachecollection, cachetaxonidentified, cachehighertaxa, dnabanknumbers " .
  166.          " WHERE cachehighertaxa.ID_CacheTaxonIdentified = cachetaxonidentified.ID_TaxonIdentified " .
  167.          "   AND cachetaxonidentified.ID_Cache = cachecollection.ID_Cache " .
  168.          "   AND cachecollection.ID_Cache = dnabanknumbers.ID_Cache " .
  169.          "   AND dnabanknumbers.ID_DNA = $ID_DNA");
  170.                  
  171.  while($row mysql_fetch_object($result9))
  172.        {
  173.     $HigherTaxon[$row->HigherTaxon;
  174.     $TaxonRank[$row->TaxonRank;    }
  175.          
  176. while($row mysql_fetch_object($result1)) 
  177.       {      
  178.     $Relation $row->ID_RelationDNA_Voucher;
  179.     $ID_Cache $row->ID_Cache;
  180.     $Type $row->ID_Type;
  181.     $Preservation $row->ID_Preservation;
  182.     $Tissue $row->ID_Tissue;
  183.     $ExtractionMethod $row->ID_Extraction_Method;
  184.     $ExtractionStaff $row->ID_Extraction_Staff;
  185.     $DNA_Bank_Number $row->Dna_Bank_Number;
  186.     $Extraction_Date $row->Extraction_Date;
  187.     $NoExtractDate $row->NoExtractDate;
  188.     $Absorbance230 $row->Absorbance230;
  189.     $Absorbance280 $row->Absorbance280;
  190.     $Concentration $row->Concentration;
  191.     $Purification_Method $row->ID_Purification_Method;    
  192.     $Degradation $row->ID_Degradation;
  193.     $Check_Date $row->Check_Date;
  194.     $Number_Aliquots $row->Number_Aliquots;
  195.     $Quantity_All_Aliquots $row->Quantity_All_Aliquots;
  196.     $Block_Until $row->Block_Until;
  197.     $Notes $row->Notes;
  198.     $Notes_Intern $row->Notes_Intern;
  199.     $Block_General $row->Block_General;
  200.     $Source_Gone $row->Source_Gone;
  201.     $Stock_Gone $row->Stock_Gone;
  202.     $Backup $row->Backup_Aliquot;
  203.     $ProvidedBy $row->ProvidedBy;
  204.  
  205.  
  206.           /********************************************************************************************
  207.           * building table for specimen cache data                                                    *
  208.           * START                                                                                     *
  209.           *********************************************************************************************/
  210.    echo "<table border='0' width='100%'><tr><td colspan='5'>",
  211.   "<h4 class='background1'>Specimen details (voucher) </h4></td></tr>";
  212.   
  213.   echo "<tr><td  id='DescriptionGreen'>Specimen Number/UnitID</td><td>" $row->UnitID_Specimen "</td><td  id='DescriptionGreen'>Specimen database</td><td>" $row->SpecimenDatabase "</td></tr>",            
  214.   "<tr><td  id='DescriptionGreen'>Collection Code</td><td>" $row->CollectionCode_Specimen "</td><td  id='DescriptionGreen'>Institution Code</td><td>" $row->InstitutionCode_Specimen "</td></tr>";
  215.  
  216.   echo "<tr><td colspan='5'><h4 class='background1'>Identifications</h4></td></tr>",
  217.   "<tr><td id='DescriptionGreen' valign='top'>Taxon Name</td><td valign='top'>";
  218.   if($NameAuthorYear{
  219. foreach($NameAuthorYear as $index => $NameAuthorYearTest)
  220. {
  221.    echo $NameAuthorYearTest;
  222.    if($PreferredFlag[$index== '1' or $PreferredFlag[$index== 'true'echo " (Preferred Name)"}
  223.    echo "<br>"
  224.  
  225.    echo "</td><td id='DescriptionGreen' valign='top'>Higher Taxon</td><td valign='top'>"}
  226.    else echo "</td><td id='DescriptionGreen' valign='top'>Higher Taxon</td><td valign='top'>"}
  227.    if($HigherTaxon{
  228.    foreach($HigherTaxon as $HigherTaxonTest)
  229.     {
  230.     echo $HigherTaxonTest "<br>"}
  231.     
  232.    echo "</td><td valign='top'>";
  233.    
  234.    foreach($TaxonRank as $TaxonRankTest)
  235.    {
  236.     echo $TaxonRankTest "<br>"}
  237.     
  238.     echo "</td></tr>"}
  239.     else echo "</td><td></td></tr>"}
  240.  
  241.    echo "<tr><td colspan='5'><h4 class='background1'>Collection Info</h4></td></tr>",
  242.   "<tr>",
  243.   $row->CountryName "<td id='DescriptionGreen'>Country</td><td>" $row->CountryName "</td>" "",
  244.   $row->CountryISO2 "<td id='DescriptionGreen'>Country ISO Code</td><td colspan='2'>" $row->CountryISO2 "</td>" "",   
  245.   "</tr>",
  246.   "<tr>"
  247.   $row->ContinentOrOcean "<td id='DescriptionGreen' valign='top'>Continent/Ocean</td><td valign='top'>" $row->ContinentOrOcean "</b></td>" "",
  248.   $row->Locality "<td id='DescriptionGreen' valign='top'>Locality</td><td colspan='2'>" $row->Locality "</td>" "",
  249.   "</tr>",
  250.   "<tr>",
  251.   $row->Longitude || $row->Latitude "<td id='DescriptionGreen'>Long | Lat</td><td>" $row->Longitude " | ".$row->Latitude."</td>" "",
  252.   $row->Altitude "<td id='DescriptionGreen'>Altitude</td><td colspan='2'>" $row->Altitude "</td>" "",
  253.   "</tr>",
  254.   "<tr>",
  255.   $row->Collectors "<td id='DescriptionGreen'>Collector(s)</td><td>" $row->Collectors "</td>" "",
  256.   $row->CollectionDate "<td id='DescriptionGreen'>Collection Date</td><td colspan='2'>" $row->CollectionDate "</td>" "",
  257.   "</tr>",
  258.   "<tr>",
  259.   $row->CollectorsNo "<td id='DescriptionGreen'>Collectors' Number</td><td>" $row->CollectorsNo "</td>" "",
  260.   $row->CollectionInfo_Other "<td id='DescriptionGreen'>Collection</td><td colspan='2'>" $row->CollectionInfo_Other "</td>" "",
  261.   "</tr>",
  262.  
  263.   $ImageLink "<tr><td id='DescriptionGreen'>Multimedia</td><td colspan='4'>" $ImageLink "</td></tr>" "",
  264.   
  265.   $row->TypeStatus "<tr><td id='DescriptionGreen'>Type Status</td><td colspan='4'>" $row->TypeStatus "</td></tr>" ""
  266.  
  267.   "</table>";
  268.   
  269.           /********************************************************************************************
  270.           * building table for specimen cache data                                                    *
  271.           * END                                                                                       *
  272.           *********************************************************************************************/
  273.   
  274.   echo "</td></tr>";
  275.   
  276.    /**
  277.     * calling Ajax.html for getting last entered DNA number
  278.     */
  279.    include ("../ajax/Ajax.html");
  280.  ?>      
  281.       <tr><td colspan="6">
  282.       <table border="0" width="100%"> 
  283. <?php     
  284.     /**
  285.     * calling inputdna.php for editing DNA data
  286.     * see inputdna.php for more details
  287.     */
  288.     include("../input/inputdna.php")?>
  289.       
  290. </table>
  291.   
  292.   </td></tr></table>
  293. <?php
  294. }
  295. }
  296.  
  297.  ?>

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