*/
require_once $gfcommon.'include/Error.class.php';
+require_once $gfcommon.'tracker/ArtifactExtraFieldElement.class.php';
/**
* Gets an ArtifactType object from the artifact type id
return false;
} else {
db_commit();
+ $this->Group->normalizeAllRoles () ;
return $id;
- }
}
}
+ }
/**
* fetchData - re-fetch the data for this ArtifactType from the database.
$res = db_query_params ('SELECT element_id,element_name,status_id
FROM artifact_extra_field_elements
WHERE extra_field_id = $1
- ORDER BY element_id ASC',
+ ORDER BY element_pos ASC, element_id ASC',
array ($id)) ;
$i=0;
while($arr =& db_fetch_array($res)) {
WHERE group_artifact_id=$1',
array ($this->getID())) ;
//echo '4'.db_error();
+ db_query_params ('DELETE FROM role_setting WHERE ref_id=$1 AND section_name=$2 AND role_id IN (SELECT role_id FROM role WHERE group_id=$3)',
+ array ($this->getID(),
+ 'tracker',
+ $this->Group->getID())) ;
db_query_params ('DELETE FROM artifact_group_list
WHERE group_artifact_id=$1',
array ($this->getID())) ;
//echo '11'.db_error();
db_commit();
+
+ $this->Group->normalizeAllRoles () ;
+
return true;
}
WHERE group_artifact_id=$1
AND perm_level in (1,2)
ORDER BY realname',
- array ($this->getID())) ;
- ($sql);
+ array ($this->getID())) ;
}
return $this->technicians_res;
}
*/
function getStatuses() {
if (!isset($this->status_res)) {
- $this->status_res = db_query_params ('SELECT * FROM artifact_status');
+ $this->status_res = db_query_params ('SELECT * FROM artifact_status',array());
}
return $this->status_res;
}
//
// You must have a role in the project if this tracker is not public
//
- if ($this->userIsAdmin() || $this->getCurrentUserPerm() >= 0) {
+ $perm = $this->getCurrentUserPerm();
+ if ($this->userIsAdmin() || (strlen($perm) && $perm >= 0)) {
return true;
} else {
return false;
AND role_setting.section_name=$3',
array ($this->getID(),
user_getid(),
- 'tracker'))) ;
+ 'tracker')),0,0) ;
}
return $this->current_user_perm;
}
$this->getID(),
$this->Group->getID())) ;
- ($sql);
if (!$res || db_affected_rows($res) < 1) {
$this->setError('ArtifactType::Update(): '.db_error());
return false;
}
}
+ /**
+ * getBrowseList - get the free-form string strings.
+ *
+ * @return string instructions.
+ */
+ function getBrowseList() {
+ $list = $this->data_array['browse_list'];
+
+ // remove status_id in the browse list if a custom status exists
+ if (count($this->getExtraFields(ARTIFACT_EXTRAFIELDTYPE_STATUS)) > 0) {
+ $arr = explode(',', $list);
+ $idx = array_search('status_id', $arr);
+ if($idx !== False) {
+ array_splice($arr, $idx, 1);
+ }
+ return join(',', $arr);
+ }
+
+ return $list;
+ }
+
+ /**
+ * setCustomStatusField - set the extra_field_id of the field containing the custom status.
+ * @param int The extra field id.
+ * @return boolean success.
+ */
+ function setBrowseList($list) {
+ $res=db_query_params ('UPDATE artifact_group_list
+ SET browse_list=$1
+ WHERE group_artifact_id=$2',
+ array($list,
+ $this->getID()));
+ $this->fetchData($this->getID());
+ return $res;
+ }
+
}
// Local Variables: