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

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

define ("OPENED_DEFECT_CODE",2);

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

    // the variable with the defect is idDefect

    $updatesql="update defect ".
        " set iiddefectstatus = ".OPENED_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 Open by $ddts_username");

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

    require_once('triggers.php');
    executeTrigger("open", $iddefect);

    header("Location: visualize.php?iddefect=$iddefect");
    ob_end_flush();
?>
Return current item: Druid Defect Control