$f_req_ver_timestamp = REQ_VERS_TIMESTAMP;
$f_req_ver_uploaded_by = REQ_VERS_UPLOADED_BY;
$f_req_ver_status = REQ_VERS_STATUS;
$f_req_ver_shed_release = REQ_VERS_SCHEDULED_RELEASE_IMP;
$f_req_ver_detail = REQ_VERS_DETAIL;
$query_updateReqs = "UPDATE {$tbl_req} SET {$f_req_filename} = '{$reqfilename}', {$f_req_area_covered} = '{$areacoverage}', {$f_req_type} = '{$reqdoctype}' WHERE {$f_req_id} = '{$reqID}'";
$db->Execute($query_updateReqs);
if ($revision_type == "Major") {
    $version = floor($version) + 1;
} else {
    $x = explode(".", $version);
    $m = $x[1] + 1;
    $version = $x[0] . "." . $m;
}
$current_date = date("Y-m-d H:i:s");
$arr_user = user_get_current_user_name();
$username = $arr_user[0];
$query_version = "INSERT INTO {$tbl_req_ver} ({$f_req_ver_req_id}, {$f_req_ver_version}, {$f_req_ver_uploaded_by}, {$f_req_ver_timestamp}, {$f_req_ver_detail}, {$f_req_ver_status}, {$f_req_ver_shed_release}) VALUES ('{$reqID}', '{$version}', '{$username}', '{$current_date}', '{$HTTP_POST_VARS['EditorDefault']}', '{$reqstatus}', '{$release}')";
$db->Execute($query_version);
header("Location: requirement_detail.php?reqID={$reqID}");
#PRINT "<meta http-equiv=\"Refresh\" content=\"1;URL=requirement_detail.php?reqID=$reqID\">";
exit;
# ---------------------------------------------------------------------
# $Log: requirement_update.php,v $
# Revision 1.2  2006/02/24 11:33:32  gth2
# minor bug fixes and enhancements for 1.5.1 release - gth
#
# Revision 1.1.1.1  2005/11/30 23:00:58  gth2
# importing initial version - gth
#
# ---------------------------------------------------------------------
function email_send2($recipients, $subject, $message, $headers = '')
{
    # short-circuit if no emails should be sent
    if (!SEND_EMAIL_NOTIFICATION) {
        return;
    }
    # short-circuit if no recipient is defined
    if (empty($recipients)) {
        return;
    }
    $subject = trim($subject);
    $message = trim($message);
    $str_email_to = "";
    if (is_array($recipients)) {
        foreach ($recipients as $recipient) {
            # If $recipents is a recordset, take the user email from the record.
            if (is_array($recipient)) {
                $recipient = $recipient[USER_EMAIL];
            }
            # check if email address already in recipients string
            # before adding email address
            if (!empty($recipient) && !strpos($str_email_to, $recipient)) {
                $str_email_to .= $recipient . ",";
            }
        }
    } else {
        $str_email_to = $recipients;
    }
    $str_email_to = trim($str_email_to, ",");
    # short-circuit if $str_email_to is empty
    if (empty($str_email_to)) {
        return;
    }
    # for debugging only
    #echo $recipients.'<br>'.$t_subject.'<br>'.$t_message.'<br>'.$t_headers;
    #exit;
    #echo '<br>xxxRecipient ='.$recipients.'<br>';
    #echo 'Headers ='.nl2br($t_headers).'<br>';
    #echo $t_subject.'<br>';
    #echo nl2br($t_message).'<br>';
    #exit;
    # Visit http://www.php.net/manual/function.mail.php
    # if you have problems with mailing
    if (empty($headers)) {
        $sender_details = user_get_current_user_name();
        $sender_email = $sender_details[USER_EMAIL];
        $headers = "From: {$sender_email}" . NEWLINE;
    }
    # Temporarily shut off error reporting so we can handle email errors on our own
    error_reporting(0);
    # set the SMTP host... only used on window though
    ini_set('SMTP', SMTP_HOST);
    /*
    if ( !is_blank( config_get( 'smtp_username' ) ) ) {     # Use SMTP Authentication
    	$mail->SMTPAuth = true;
    	$mail->Username = config_get( 'smtp_username' );
    	$mail->Password = config_get( 'smtp_password' );
    }
    */
    $mail_send_ok = mail($str_email_to, $subject, $message, $headers);
    if (!$mail_send_ok) {
        print "<p class=error>PROBLEMS SENDING MAIL TO: {$str_email_to}</p><br>";
        print "PLEASE CHECK YOUR EMAIL PREFERENCES IN properties_inc.php<br>";
        print "To: " . htmlspecialchars($str_email_to) . '<br>';
        print nl2br(htmlspecialchars($headers));
        print "Subject: " . htmlspecialchars($subject) . '<br><br>';
        print "Message: <br>";
        print nl2br(htmlspecialchars($message)) . '<br>';
        exit;
    }
}