//define('ARTIFACT_EXTRAFIELDTYPE_ASSIGNEE',8);
define('ARTIFACT_EXTRAFIELDTYPE_RELATION',9);
define('ARTIFACT_EXTRAFIELDTYPE_INTEGER',10);
+/* reserved for aljeux extension, for merge into FusionForge */
+define('ARTIFACT_EXTRAFIELDTYPE_FORMULA',11);
+/* reserved for Evolvis extension, for merge into FusionForge */
+define('ARTIFACT_EXTRAFIELDTYPE_DATETIME',12);
class ArtifactExtraField extends Error {
var $data_array;
/**
- * ArtifactExtraField - Constructer
- *
- * @param object ArtifactType object.
- * @param array (all fields from artifact_file_user_vw) OR id from database.
- * @return boolean success.
+ * @param $ArtifactType
+ * @param bool $data
*/
function __construct(&$ArtifactType, $data=false) {
$this->Error();
//was ArtifactType legit?
if (!$ArtifactType || !is_object($ArtifactType)) {
$this->setError('ArtifactExtraField: No Valid ArtifactType');
- return false;
+ return;
}
//did ArtifactType have an error?
if ($ArtifactType->isError()) {
$this->setError('ArtifactExtraField: '.$ArtifactType->getErrorMessage());
- return false;
+ return;
}
$this->ArtifactType =& $ArtifactType;
if ($data) {
if (is_array($data)) {
$this->data_array =& $data;
- return true;
} else {
- if (!$this->fetchData($data)) {
- return false;
- } else {
- return true;
- }
+ $this->fetchData($data);
}
}
}
/**
* fetchData - re-fetch the data for this ArtifactExtraField from the database.
*
- * @param int ID of the Box.
+ * @param int $id ID of the Box.
* @return boolean success.
*/
function fetchData($id) {
if (preg_match("/[^[:alnum:]_@\\-]/", $alias)) {
$this->setError(_('The alias contains invalid characters. Only letters, numbers, hypens (-), at sign (@) and underscores (_) allowed.'));
return false;
- } else if (in_array($alias, $reserved_alias)) { // alias is reserved?
+ } elseif (in_array($alias, $reserved_alias)) { // alias is reserved?
$this->setError(sprintf(_('\'%1$s\' is a reserved alias. Please provide another name.'), $alias));
return false;
}
/**
* Generate an alias for this field. The alias can be entered by the user or
* be generated automatically from the name of the field.
- * @param string Alias entered by the user
- * @param string Name of the field entered by the user (it'll be used when $alias is empty)
+ * @param string $alias Alias entered by the user
+ * @param string $name Name of the field entered by the user (it'll be used when $alias is empty)
* @return string
*/
function generateAlias($alias, $name) {
if (!$res) {
$this->setError(db_error());
return false;
- } else if (db_numrows($res) > 0) { // found another field with the same alias
+ } elseif (db_numrows($res) > 0) { // found another field with the same alias
$conflict = true;
$serial++;
$alias = $alias.$serial;
return false;
}
$i = 1;
+ $data = array();
while ($i <= $max) {
if ($i == $new_pos) {
$data[] = $element_id;
// mode: php
// c-file-style: "bsd"
// End:
-
-?>