function requirement_add($project_id, $name, $area_covered, $type, $record_or_file, $version, $status, $priority, $filename, $detail = "", $reason_for_change, $assign_to, $assign_to_release, $upload_by, $functionality, $assoc_req)
{
    global $db;
    $tbl_req = REQ_TBL;
    $f_req_proj_id = $tbl_req . "." . REQ_PROJECT_ID;
    $f_req_id = $tbl_req . "." . REQ_ID;
    $f_req_filename = $tbl_req . "." . REQ_FILENAME;
    $f_req_area_covered = $tbl_req . "." . REQ_AREA_COVERED;
    $f_req_type = $tbl_req . "." . REQ_TYPE;
    $f_req_parent = $tbl_req . "." . REQ_PARENT;
    $f_req_label = $tbl_req . "." . REQ_LABEL;
    $f_req_unique_id = $tbl_req . "." . REQ_UNIQUE_ID;
    $f_req_functionality = $tbl_req . "." . REQ_FUNCTIONALITY;
    $f_req_locked_by = $tbl_req . "." . REQ_LOCKED_BY;
    $f_req_locked_date = $tbl_req . "." . REQ_LOCKED_DATE;
    $f_req_rec_file = $tbl_req . "." . REQ_REC_FILE;
    $f_req_priority = $tbl_req . "." . REQ_PRIORITY;
    $tbl_req_ver = REQ_VERS_TBL;
    $f_req_ver_uid = $tbl_req_ver . "." . REQ_VERS_UNIQUE_ID;
    $f_req_ver_req_id = $tbl_req_ver . "." . REQ_VERS_REQ_ID;
    $f_req_ver_version = $tbl_req_ver . "." . REQ_VERS_VERSION;
    $f_req_ver_timestamp = $tbl_req_ver . "." . REQ_VERS_TIMESTAMP;
    $f_req_ver_uploaded_by = $tbl_req_ver . "." . REQ_VERS_UPLOADED_BY;
    $f_req_ver_filename = $tbl_req_ver . "." . REQ_VERS_FILENAME;
    $f_req_ver_comments = $tbl_req_ver . "." . REQ_VERS_COMMENTS;
    $f_req_ver_status = $tbl_req_ver . "." . REQ_VERS_STATUS;
    $f_req_ver_shed_release = $tbl_req_ver . "." . REQ_VERS_SCHEDULED_RELEASE_IMP;
    $f_req_ver_shed_build = $tbl_req_ver . "." . REQ_VERS_SCHEDULED_BUILD_IMP;
    $f_req_ver_actual_release = $tbl_req_ver . "." . REQ_VERS_ACTUAL_RELEASE_IMP;
    $f_req_ver_actual_build = $tbl_req_ver . "." . REQ_VERS_ACTUAL_BUILD_IMP;
    $f_req_ver_detail = $tbl_req_ver . "." . REQ_VERS_DETAIL;
    $f_req_ver_release = $tbl_req_ver . "." . REQ_VERS_ASSIGN_RELEASE;
    $f_req_ver_latest = $tbl_req_ver . "." . REQ_VERS_LATEST;
    $f_req_ver_reason_change = $tbl_req_ver . "." . REQ_VERS_REASON_CHANGE;
    $f_req_ver_assigned = $tbl_req_ver . "." . REQ_VERS_ASSIGNED_TO;
    $f_req_ver_last_updated = $tbl_req_ver . "." . REQ_VERS_LAST_UPDATED;
    $f_req_ver_last_updated_by = $tbl_req_ver . "." . REQ_VERS_LAST_UPDATED_BY;
    $last_updated = date_get_short_dt();
    $s_user_properties = session_get_user_properties();
    $s_user_name = $s_user_properties['username'];
    $last_updated_by = $s_user_name;
    if ($area_covered == '') {
        $area_covered = 0;
    }
    if ($type == '') {
        $type = 0;
    }
    $q = "\tINSERT INTO {$tbl_req}\n\t\t\t\t(\t{$f_req_proj_id},\n\t\t\t\t\t{$f_req_filename},\n\t\t\t\t\t{$f_req_area_covered},\n\t\t\t\t\t{$f_req_type},\n\t\t\t\t\t{$f_req_rec_file},\n\t\t\t\t\t{$f_req_priority},\n\t\t\t\t\t{$f_req_parent} )\n\t\t\tVALUES\n\t\t\t\t(\t'{$project_id}',\n\t\t\t\t\t'{$name}',\n\t\t\t\t\t'{$area_covered}',\n\t\t\t\t\t'{$type}',\n\t\t\t\t\t'{$record_or_file}',\n\t\t\t\t\t'{$priority}',\n\t\t\t\t\t'{$assoc_req}' )";
    db_query($db, $q);
    //print"$q<br>";
    $req_id = db_get_last_autoincrement_id($db);
    $q = "\tINSERT INTO {$tbl_req_ver}\n\t\t\t\t(\t{$f_req_ver_req_id},\n\t\t\t\t\t{$f_req_ver_version},\n\t\t\t\t\t{$f_req_ver_timestamp},\n\t\t\t\t\t{$f_req_ver_uploaded_by},\n\t\t\t\t\t{$f_req_ver_filename},\n\t\t\t\t\t{$f_req_ver_status},\n\t\t\t\t\t{$f_req_ver_detail},\n\t\t\t\t\t{$f_req_ver_reason_change},\n\t\t\t\t\t{$f_req_ver_assigned},\n\t\t\t\t\t{$f_req_ver_latest},\n\t\t\t\t\t{$f_req_ver_last_updated},\n\t\t\t\t\t{$f_req_ver_last_updated_by} )\n\t\t\tVALUES\n\t\t\t\t(\t{$req_id},\n\t\t\t\t\t'{$version}',\n\t\t\t\t\t'" . date("Y-m-d H:i:s") . "',\n\t\t\t\t\t'{$upload_by}',\n\t\t\t\t\t'{$filename}',\n\t\t\t\t\t'{$status}',\n\t\t\t\t\t'{$detail}',\n\t\t\t\t\t'{$reason_for_change}',\n\t\t\t\t\t'{$assign_to}',\n\t\t\t\t\t'Y',\n\t\t\t\t\t'{$last_updated}',\n\t\t\t\t\t'{$last_updated_by}' )";
    db_query($db, $q);
    requirement_edit_functionality($req_id, $functionality);
}
Пример #2
0
function bug_add_bugnote($bug_id, $bugnote)
{
    global $db;
    $bugnote_tbl = BUG_NOTE_TBL;
    $f_bug_id = BUG_NOTE_BUG_ID;
    $f_author = BUG_NOTE_AUTHOR;
    $f_date_created = BUG_NOTE_DATE_CREATED;
    $f_bugnote = BUG_NOTE_DETAIL;
    $author = session_get_username();
    $created_date = date_get_short_dt();
    $q = "INSERT INTO {$bugnote_tbl}\n\t\t  ( {$f_bug_id}, {$f_author}, {$f_date_created}, {$f_bugnote} )\n\t\t  VALUES\n\t\t  ( '{$bug_id}', '{$author}', '{$created_date}', '{$bugnote}' )";
    db_query($db, $q);
    $bugnote_id = db_get_last_autoincrement_id($db);
    $bugnote_id = util_pad_id($bugnote_id);
    if ($GLOBALS['default_notify_flags']['bugnote']) {
        $action = "add_bugnote";
        $project_id = session_get_project_id();
        $s_user_properties = session_get_user_properties();
        $user_id = $s_user_properties['user_id'];
        bug_monitor_attach_user($bug_id);
        # Gather recipients and send email
        $recipients = bug_email_collect_recipients($bug_id, $action);
        bug_email($project_id, $bug_id, $recipients, $action);
    }
    bug_history_log_event($bug_id, lang_get('add_bugnote'), '', $bugnote_id);
}