<?php
global $webdoc;
$webdoc["page_title"].=" - Set Tested Test Run";

$person_role = 5;
if (!auth($person_role)) 
{
  $webdoc["message"][]=database_get_message("no_permission");
  $template->template_assign("no_display",true);
  return;
}

$webdoc["test_run_id"]=$_REQUEST["test_run_id"];

if (isset($_POST["button_tested"]))
{
  if (!database_tested_record($webdoc["test_run_id"])) $webdoc["message"][]=database_get_message("record_tested");     
}

if (isset($_REQUEST["test_run_id"])) //test existence test_id
{
  $result=database_query("SELECT * FROM test_run WHERE test_run_id LIKE '$webdoc[test_run_id]'");
  $list = database_fetch_array($result);
  $template->template_assign("list",$list);
  
  if ($list["approved"]==0)
  { 
    $webdoc["message"][]=database_get_message("record_not_approved");
    $no_display=true;
    $template->template_assign("no_display",$no_display);
  }
  else
  {
    if ($list["tested"]==0) $webdoc["message"][]=database_get_message("record_not_tested");
    else $webdoc["message"][]=database_get_message("record_tested");
  }
}

?>