本文整理汇总了PHP中History::getTypeID方法的典型用法代码示例。如果您正苦于以下问题:PHP History::getTypeID方法的具体用法?PHP History::getTypeID怎么用?PHP History::getTypeID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类History
的用法示例。
在下文中一共展示了History::getTypeID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Method used to log the changes made against a specific issue.
*
* @param integer $iss_id The issue ID
* @param integer $usr_id The ID of the user.
* @param integer|string $htt_id The type ID of this history event.
* @param string $summary The summary of the changes
* @param array $context parameters used in summary
*/
public static function add($iss_id, $usr_id, $htt_id, $summary, $context = array())
{
if (!is_numeric($htt_id)) {
$htt_id = History::getTypeID($htt_id);
}
$params = array('his_iss_id' => $iss_id, 'his_usr_id' => $usr_id, 'his_created_date' => Date_Helper::getCurrentDateGMT(), 'his_summary' => $summary, 'his_context' => json_encode($context), 'his_htt_id' => $htt_id);
$stmt = 'INSERT INTO {{%issue_history}} SET ' . DB_Helper::buildSet($params);
try {
DB_Helper::getInstance()->query($stmt, $params);
} catch (DbException $e) {
}
}
示例2: updateValues
//.........这里部分代码省略.........
$stmt = "SELECT\n fld_id,\n fld_type\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "custom_field\n WHERE\n fld_id IN (" . implode(", ", Misc::escapeInteger(@array_keys($HTTP_POST_VARS['custom_fields']))) . ")";
$field_types = $GLOBALS["db_api"]->dbh->getAssoc($stmt);
// get the titles for all of the custom fields being submitted
$stmt = "SELECT\n fld_id,\n fld_title\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "custom_field\n WHERE\n fld_id IN (" . implode(", ", Misc::escapeInteger(@array_keys($HTTP_POST_VARS['custom_fields']))) . ")";
$field_titles = $GLOBALS["db_api"]->dbh->getAssoc($stmt);
$updated_fields = array();
foreach ($HTTP_POST_VARS["custom_fields"] as $fld_id => $value) {
$fld_id = Misc::escapeInteger($fld_id);
// security check
$sql = "SELECT\n fld_min_role\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "custom_field\n WHERE\n fld_id = {$fld_id}";
$min_role = $GLOBALS["db_api"]->dbh->getOne($sql);
if ($min_role > Auth::getCurrentRole()) {
continue;
}
$option_types = array('multiple', 'combo');
if (!in_array($field_types[$fld_id], $option_types)) {
// check if this is a date field
if ($field_types[$fld_id] == 'date') {
$value = $value['Year'] . "-" . $value['Month'] . "-" . $value['Day'];
if ($value == '--') {
$value = '';
}
}
// first check if there is actually a record for this field for the issue
$stmt = "SELECT\n icf_id,\n icf_value\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_custom_field\n WHERE\n icf_iss_id=" . $issue_id . " AND\n icf_fld_id={$fld_id}";
$res = $GLOBALS["db_api"]->dbh->getRow($stmt, DB_FETCHMODE_ASSOC);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
}
$icf_id = $res['icf_id'];
$icf_value = $res['icf_value'];
if ($icf_value == $value) {
continue;
}
if (empty($icf_id)) {
// record doesn't exist, insert new record
$stmt = "INSERT IGNORE INTO\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_custom_field\n (\n icf_iss_id,\n icf_fld_id,\n icf_value\n ) VALUES (\n " . $issue_id . ",\n {$fld_id},\n '" . Misc::escapeString($value) . "'\n )";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
}
} else {
// record exists, update it
$stmt = "UPDATE\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_custom_field\n SET\n icf_value='" . Misc::escapeString($value) . "'\n WHERE\n icf_id={$icf_id}";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
}
}
if ($field_types[$fld_id] == 'textarea') {
$updated_fields[$field_titles[$fld_id]] = '';
} else {
$updated_fields[$field_titles[$fld_id]] = History::formatChanges($icf_value, $value);
}
} else {
$old_value = Custom_Field::getDisplayValue($HTTP_POST_VARS['issue_id'], $fld_id, true);
if (!is_array($old_value)) {
$old_value = array($old_value);
}
if (!is_array($value)) {
$value = array($value);
}
if (count(array_diff($old_value, $value)) > 0 || count(array_diff($value, $old_value)) > 0) {
$old_display_value = Custom_Field::getDisplayValue($HTTP_POST_VARS['issue_id'], $fld_id);
// need to remove all associated options from issue_custom_field and then
// add the selected options coming from the form
Custom_Field::removeIssueAssociation($fld_id, $HTTP_POST_VARS["issue_id"]);
if (@count($value) > 0) {
Custom_Field::associateIssue($HTTP_POST_VARS["issue_id"], $fld_id, $value);
}
$new_display_value = Custom_Field::getDisplayValue($HTTP_POST_VARS['issue_id'], $fld_id);
$updated_fields[$field_titles[$fld_id]] = History::formatChanges($old_display_value, $new_display_value);
}
}
}
Workflow::handleCustomFieldsUpdated($prj_id, $issue_id, $old_values, Custom_Field::getValuesByIssue($prj_id, $issue_id));
Issue::markAsUpdated($HTTP_POST_VARS["issue_id"]);
// need to save a history entry for this
if (count($updated_fields) > 0) {
// log the changes
$changes = '';
$i = 0;
foreach ($updated_fields as $key => $value) {
if ($i > 0) {
$changes .= "; ";
}
if (!empty($value)) {
$changes .= "{$key}: {$value}";
} else {
$changes .= "{$key}";
}
$i++;
}
History::add($HTTP_POST_VARS["issue_id"], Auth::getUserID(), History::getTypeID('custom_field_updated'), "Custom field updated ({$changes}) by " . User::getFullName(Auth::getUserID()));
}
return 1;
}
示例3: getIssueCloser
/**
* Returns the last person to close the issue
*
* @param integer $issue_id The ID of the issue
* @return integer usr_id
*/
function getIssueCloser($issue_id)
{
$sql = "SELECT\n his_usr_id\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_history\n WHERE\n his_iss_id = " . Misc::escapeInteger($issue_id) . " AND\n his_htt_id = '" . History::getTypeID('issue_closed') . "'\n ORDER BY\n his_created_date DESC\n LIMIT 1";
$res = $GLOBALS["db_api"]->dbh->getOne($sql);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return 0;
}
return $res;
}
示例4: convertNote
/**
* Converts a note to a draft or an email
*
* @access public
* @param $note_id The id of the note
* @param $target What the not should be converted too
* @param $authorize_sender If the sender should be added to authorized senders list.
*/
function convertNote($note_id, $target, $authorize_sender = false)
{
$note_id = Misc::escapeInteger($note_id);
$issue_id = Note::getIssueID($note_id);
$email_account_id = Email_Account::getEmailAccount();
$blocked_message = Note::getBlockedMessage($note_id);
$unknown_user = Note::getUnknownUser($note_id);
$structure = Mime_Helper::decode($blocked_message, true, true);
$body = Mime_Helper::getMessageBody($structure);
$sender_email = strtolower(Mail_API::getEmailAddress($structure->headers['from']));
if ($target == 'email') {
if (Mime_Helper::hasAttachments($blocked_message)) {
$has_attachments = 1;
} else {
$has_attachments = 0;
}
list($blocked_message, $headers) = Mail_API::rewriteThreadingHeaders($issue_id, $blocked_message, @$structure->headers);
$t = array('issue_id' => $issue_id, 'ema_id' => $email_account_id, 'message_id' => @$structure->headers['message-id'], 'date' => Date_API::getCurrentDateGMT(), 'from' => @$structure->headers['from'], 'to' => @$structure->headers['to'], 'cc' => @$structure->headers['cc'], 'subject' => @$structure->headers['subject'], 'body' => @$body, 'full_email' => @$blocked_message, 'has_attachment' => $has_attachments, 'headers' => $headers);
// need to check for a possible customer association
if (!empty($structure->headers['from'])) {
$details = Email_Account::getDetails($email_account_id);
// check from the associated project if we need to lookup any customers by this email address
if (Customer::hasCustomerIntegration($details['ema_prj_id'])) {
// check for any customer contact association
list($customer_id, ) = Customer::getCustomerIDByEmails($details['ema_prj_id'], array($sender_email));
if (!empty($customer_id)) {
$t['customer_id'] = $customer_id;
}
}
}
if (empty($t['customer_id'])) {
$update_type = 'staff response';
$t['customer_id'] = "NULL";
} else {
$update_type = 'customer action';
}
$res = Support::insertEmail($t, $structure, $sup_id);
if ($res != -1) {
Support::extractAttachments($issue_id, $blocked_message);
// notifications about new emails are always external
$internal_only = false;
// special case when emails are bounced back, so we don't want to notify the customer about those
if (Notification::isBounceMessage($sender_email)) {
$internal_only = true;
}
Notification::notifyNewEmail(Auth::getUserID(), $issue_id, $t, $internal_only, false, '', $sup_id);
Issue::markAsUpdated($issue_id, $update_type);
Note::remove($note_id, false);
History::add($issue_id, Auth::getUserID(), History::getTypeID('note_converted_email'), "Note converted to e-mail (from: " . @$structure->headers['from'] . ") by " . User::getFullName(Auth::getUserID()));
// now add sender as an authorized replier
if ($authorize_sender) {
Authorized_Replier::manualInsert($issue_id, @$structure->headers['from']);
}
}
return $res;
} else {
// save message as a draft
$res = Draft::saveEmail($issue_id, $structure->headers['to'], $structure->headers['cc'], $structure->headers['subject'], $body, false, $unknown_user);
// remove the note, if the draft was created successfully
if ($res) {
Note::remove($note_id, false);
History::add($issue_id, Auth::getUserID(), History::getTypeID('note_converted_draft'), "Note converted to draft (from: " . @$structure->headers['from'] . ") by " . User::getFullName(Auth::getUserID()));
}
return $res;
}
}
示例5: update
/**
* Method used to update an existing draft response.
*
* @access public
* @param integer $issue_id The issue ID
* @param integer $emd_id The email draft ID
* @param string $to The primary recipient of the draft
* @param string $cc The secondary recipients of the draft
* @param string $subject The subject of the draft
* @param string $message The draft body
* @param integer $parent_id The ID of the email that this draft is replying to, if any
* @return integer 1 if the update worked, -1 otherwise
*/
function update($issue_id, $emd_id, $to, $cc, $subject, $message, $parent_id = FALSE)
{
$issue_id = Misc::escapeInteger($issue_id);
$emd_id = Misc::escapeInteger($emd_id);
$parent_id = Misc::escapeInteger($issue_id);
if (empty($parent_id)) {
$parent_id = 'NULL';
}
$usr_id = Auth::getUserID();
// update previous draft and insert new record
$stmt = "UPDATE\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_draft\n SET\n emd_updated_date='" . Date_API::getCurrentDateGMT() . "',\n emd_status = 'edited'\n WHERE\n emd_id={$emd_id}";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
Issue::markAsUpdated($issue_id, "draft saved");
History::add($issue_id, $usr_id, History::getTypeID('draft_updated'), 'Email message draft updated by ' . User::getFullName($usr_id));
Draft::saveEmail($issue_id, $to, $cc, $subject, $message, $parent_id, false, false);
return 1;
}
}
示例6: remove
/**
* Method used to remove a specific phone support entry from the
* application.
*
* @access public
* @param integer $phone_id The phone support entry ID
* @return integer 1 if the removal worked, -1 or -2 otherwise
*/
function remove($phone_id)
{
$phone_id = Misc::escapeInteger($phone_id);
$stmt = "SELECT\n phs_iss_id,\n phs_ttr_id,\n phs_usr_id\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "phone_support\n WHERE\n phs_id={$phone_id}";
$details = $GLOBALS["db_api"]->dbh->getRow($stmt, DB_FETCHMODE_ASSOC);
if ($details['phs_usr_id'] != Auth::getUserID()) {
return -2;
}
$stmt = "DELETE FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "phone_support\n WHERE\n phs_id={$phone_id}";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
Issue::markAsUpdated($details["phs_iss_id"]);
// need to save a history entry for this
History::add($details["phs_iss_id"], Auth::getUserID(), History::getTypeID('phone_entry_removed'), 'Phone Support entry removed by ' . User::getFullName(Auth::getUserID()));
if (!empty($details["phs_ttr_id"])) {
$time_result = Time_Tracking::removeEntry($details["phs_ttr_id"], $details['phs_usr_id']);
if ($time_result == 1) {
return 2;
} else {
return $time_result;
}
} else {
return 1;
}
}
}
示例7: updateDuplicates
/**
* Method used to update the duplicated issues for a given
* issue ID.
*
* @param integer $issue_id The issue ID
* @return integer 1 if the update worked, -1 otherwise
*/
public function updateDuplicates($issue_id)
{
$ids = self::getDuplicateList($issue_id);
if ($ids == '') {
return -1;
}
$ids = array_keys($ids);
$stmt = "UPDATE\n {{%issue}}\n SET\n iss_updated_date=?,\n iss_last_internal_action_date=?,\n iss_last_internal_action_type='updated',\n iss_prc_id=?,";
$params = array(Date_Helper::getCurrentDateGMT(), Date_Helper::getCurrentDateGMT(), $_POST['category']);
if (@$_POST['keep'] == 'no') {
$stmt .= 'iss_pre_id=?,';
$params[] = $_POST['release'];
}
$stmt .= '
iss_pri_id=?,
iss_sta_id=?,
iss_res_id=?
WHERE
iss_id IN (' . DB_Helper::buildList($ids) . ')';
$params[] = $_POST['priority'];
$params[] = $_POST['status'];
$params[] = $_POST['resolution'];
$params = array_merge($params, $ids);
try {
DB_Helper::getInstance()->query($stmt, $params);
} catch (DbException $e) {
return -1;
}
// record the change
$issue_id = (int) $issue_id;
$usr_id = Auth::getUserID();
$full_name = User::getFullName($usr_id);
$htt_id = History::getTypeID('duplicate_update');
foreach ($ids as $iss_id) {
History::add($iss_id, $usr_id, $htt_id, 'The details for issue #{issue_id} were updated by {user} and the changes propagated to the duplicated issues', array('issue_id' => $issue_id, 'user' => $full_name));
}
return 1;
}
示例8: blockEmailIfNeeded
/**
* Check if this email needs to be blocked and if so, block it.
*
*
*/
function blockEmailIfNeeded($email)
{
global $HTTP_POST_VARS;
if (empty($email['issue_id'])) {
return false;
}
$issue_id = $email['issue_id'];
$prj_id = Issue::getProjectID($issue_id);
$sender_email = strtolower(Mail_API::getEmailAddress($email['headers']['from']));
if (Mail_API::isVacationAutoResponder($email['headers']) || Notification::isBounceMessage($sender_email) || !Support::isAllowedToEmail($issue_id, $sender_email)) {
// add the message body as a note
$HTTP_POST_VARS = array('blocked_msg' => $email['full_email'], 'title' => @$email['headers']['subject'], 'note' => Mail_API::getCannedBlockedMsgExplanation($issue_id) . $email['body']);
// avoid having this type of message re-open the issue
if (Mail_API::isVacationAutoResponder($email['headers'])) {
$closing = true;
} else {
$closing = false;
}
$res = Note::insert(Auth::getUserID(), $issue_id, $email['headers']['from'], false, $closing);
// associate the email attachments as internal-only files on this issue
if ($res != -1) {
Support::extractAttachments($issue_id, $email['full_email'], true, $res);
}
$HTTP_POST_VARS['issue_id'] = $issue_id;
$HTTP_POST_VARS['from'] = $sender_email;
// avoid having this type of message re-open the issue
if (Mail_API::isVacationAutoResponder($email['headers'])) {
$email_type = 'vacation-autoresponder';
} else {
$email_type = 'routed';
}
Workflow::handleBlockedEmail($prj_id, $issue_id, $HTTP_POST_VARS, $email_type);
// try to get usr_id of sender, if not, use system account
$usr_id = User::getUserIDByEmail(Mail_API::getEmailAddress($email['from']));
if (!$usr_id) {
$usr_id = APP_SYSTEM_USER_ID;
}
// log blocked email
History::add($issue_id, $usr_id, History::getTypeID('email_blocked'), "Email from '" . $email['from'] . "' blocked.");
return true;
}
return false;
}
示例9: subdate
include_once APP_INC_PATH . "class.project.php";
include_once APP_INC_PATH . "class.issue.php";
include_once APP_INC_PATH . "class.status.php";
include_once APP_INC_PATH . "class.notification.php";
include_once APP_INC_PATH . "class.note.php";
include_once APP_INC_PATH . "db_access.php";
$day_limit = 4;
$sql = "SELECT \n\t\t\tiss_id,iss_prj_id\n\t\tFROM \n\t\t\t`ev_issue` \n\t\t\tleft join ev_status on sta_id = `iss_sta_id` \n\t\twhere \n\t\t\tsta_is_closed = 0 \n\t\t\tand `iss_control_status` = 'Answered' \n\t\t\tand iss_last_response_date < subdate(now(),interval {$day_limit} day);\n\t\t";
$issues = $GLOBALS["db_api"]->dbh->getAll($sql);
$closed_id = Status::getStatusID('Closed');
$c = 0;
$k = 0;
foreach ($issues as $issue) {
$res = Issue::setStatus($issue[0], $closed_id);
if ($res == 1) {
History::add($HTTP_GET_VARS["iss_id"], 0, History::getTypeID('status_changed'), "Issue automatically set to status '" . Status::getStatusTitle(7) . "' due to ({$day_limit}) day inactivity ");
Notification::notify($issue[0], 'closed');
}
$c++;
}
$killed_id = Status::getStatusID('Killed');
$sql = "SELECT \n\t\t\tiss_id\n\t\tFROM \n\t\t\t`ev_issue` \n\t\t\tleft join ev_status on sta_id = `iss_sta_id` \n\t\twhere \n\t\t\tsta_is_closed = 1\n\t\t\tand `iss_sta_id` = '{$killed_id}'\n\t\t";
$issues = $GLOBALS["db_api"]->dbh->getCol($sql);
foreach ($issues as $issue) {
$GLOBALS["db_api"]->dbh->query("DELETE FROM `ev_issue` where iss_id = '" . $issue . "'");
$GLOBALS["db_api"]->dbh->query("DELETE FROM `ev_subscription` where sub_iss_id = '" . $issue . "'");
$GLOBALS["db_api"]->dbh->query("DELETE FROM `ev_issue_user` where isu_iss_id = '" . $issue . "'");
$GLOBALS["db_api"]->dbh->query("DELETE FROM `ev_issue_history` where his_iss_id = '" . $issue . "'");
$GLOBALS["db_api"]->dbh->query("DELETE FROM `ev_issue_user_replier` where iur_iss_id = '" . $issue . "'");
$k++;
}
示例10: remove
/**
* Method used to remove an existing set of requirements.
*
* @access public
* @return integer -1 if an error occurred or 1 otherwise
*/
function remove()
{
global $HTTP_POST_VARS;
$items = implode(", ", Misc::escapeInteger($HTTP_POST_VARS["item"]));
$stmt = "SELECT\n isr_iss_id\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_requirement\n WHERE\n isr_id IN ({$items})";
$issue_id = $GLOBALS["db_api"]->dbh->getOne($stmt);
$stmt = "DELETE FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_requirement\n WHERE\n isr_id IN ({$items})";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
Issue::markAsUpdated($issue_id);
// need to save a history entry for this
History::add($issue_id, Auth::getUserID(), History::getTypeID('impact_analysis_removed'), 'Impact analysis removed by ' . User::getFullName(Auth::getUserID()));
return 1;
}
}
示例11: remove
/**
* Method used to remove all rows associated with a set of
* subscription IDs
*
* @param array $items The list of subscription IDs
* @return boolean
*/
public static function remove($items)
{
$itemlist = DB_Helper::buildList($items);
$stmt = "SELECT\n sub_iss_id\n FROM\n {{%subscription}}\n WHERE\n sub_id IN ({$itemlist})";
$issue_id = DB_Helper::getInstance()->getOne($stmt, $items);
$usr_id = Auth::getUserID();
$user_fullname = User::getFullName($usr_id);
$htt_id = History::getTypeID('notification_removed');
foreach ($items as $sub_id) {
$subscriber = self::getSubscriber($sub_id);
$stmt = 'DELETE FROM
{{%subscription}}
WHERE
sub_id=?';
DB_Helper::getInstance()->query($stmt, array($sub_id));
$stmt = 'DELETE FROM
{{%subscription_type}}
WHERE
sbt_sub_id=?';
DB_Helper::getInstance()->query($stmt, array($sub_id));
History::add($issue_id, $usr_id, $htt_id, 'Notification list entry ({email}) removed by {user}', array('email' => $subscriber, 'user' => $user_fullname));
}
Issue::markAsUpdated($issue_id);
return true;
}
示例12: elseif
exit;
}
// since emails associated with issues are sent to the notification list, not the to: field, set the to field to be blank
// this field should already be blank, but may also be unset.
if (!empty($issue_id)) {
$HTTP_POST_VARS['to'] = '';
}
if (@$HTTP_POST_VARS["cat"] == "send_email") {
$res = Support::sendEmail($HTTP_POST_VARS['parent_id']);
$tpl->assign("send_result", $res);
if (!@empty($HTTP_POST_VARS['new_status'])) {
$res = Issue::setStatus($issue_id, $HTTP_POST_VARS['new_status']);
Issue::updateControlStatus($issue_id);
if ($res != -1) {
$new_status = Status::getStatusTitle($HTTP_POST_VARS['new_status']);
History::add($issue_id, $usr_id, History::getTypeID('status_changed'), "Status changed to '{$new_status}' by " . User::getFullName($usr_id) . " when sending an email");
}
}
// remove the existing email draft, if appropriate
if (!empty($HTTP_POST_VARS['draft_id'])) {
Draft::remove($HTTP_POST_VARS['draft_id']);
}
// enter the time tracking entry about this new email
if (!empty($HTTP_POST_VARS['time_spent'])) {
$HTTP_POST_VARS['issue_id'] = $issue_id;
$HTTP_POST_VARS['category'] = Time_Tracking::getCategoryID('Email Discussion');
$HTTP_POST_VARS['summary'] = 'Time entry inserted when sending outgoing email.';
Time_Tracking::insertEntry();
}
} elseif (@$HTTP_POST_VARS["cat"] == "save_draft") {
$res = Draft::saveEmail($issue_id, $HTTP_POST_VARS["to"], $HTTP_POST_VARS["cc"], $HTTP_POST_VARS["subject"], $HTTP_POST_VARS["message"], $HTTP_POST_VARS["parent_id"]);
示例13: logCheckin
/**
* Method used to associate a new checkin with an existing issue
*
* @access public
* @param integer $issue_id The issue ID
* @param integer $i The offset of the file that was changed
* @return integer 1 if the update worked, -1 otherwise
*/
function logCheckin($issue_id, $i)
{
global $HTTP_GET_VARS;
$stmt = "INSERT INTO\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_checkin\n (\n isc_iss_id,\n isc_module,\n isc_filename,\n isc_old_version,\n isc_new_version,\n isc_created_date,\n isc_username,\n isc_commit_msg\n ) VALUES (\n {$issue_id},\n '" . Misc::escapeString($HTTP_GET_VARS["module"]) . "',\n '" . Misc::escapeString($HTTP_GET_VARS["files"][$i]) . "',\n '" . Misc::escapeString($HTTP_GET_VARS["old_versions"][$i]) . "',\n '" . Misc::escapeString($HTTP_GET_VARS["new_versions"][$i]) . "',\n '" . Date_API::getCurrentDateGMT() . "',\n '" . Misc::escapeString($HTTP_GET_VARS["username"]) . "',\n '" . Misc::escapeString($HTTP_GET_VARS["commit_msg"]) . "'\n )";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
// need to mark this issue as updated
Issue::markAsUpdated($issue_id, 'scm checkin');
// need to save a history entry for this
History::add($issue_id, APP_SYSTEM_USER_ID, History::getTypeID('scm_checkin_associated'), 'SCM Checkins associated by SCM user \'' . $HTTP_GET_VARS["username"] . '\'.');
return 1;
}
}
示例14: update
/**
* Method used to update the details of a given subscription.
*
* @access public
* @param integer $sub_id The subscription ID
* @return integer 1 if the update worked, -1 otherwise
*/
function update($sub_id)
{
global $HTTP_POST_VARS;
$sub_id = Misc::escapeInteger($sub_id);
$stmt = "SELECT\r\n sub_iss_id,\r\n sub_usr_id\r\n FROM\r\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "subscription\r\n WHERE\r\n sub_id={$sub_id}";
list($issue_id, $usr_id) = $GLOBALS["db_api"]->dbh->getRow($stmt);
$email = strtolower(Mail_API::getEmailAddress($HTTP_POST_VARS["email"]));
$usr_id = User::getUserIDByEmail($email);
if (!empty($usr_id)) {
$email = '';
} else {
$usr_id = 0;
$email = Misc::escapeString($HTTP_POST_VARS["email"]);
}
$prj_id = Issue::getProjectID($issue_id);
// call workflow to modify actions or cancel adding this user.
$actions = array();
$subscriber_usr_id = false;
$workflow = Workflow::handleSubscription($prj_id, $issue_id, $subscriber_usr_id, $email, $actions);
if ($workflow === false) {
// cancel subscribing the user
return -2;
}
// always set the type of notification to issue-level
$stmt = "UPDATE\r\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "subscription\r\n SET\r\n sub_level='issue',\r\n sub_email='" . Misc::escapeString($email) . "',\r\n sub_usr_id={$usr_id}\r\n WHERE\r\n sub_id={$sub_id}";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
$stmt = "DELETE FROM\r\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "subscription_type\r\n WHERE\r\n sbt_sub_id={$sub_id}";
$GLOBALS["db_api"]->dbh->query($stmt);
// now add them all again
for ($i = 0; $i < count($HTTP_POST_VARS["actions"]); $i++) {
Notification::addType($sub_id, $HTTP_POST_VARS["actions"][$i]);
}
// need to mark the issue as updated
Issue::markAsUpdated($issue_id);
// need to save a history entry for this
History::add($issue_id, Auth::getUserID(), History::getTypeID('notification_updated'), "Notification list entry ('" . Notification::getSubscriber($sub_id) . "') updated by " . User::getFullName(Auth::getUserID()));
return 1;
}
}
示例15: setGroup
/**
* Sets the group of the issue.
*
* @access public
* @param integer $issue_id The ID of the issue
* @param integer $group_id The ID of the group
* @return integer 1 if successful, -1 or -2 otherwise
*/
function setGroup($issue_id, $group_id)
{
$issue_id = Misc::escapeInteger($issue_id);
$group_id = Misc::escapeInteger($group_id);
$current = Issue::getDetails($issue_id);
if ($current["iss_grp_id"] == $group_id) {
return -2;
}
$stmt = "UPDATE\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n SET\n iss_grp_id = {$group_id}\n WHERE\n iss_id = {$issue_id}";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
}
$current_user = Auth::getUserID();
if (empty($current_user)) {
$current_user = APP_SYSTEM_USER_ID;
}
History::add($issue_id, $current_user, History::getTypeID('group_changed'), "Group changed (" . History::formatChanges(Group::getName($current["iss_grp_id"]), Group::getName($group_id)) . ") by " . User::getFullName($current_user));
return 1;
}