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

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

define ("POSTPONED_ENCLOSURE_TITLE","Postponed");
define ("POSTPONED_DEFECT_CODE",6);

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

    // update the status of the defect
    $updatesql="update defect ".
        "set iiddefectstatus = ".POSTPONED_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 Postponed by $ddts_username");    

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

    $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 ".POSTPONED_ENCLOSURE_TITLE." by $ddts_username");

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

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