* Copyright 1999-2001, VA Linux Systems, Inc.
* Copyright 2002-2004, GForge, LLC
* Copyright 2009, Roland Mas
- * Copyright 2009, Alcatel-Lucent
+ * Copyright (C) 2009-2013 Alain Peyrat, Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
// user response
define('ARTIFACT_MAIL_MARKER', '#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+');
- /**
- * Factory method which creates an Artifact from an artifact ID
- *
- * @param int The artifact ID
- * @param array The result array, if it's passed in
- * @return object Artifact object
- */
- function &artifact_get_object($artifact_id,$data=false) {
- global $ARTIFACT_OBJ;
- if (!isset($ARTIFACT_OBJ["_".$artifact_id."_"])) {
- if ($data) {
- //the db result handle was passed in
- } else {
- $res = db_query_params ('SELECT * FROM artifact_vw WHERE artifact_id=$1',
- array ($artifact_id)) ;
- if (db_numrows($res) <1 ) {
- $ARTIFACT_OBJ["_".$artifact_id."_"]=false;
- return false;
- }
- $data = db_fetch_array($res);
+/**
+ * Factory method which creates an Artifact from an artifact ID
+ *
+ * @param int $artifact_id The artifact ID
+ * @param array|bool $data The result array, if it's passed in
+ * @return Artifact Artifact object
+ */
+function &artifact_get_object($artifact_id,$data=false) {
+ global $ARTIFACT_OBJ;
+ if (!isset($ARTIFACT_OBJ["_".$artifact_id."_"])) {
+ if ($data) {
+ //the db result handle was passed in
+ } else {
+ $res = db_query_params ('SELECT * FROM artifact_vw WHERE artifact_id=$1',
+ array ($artifact_id)) ;
+ if (db_numrows($res) <1 ) {
+ $ARTIFACT_OBJ["_".$artifact_id."_"]=false;
+ return false;
}
- $ArtifactType =& artifactType_get_object($data["group_artifact_id"]);
- $ARTIFACT_OBJ["_".$artifact_id."_"]= new Artifact($ArtifactType,$data);
+ $data = db_fetch_array($res);
}
- return $ARTIFACT_OBJ["_".$artifact_id."_"];
+ $ArtifactType =& artifactType_get_object($data["group_artifact_id"]);
+ $ARTIFACT_OBJ["_".$artifact_id."_"]= new Artifact($ArtifactType,$data);
}
+ return $ARTIFACT_OBJ["_".$artifact_id."_"];
+}
class Artifact extends Error {
/**
* Resource ID.
*
- * @var int $status_res.
+ * @var int $status_res.
*/
var $status_res;
/**
* Artifact Type object.
*
- * @var object $ArtifactType.
+ * @var object $ArtifactType.
*/
var $ArtifactType;
/**
* Array of artifact data.
*
- * @var array $data_array.
+ * @var array $data_array.
*/
var $data_array;
/**
* Array of artifact data for extra fields defined by Admin.
*
- * @var array $extra_field_data.
+ * @var array $extra_field_data.
*/
var $extra_field_data;
/**
* Array of ArtifactFile objects.
*
- * @var array $files
+ * @var array $files
*/
var $files;
/**
* Database result set of related tasks
*
- * @var result $relatedtasks
+ * @var result $relatedtasks
*/
var $relatedtasks;
/**
- * Artifact - constructor.
+ * Artifact - constructor.
*
- * @param ArtifactType $ArtifactType The ArtifactType object.
- * @param int|bool $data (primary key from database OR complete assoc array)
- * ONLY OPTIONAL WHEN YOU PLAN TO IMMEDIATELY CALL ->create()
+ * @param ArtifactType $ArtifactType The ArtifactType object.
+ * @param int|bool $data (primary key from database OR complete assoc array)
+ * ONLY OPTIONAL WHEN YOU PLAN TO IMMEDIATELY CALL ->create()
*/
function __construct(&$ArtifactType, $data=false) {
$this->Error();
// Was ArtifactType legit?
if (!$ArtifactType || !is_object($ArtifactType)) {
- $this->setError(_('No Valid Artifact Type'));
+ $this->setError(_('Invalid Artifact Type'));
return;
}
}
/**
- * create - construct a new Artifact in the database.
+ * create - construct a new Artifact in the database.
*
- * @param string The artifact summary.
- * @param string Details of the artifact.
- * @param int The ID of the user to which this artifact is to be assigned.
- * @param int The artifacts priority.
- * @param array Array of extra fields like: array(15=>'foobar',22=>'1');
- * @param array Array of data to change submitter and time of submit like: array('user' => 127, 'time' => 1234556789)
- * @return id on success / false on failure.
+ * @param string $summary The artifact summary.
+ * @param string $details Details of the artifact.
+ * @param int $assigned_to The ID of the user to which this artifact is to be assigned.
+ * @param int $priority The artifacts priority.
+ * @param array $extra_fields Array of extra fields like: array(15=>'foobar',22=>'1');
+ * @param array $importData Array of data to change submitter and time of submit like:
+ * array('user' => 127, 'time' => 1234556789)
+ * @return bool id on success / false on failure.
*/
function create( $summary, $details, $assigned_to=100, $priority=3, $extra_fields=array(), $importData = array()) {
//
// the status_id based on the extra field - this keeps the counters
// accurate
//
- $status_id=$this->ArtifactType->remapStatus($status_id,$extra_fields);
+ $status_id = $this->ArtifactType->remapStatus($status_id,$extra_fields);
if (!$status_id) {
$this->setError(_('Error remapping status'));
return false;
}
/**
- * fetchData - re-fetch the data for this Artifact from the database.
+ * fetchData - re-fetch the data for this Artifact from the database.
*
- * @param int The artifact ID.
- * @return boolean success.
+ * @param int $artifact_id The artifact ID.
+ * @return boolean success.
*/
function fetchData($artifact_id) {
$res = db_query_params ('SELECT * FROM artifact_vw WHERE artifact_id=$1 AND group_artifact_id=$2',
}
/**
- * getArtifactType - get the ArtifactType Object this Artifact is associated with.
+ * getArtifactType - get the ArtifactType Object this Artifact is associated with.
*
- * @return object ArtifactType.
+ * @return object ArtifactType.
*/
function &getArtifactType() {
return $this->ArtifactType;
}
/**
- * getID - get this ArtifactID.
+ * getID - get this ArtifactID.
*
- * @return int The artifact_id #.
+ * @return int The artifact_id #.
*/
function getID() {
return $this->data_array['artifact_id'];
}
/**
- * getStringID - get a string display for this ArtifactID.
+ * getStringID - get a string display for this ArtifactID.
*
- * @return string The artifact_id #.
+ * @return string The artifact_id #.
*/
function getStringID() {
return '[#'.$this->data_array['artifact_id'].']';
}
/**
- * getStatusID - get open/closed/deleted flag.
+ * getStatusID - get open/closed/deleted flag.
*
- * @return int Status: (1) Open, (2) Closed, (3) Deleted.
+ * @return int Status: (1) Open, (2) Closed, (3) Deleted.
*/
function getStatusID() {
return $this->data_array['status_id'];
}
/**
- * getStatusName - get open/closed/deleted text.
+ * getStatusName - get open/closed/deleted text.
*
- * @return string The status name.
+ * @return string The status name.
*/
function getStatusName() {
return $this->data_array['status_name'];
}
/**
- * getCustomStatusName - get custom status value text.
+ * getCustomStatusName - get custom status value text.
*
- * @return string The custom status name.
+ * @return string The custom status name.
*/
function getCustomStatusName() {
$custom_status_id = $this->ArtifactType->getCustomStatusField();
}
/**
- * getPriority - get priority flag.
+ * getPriority - get priority flag.
*
- * @return int priority.
+ * @return int priority.
*/
function getPriority() {
return $this->data_array['priority'];
}
/**
- * getSubmittedBy - get ID of submitter.
+ * getSubmittedBy - get ID of submitter.
*
- * @return int user_id of submitter.
+ * @return int user_id of submitter.
*/
function getSubmittedBy() {
return $this->data_array['submitted_by'];
}
/**
- * getSubmittedEmail - get email of submitter.
+ * getSubmittedEmail - get email of submitter.
*
- * @return string The email of submitter.
+ * @return string The email of submitter.
*/
function getSubmittedEmail() {
return $this->data_array['submitted_email'];
}
/**
- * getSubmittedRealName - get real name of submitter.
+ * getSubmittedRealName - get real name of submitter.
*
- * @return string The real name of submitter.
+ * @return string The real name of submitter.
*/
function getSubmittedRealName() {
return $this->data_array['submitted_realname'];
}
/**
- * getSubmittedUnixName - get login name of submitter.
+ * getSubmittedUnixName - get login name of submitter.
*
- * @return string The unix name of submitter.
+ * @return string The unix name of submitter.
*/
function getSubmittedUnixName() {
return $this->data_array['submitted_unixname'];
}
/**
- * getAssignedTo - get ID of assignee.
+ * getAssignedTo - get ID of assignee.
*
- * @return int user_id of assignee.
+ * @return int user_id of assignee.
*/
function getAssignedTo() {
return $this->data_array['assigned_to'];
}
/**
- * getAssignedEmail - get email of assignee.
+ * getAssignedEmail - get email of assignee.
*
- * @return string The email of assignee.
+ * @return string The email of assignee.
*/
function getAssignedEmail() {
return $this->data_array['assigned_email'];
}
/**
- * getAssignedRealName - get real name of assignee.
+ * getAssignedRealName - get real name of assignee.
*
- * @return string The real name of assignee.
+ * @return string The real name of assignee.
*/
function getAssignedRealName() {
return $this->data_array['assigned_realname'];
}
/**
- * getAssignedUnixName - get login name of assignee.
+ * getAssignedUnixName - get login name of assignee.
*
- * @return string The unix name of assignee.
+ * @return string The unix name of assignee.
*/
function getAssignedUnixName() {
return $this->data_array['assigned_unixname'];
}
/**
- * getOpenDate - get unix time of creation.
+ * getOpenDate - get unix time of creation.
*
- * @return int unix time.
+ * @return int unix time.
*/
function getOpenDate() {
return $this->data_array['open_date'];
}
/**
- * getCloseDate - get unix time of closure.
+ * getCloseDate - get unix time of closure.
*
- * @return int unix time.
+ * @return int unix time.
*/
function getCloseDate() {
return $this->data_array['close_date'];
}
/**
- * getLastModifiedDate - the last_modified_date of this task.
+ * getLastModifiedDate - the last_modified_date of this task.
*
- * @return int the last_modified_date.
+ * @return int the last_modified_date.
*/
function getLastModifiedDate() {
return $this->data_array['last_modified_date'];
}
/**
- * getSummary - get text summary of artifact.
+ * getSummary - get text summary of artifact.
*
- * @return string The summary (subject).
+ * @return string The summary (subject).
*/
function getSummary() {
return $this->data_array['summary'];
}
/**
- * getDetails - get text body (message) of artifact.
+ * getDetails - get text body (message) of artifact.
*
- * @return string The body (message).
+ * @return string The body (message).
*/
function getDetails() {
return $this->data_array['details'];
}
/**
- * delete - delete this tracker and all its related data.
+ * delete - delete this tracker and all its related data.
*
- * @param bool I'm Sure.
- * @return bool true/false;
+ * @param bool $sure I'm Sure.
+ * @return bool true/false;
*/
function delete($sure) {
if (!$sure) {
}
/**
- * setMonitor - user can monitor this artifact.
+ * setMonitor - user can monitor this artifact.
*
- * @return false - always false - always use the getErrorMessage() for feedback
+ * @return bool Always false - always use the getErrorMessage() for feedback
*/
function setMonitor() {
if (session_loggedin()) {
-
$user_id=user_getid();
- $user =& user_get_object(user_getid());
- $email=' ';
-
- //we don't want to include the "And email=" because
- //a logged-in user's email may have changed
- $email_sql='';
-
} else {
-
$this->setError(_('Valid Email Address Required'));
return false;
-
}
$res = db_query_params ('SELECT * FROM artifact_monitor WHERE artifact_id=$1 AND user_id=$2',
$this->setError(db_error());
return false;
} else {
- $this->setError(_('Now Monitoring Artifact'));
+ $this->setError(_('Monitoring Started'));
return false;
}
} else {
AND user_id=$2',
array ($this->getID(),
$user_id)) ;
- $this->setError(_('Artifact Monitoring Deactivated'));
+ $this->setError(_('Monitoring Stopped'));
return false;
}
}
}
/**
- * getMonitorIds - array of email addresses monitoring this Artifact.
+ * getMonitorIds - array of email addresses monitoring this Artifact.
*
- * @return array of email addresses monitoring this Artifact.
+ * @return array of email addresses monitoring this Artifact.
*/
function getMonitorIds() {
$res = db_query_params ('SELECT user_id FROM artifact_monitor WHERE artifact_id=$1',
}
/**
- * getHistory - returns a result set of audit trail for this support request.
+ * getHistory - returns a result set of audit trail for this support request.
*
- * @return resource result set.
+ * @return resource result set.
*/
function getHistory() {
return db_query_params ('SELECT * FROM artifact_history_user_vw WHERE artifact_id=$1 ORDER BY entrydate DESC, id ASC',
}
/**
- * getMessages - get the list of messages attached to this artifact.
+ * getMessages - get the list of messages attached to this artifact.
*
- * @param string $order
- * @return resource result set.
+ * @param string $order
+ * @return resource result set.
*/
function getMessages($ascending='up') {
/*
}
/**
- * getMessage - get a message attached to this artifact.
+ * getMessage - get a message attached to this artifact.
*
- * @param int $msg_id id of the message.
- * @access public
- * @return database result set.
+ * @param int $msg_id id of the message.
+ * @access public
+ * @return resource database result set.
*/
function getMessage($msg_id) {
if (!$msg_id) {
}
/**
- * getMessageObjects - get an array of message objects.
+ * getMessageObjects - get an array of message objects.
*
- * @return array Of ArtifactMessage objects.
+ * @return array Of ArtifactMessage objects.
*/
function &getMessageObjects() {
$res=$this->getMessages();
}
/**
- * getFiles - get array of ArtifactFile's.
+ * getFiles - get array of ArtifactFile's.
*
- * @return array of ArtifactFile's.
+ * @return array of ArtifactFile's.
*/
function &getFiles() {
if (!isset($this->files)) {
/**
* getRelatedTasks - get array of related tasks
*
- * @return Database result set
+ * @return resource Database result set
*/
function getRelatedTasks() {
if (!$this->relatedtasks) {
}
/**
- * addMessage - attach a text message to this Artifact.
+ * addMessage - attach a text message to this Artifact.
*
- * @param string The message being attached.
- * @param string Email address of message creator.
- * @param bool Whether to email out a followup.
- * @access private
- * @return boolean success.
+ * @param string $body The $string message being attached.
+ * @param bool $by Email $string address of message creator.
+ * @param bool $send_followup Whether $bool to email out a followup.
+ * @return bool success.
*/
function addMessage($body,$by=false,$send_followup=false) {
if (!$body) {
}
if (session_loggedin()) {
$user_id=user_getid();
- $user =& user_get_object($user_id);
+ $user = user_get_object($user_id);
if (!$user || !is_object($user)) {
- $this->setError('ERROR - Logged In User But Could Not Get User Object');
+ $this->setError('Error: Logged In User But Could Not Get User Object');
return false;
}
// we'll store this email even though it will likely never be used -
}
/**
- * addHistory - add an entry to audit trail.
+ * addHistory - add an entry to audit trail.
*
- * @param string The name of the field in the database being modified.
- * @param string The former value of this field.
- * @param array Array of data to change submitter and time of submit like: array('user' => 127, 'time' => 1234556789)
- * @access private
- * @return boolean success.
+ * @param string $field_name The name of the field in the database being modified.
+ * @param string $old_value The former value of this field.
+ * @param array $importData Array of data to change submitter and time of submit like:
+ * array('user' => 127, 'time' => 1234556789)
+ * @access private
+ * @return boolean success.
*/
function addHistory($field_name,$old_value, $importData = array()) {
if (array_key_exists('user', $importData)){
}
/**
- * setStatus - set the status of this artifact.
+ * setStatus - set the status of this artifact.
*
- * @param int The artifact status ID.
- * @param int Closing date if status = 1
+ * @param int The artifact status ID.
+ * @param int Closing date if status = 1
*
- * @return boolean success.
+ * @return boolean success.
*/
function setStatus($status_id, $closingTime=False) {
db_begin();
}
}
-
//commiting changes
db_commit();
return true;
}
/**
- * update - update the fields in this artifact.
+ * update - update the fields in this artifact.
*
- * @param int The artifact priority.
- * @param int The artifact status ID.
- * @param int The person to which this artifact is to be assigned.
- * @param string The artifact summary.
- * @param int The canned response.
- * @param string Attaching another comment.
- * @param int Allows you to move an artifact to another type.
- * @param array Array of extra fields like: array(15=>'foobar',22=>'1');
- * @param string The description.
- * @return boolean success.
+ * @param int $priority The artifact priority.
+ * @param int $status_id The artifact status ID.
+ * @param int $assigned_to The person to which this artifact is to be assigned.
+ * @param string $summary The artifact summary.
+ * @param int $canned_response The canned response.
+ * @param string $details Attaching another comment.
+ * @param int $new_artifact_type_id Allows you to move an artifact to another type.
+ * @param array $extra_fields Array of extra fields like: array(15=>'foobar',22=>'1');
+ * @param string $description The description.
+ * @return boolean success.
*/
function update($priority,$status_id,
$assigned_to,$summary,$canned_response,$details,$new_artifact_type_id,
// Check that assigned_to is a tech for the tracker
if ($assigned_to != 100) {
if (!forge_check_perm_for_user ($assigned_to, 'tracker', $this->ArtifactType->getID(), 'tech')) {
- $this->setError(_("Invalid assigned_to (assigned person is not a technician)"));
+ $this->setError(_("Invalid assigned person: must be a technician"));
return false;
}
}
//
// Get a lock on this row in the database
//
- $lock = db_query_params ('SELECT * FROM artifact WHERE artifact_id=$1 FOR UPDATE',
- array ($this->getID())) ;
+ db_query_params ('SELECT * FROM artifact WHERE artifact_id=$1 FOR UPDATE', array ($this->getID())) ;
$artifact_type_id = $this->ArtifactType->getID();
//
// Attempt to move this Artifact to a new ArtifactType
}
// Add a message to explain that the tracker was moved.
- $message = 'Moved from '.$this->ArtifactType->getName().' to '.$newArtifactType->getName();
+ $message = sprintf(_('Moved from %1$s to %2$s'),
+ $this->ArtifactType->getName(),
+ $newArtifactType->getName());
$this->addHistory('type', $this->ArtifactType->getName());
$this->addMessage($message,'',0);
$result = db_query_qpa($qpa);
if (!$result || db_affected_rows($result) < 1) {
- $this->setError(_('Error - update failed!').db_error());
+ $this->setError(_('Update failed').db_error());
db_rollback();
return false;
} else {
}
/**
- * updateLastModifiedDate - update the last_modified_date attribute of this artifact.
+ * updateLastModifiedDate - update the last_modified_date attribute of this artifact.
*
- * @return true on success / false on failure
+ * @return bool true on success / false on failure
*/
function updateLastModifiedDate() {
$res = db_query_params ('UPDATE artifact SET last_modified_date=EXTRACT(EPOCH FROM now())::integer WHERE artifact_id=$1',
}
/**
- * assignToMe - assigns this artifact to current user
+ * assignToMe - assigns this artifact to current user
*
- * @return true on success / false on failure
+ * @return bool true on success / false on failure
*/
function assignToMe() {
if (!session_loggedin() || !($this->ArtifactType->userIsAdmin() || $this->ArtifactType->userIsTechnician())) {
}
/**
- * updateExtraFields - updates the extra data elements for this artifact
- * e.g. the extra fields created and defined by the admin.
+ * updateExtraFields - updates the extra data elements for this artifact
+ * e.g. the extra fields created and defined by the admin.
*
- * @param array Array of extra fields like: array(15=>'foobar',22=>'1');
- * @param array Array where changes to the extra fields should be logged
- * @return true on success / false on failure
+ * @param array Array of extra fields like: array(15=>'foobar',22=>'1');
+ * @param array Array where changes to the extra fields should be logged
+ * @return bool true on success / false on failure
*/
function updateExtraFields($extra_fields,&$changes){
/*
} elseif (($type == ARTIFACT_EXTRAFIELDTYPE_MULTISELECT) || ($type == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX)) {
$extra_fields[$efid]=array('100');
} else {
- $resdel = db_query_params ('DELETE FROM artifact_extra_field_data WHERE artifact_id=$1 AND extra_field_id=$2',
+ db_query_params ('DELETE FROM artifact_extra_field_data WHERE artifact_id=$1 AND extra_field_id=$2',
array ($this->getID(),
$efid)) ;
continue;
$this->addHistory($field_name, $this->ArtifactType->getElementName(array_reverse($old_values)));
$update = true;
- $resdel = db_query_params ('DELETE FROM artifact_extra_field_data WHERE artifact_id=$1 AND extra_field_id=$2',
+ db_query_params ('DELETE FROM artifact_extra_field_data WHERE artifact_id=$1 AND extra_field_id=$2',
array ($this->getID(),
$efid)) ;
} else {
if (!preg_match('/^@/', $ef[$efid]['alias'])) {
$changes["extra_fields"][$efid] = 1;
}
- $resdel = db_query_params ('DELETE FROM artifact_extra_field_data WHERE artifact_id=$1 AND extra_field_id=$2',
+ db_query_params ('DELETE FROM artifact_extra_field_data WHERE artifact_id=$1 AND extra_field_id=$2',
array ($this->getID(),
$efid)) ;
}
/**
- * getExtraFieldData - get an array of data for the extra fields associated with this artifact
+ * getExtraFieldData - get an array of data for the extra fields associated with this artifact
*
- * @return array array of data
+ * @return array array of data
*/
function &getExtraFieldData() {
if (!isset($this->extra_field_data)) {
}
/**
- * marker - adds the > symbol to fields that have been modified for the email message
+ * marker - adds the > symbol to fields that have been modified for the email message
*
*
*/
}
/**
- * mailFollowupEx - send out an email update for this artifact.
+ * mailFollowupEx - send out an email update for this artifact.
*
- * @param time_t Time of the change
- * @param int (1) initial/creation (2) update.
- * @param array Array of additional addresses to mail to.
- * @param array Array of fields changed in this update .
- * @access private
- * @return boolean success.
+ * @param time_t Time of the change
+ * @param int (1) initial/creation (2) update.
+ * @param array Array of additional addresses to mail to.
+ * @param array Array of fields changed in this update .
+ * @access private
+ * @return boolean success.
*/
- function mailFollowupEx($tm,$type,$more_addresses=false,$changes='') {
+ function mailFollowupEx($tm, $type, $more_addresses = false, $changes='') {
$monitor_ids = array();
$changes=array();
}
- $sess = session_get_user() ;
- if ($type == 1) { // Initial opening
- if ($sess) {
- $body = $this->ArtifactType->Group->getUnixName() . '-' . $this->ArtifactType->getName() ." item #". $this->getID() .", was opened at ". date( _('Y-m-d H:i'), $this->getOpenDate() ) . " by " . $sess->getRealName () ;
- } else {
- $body = $this->ArtifactType->Group->getUnixName() . '-' . $this->ArtifactType->getName() ." item #". $this->getID() .", was opened at ". date( _('Y-m-d H:i'), $this->getOpenDate() ) ;
- }
+ $sess = session_get_user();
+ $name = util_unconvert_htmlspecialchars($this->ArtifactType->getName());
+ $body = $this->ArtifactType->Group->getUnixName() . '-' . $name .' '. $this->getStringID();
+
+ if ($type == 1) {
+ $body .= ' was opened at '.date('Y-m-d H:i', $this->getOpenDate());
+ } elseif ($type == 3) {
+ $body .= ' was deleted at '.date('Y-m-d H:i', time());
} else {
- if ($sess) {
- $body = $this->ArtifactType->Group->getUnixName() . '-' . $this->ArtifactType->getName() .
- " item #" . $this->getID() .
- " was changed at " .
- date(_('Y-m-d H:i'), $tm) . " by " .
- $sess->getRealName();
- } else {
- $body = $this->ArtifactType->Group->getUnixName() . '-' . $this->ArtifactType->getName() .
- " item #" . $this->getID() .
- " was changed at " .
- date(_('Y-m-d H:i'), $tm);
- }
+ $body .= ' was changed at '.date('Y-m-d H:i', $tm);
+ }
+ if ($sess) {
+ $body .= ' by ' . $sess->getRealName();
}
-
- $body .= "\nYou can respond by visiting: ".
- "\n".util_make_url ('/tracker/?func=detail&atid='. $this->ArtifactType->getID() .
+ if ($type == 1 || $type == 2) {
+ $body .= "\nYou can respond by visiting: ".
+ "\n".util_make_url ('/tracker/?atid='. $this->ArtifactType->getID() .
"&aid=". $this->getID() .
"&group_id=". $this->ArtifactType->Group->getID()) .
- "\nOr by replying to this e-mail entering your response between the following markers: ".
- "\n".ARTIFACT_MAIL_MARKER.
- "\n(enter your response here, only in plain text format)".
- "\n".ARTIFACT_MAIL_MARKER.
- "\n\n".
- $this->marker('status',$changes).
+ "\nOr by replying to this e-mail entering your response between the following markers: ".
+ "\n".ARTIFACT_MAIL_MARKER.
+ "\n(enter your response here, only in plain text format)".
+ "\n".ARTIFACT_MAIL_MARKER.
+ "\n";
+ }
+
+ $body .= "\n".$this->marker('status',$changes).
"Status: ". $this->getStatusName() ."\n".
$this->marker('priority',$changes).
"Priority: ". $this->getPriority() ."\n".
$body .= $ef["name"].": ".$ef["value"]."\n";
}
- $subject='['. $this->ArtifactType->Group->getUnixName() . '-' . $this->ArtifactType->getName() . '][' . $this->getID() .'] '. util_unconvert_htmlspecialchars( $this->getSummary() );
+ $subject='['. $this->ArtifactType->Group->getUnixName() . '-' . $name . ']' . $this->getStringID() .' '. util_unconvert_htmlspecialchars( $this->getSummary() );
if ($type > 1) {
// get all the email addresses that are monitoring this request or the ArtifactType
$monitor_ids[] = db_result($result2,$i,'user_id');
}
-
$body .= "\n\n";
if ($i == 0) {
$body .= $this->marker('details',$changes);
$extra_headers = 'Reply-to: '.$from;
// load the e-mail addresses of the users
- $users =& user_get_objects($monitor_ids);
+ $users = user_get_objects($monitor_ids);
if (count($users) > 0) {
foreach ($users as $user) {
if ($user->getStatus() == "A") { //we are only sending emails to active users
/**
* getExtraFieldDataText - Return the extra fields' data in a human-readable form.
*
- * @return array Array containing field ID => field name and value associated to it for
- * this artifact
+ * @return array Array containing field ID => field name and value associated to it for
+ * this artifact
*/
function getExtraFieldDataText() {
// First we get the list of extra fields and the data
return ($a_date < $b_date) ? -1 : 1;
break;
case 'priority':
- $a_prority = $a->getPriority() ;
- $b_prority = $b->getPriority() ;
- return ($a_prority < $b_prority) ? -1 : 1;
+ $a_priority = $a->getPriority() ;
+ $b_priority = $b->getPriority() ;
+ return ($a_priority < $b_priority) ? -1 : 1;
break;
default:
$aa=$a->getExtraFieldDataText();