//
// ape: Disabled, private means only restricted to members. So, no special rules #2503.
// if (!forge_check_perm ('tracker_admin', $this->ArtifactType->Group->getID()) {
-// $this->setError(_('Only Artifact Admins Can Modify Private ArtifactTypes'));
+// $this->setError(_('Only Artifact Admins Can Modify Private Artifact Types'));
// return false;
// }
}
return $this->data_array['artifact_id'];
}
+ /**
+ * getStringID - get a string display for this ArtifactID.
+ *
+ * @return string The artifact_id #.
+ */
+ function getStringID() {
+ return '[#'.$this->data_array['artifact_id'].']';
+ }
+
/**
* getStatusID - get open/closed/deleted flag.
*
// Check that assigned_to is a tech for the tracker
if ($assigned_to != 100) {
- if (!forge_check_perm ('tracker', $this->ArtifactType->getID(), 'tech')) {
+ if (!forge_check_perm_for_user ($assigned_to, 'tracker', $this->ArtifactType->getID(), 'tech')) {
$this->setError(_("Invalid assigned_to (assigned person is not a technician)"));
return false;
}
$efk=array_keys($ef);
// If there is a status field, then check against the workflow.
- for ($i=0; $i<count($efk); $i++) {
- $efid=$efk[$i];
- $type=$ef[$efid]['field_type'];
- if ($type == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
- // Get previous value.
- $res = db_query_params ('SELECT field_data FROM artifact_extra_field_data
- WHERE artifact_id=$1 AND extra_field_id=$2',
- array($this->getID(),
- $efid));
- $old = (db_numrows($res)>0) ? db_result($res,0,'field_data') : 100;
- if ($old != $extra_fields[$efid]) {
- $atw = new ArtifactWorkflow($this->ArtifactType, $efid);
- if (!$atw->checkEvent($old, $extra_fields[$efid])) {
- $this->setError('Workflow error: You are not authorized to change the Status ('.$old.' => '.$extra_fields[$efid].')');
- return false;
+ // Unless if we change type.
+ if (! isset($changes['Type']) || !$changes['Type']) {
+ for ($i=0; $i<count($efk); $i++) {
+ $efid=$efk[$i];
+ $type=$ef[$efid]['field_type'];
+ if ($type == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
+ // Get previous value.
+ $res = db_query_params ('SELECT field_data FROM artifact_extra_field_data
+ WHERE artifact_id=$1 AND extra_field_id=$2',
+ array($this->getID(),
+ $efid));
+ $old = (db_numrows($res)>0) ? db_result($res,0,'field_data') : 100;
+ if ($old != $extra_fields[$efid]) {
+ $atw = new ArtifactWorkflow($this->ArtifactType, $efid);
+ if (!$atw->checkEvent($old, $extra_fields[$efid])) {
+ $this->setError('Workflow error: You are not authorized to change the Status ('.$old.' => '.$extra_fields[$efid].')');
+ return false;
+ }
}
}
}