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

$person_role = 3;
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_approve"]))
{
  if (!database_approve_record($webdoc["test_run_id"])) $webdoc["message"][]=database_get_message("record_approved");     
}

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");
  else $webdoc["message"][]=database_get_message("record_approved");
}

?>