Location: PHPKode > projects > Druid Defect Control > defectcontrol_0.9.4/tts/history.php
<?php

include_once 'database.php';

/* Sends a notification mail in case it was requested by the submitter. 
 * Returns: 
 */
function tt_emailSubmitter($db, $iddefect, $text)
{

    $query = "SELECT bnotifychanges, semail FROM users u, defect d WHERE".
        " d.iidsubmitter = u.iid AND".
        " d.iid = '$iddefect'";

    $res = ttdb_execQuery($db, $query);
    
    $userInfo = ttdb_getArray($res);
    
    if (is_array($userInfo)) {        

//        echo "userinfo: <br>";
//        echo "notifychanges: ".$userInfo['bnotifychanges']."<br>"; 
//        echo "email: ".$userInfo['semail']."<br>"; 

        if ($userInfo['bnotifychanges'] == "t") {
//            echo "sending mail";
            mail($userInfo['semail'], 
                "DCS defect $iddefect updated", 
                $text);
        }
    }
}

/* __ Exported API ________________________________________________________ */

/* 
 * Returns: 
 */
function tt_historyEntry($db, $iddefect, $text)
{
    
    $date = date('Y-m-d H:i:s');
    //echo $date;
    
    $newId = ttdb_getSequenceValue($db, 'history');
    
    $query = "insert into history".
             "(iid, iiddefect,ddate,stext)".
             "values".
             "($newId, $iddefect,'$date','$text')";
    
    ttdb_execQuery($db, $query);
    

    tt_emailSubmitter($db, $iddefect, $text);        
        
}

?>
Return current item: Druid Defect Control