Location: PHPKode > projects > Druid Defect Control > defectcontrol_0.9.4/tts/verifypost.php
<?php ob_start();

require_once 'database.php'; 
require_once 'history.php';
require_once 'usercheck.php';
require_once 'errors.php';

define ("VERIFIED_DEFECT_CODE", 4);
define ("VERIFICATION_ENCLOSURE_TITLE", "Verification info");


    // connect to the db
    ttdb_connect($connection);
    ttdb_beginTransaction($connection);

    // update the status of the defect
    $updatesql="update defect ".
        " set iiddefectstatus = ".VERIFIED_DEFECT_CODE.
        " where iid=$iddefect;";

    // execute it
    $result= ttdb_execQuery($connection,$updatesql);
    if(!$result){
        tter_errorWithBackButton("An error occurred updating the database. [$updatesql]</br>");
        ttdb_rollbackTransaction($connection);
        exit;
    }

    tt_historyEntry($connection, $iddefect, "Moved to state Verified by $ddts_username");

    // insert also the enclosure
    
    $newEnclosureId = ttdb_getSequenceValue($connection, 'enclosure');    
    
    $insertsql="insert into enclosure ".
        "(iid, iiddefect,stitle,stext) ".
        "values ($newEnclosureId, $iddefect,'".
        VERIFICATION_ENCLOSURE_TITLE."','$fVerificationDescription');";

    $result= ttdb_execQuery($connection,$insertsql);
    if(!$result){
        tter_errorWithBackButton("An error ocurred inserting description. [$insertsql]</br>");
        ttdb_rollbackTransaction($connection);
        exit;
    }

    tt_historyEntry($connection, $iddefect, "Added enclosure ".VERIFICATION_ENCLOSURE_TITLE." by $ddts_username");    

    // go to the VisualizeForm page
    ttdb_commitTransaction($connection);
    ttdb_close($connection);

    require_once('triggers.php');
    executeTrigger("verify", $iddefect);
    
    header("Location: visualize.php?iddefect=$iddefect");
    ob_end_flush();
?>
Return current item: Druid Defect Control