mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 06:18:44 +02:00
Fixed bug in the data model: organization status was not an enum
SVN:trunk[268]
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
$oAllowedStatuses = new ValueSetEnum('production,implementation,obsolete');
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Description of known error
|
||||
|
||||
@@ -19,7 +19,7 @@ require_once('../application/template.class.inc.php');
|
||||
/**
|
||||
* Possible values for the statuses of objects
|
||||
*/
|
||||
$oAllowedStatuses = new ValueSetEnum('production,implementation,obsolete');
|
||||
define('STANDARD_STATUSES', 'production,implementation,obsolete');
|
||||
|
||||
/**
|
||||
* Relation graphs
|
||||
@@ -72,7 +72,7 @@ class bizOrganization extends cmdbAbstractObject
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("label"=>"Name", "description"=>"Common name", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array() )));
|
||||
MetaModel::Init_AddAttribute(new AttributeString("code", array("label"=>"Code", "description"=>"Organization code (Siret, DUNS,...)", "allowed_values"=>null, "sql"=>"code", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array() )));
|
||||
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Lifecycle status", "allowed_values"=>$oAllowedStatuses, "sql"=>"status", "default_value"=>"implementation", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Lifecycle status", "allowed_values"=>new ValueSetEnum(STANDARD_STATUSES), "sql"=>"status", "default_value"=>"implementation", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("parent_id", array("targetclass"=>"bizOrganization", "label"=>"Parent", "description"=>"Parent organization", "allowed_values"=>null, "sql"=>"parent_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeExternalField("parent_name", array("label"=>"Parent Name", "description"=>"Name of the parent organization", "allowed_values"=>null, "extkey_attcode"=> 'parent_id', "target_attcode"=>"name")));
|
||||
|
||||
@@ -126,8 +126,6 @@ class logRealObject extends cmdbAbstractObject
|
||||
{
|
||||
public static function Init()
|
||||
{
|
||||
global $oAllowedStatuses;
|
||||
|
||||
$aParams = array
|
||||
(
|
||||
"category" => "bizmodel,searchable",
|
||||
@@ -145,7 +143,7 @@ class logRealObject extends cmdbAbstractObject
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("label"=>"Name", "description"=>"Common name", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Lifecycle status", "allowed_values"=>$oAllowedStatuses, "sql"=>"status", "default_value"=>"implementation", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("label"=>"Status", "description"=>"Lifecycle status", "allowed_values"=>new ValueSetEnum(STANDARD_STATUSES), "sql"=>"status", "default_value"=>"implementation", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("org_id", array("targetclass"=>"bizOrganization", "label"=>"Organization", "description"=>"ID of the object owner organization", "allowed_values"=>null, "sql"=>"org_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeExternalField("org_name", array("label"=>"Organization", "description"=>"Company / Department owning this object", "allowed_values"=>null, "extkey_attcode"=> 'org_id', "target_attcode"=>"name")));
|
||||
|
||||
|
||||
@@ -813,7 +813,8 @@ class AttributeEnum extends AttributeString
|
||||
}
|
||||
else
|
||||
{
|
||||
$sLabel = $sValue.' ERROR could not find';
|
||||
// #@# todo - record an error silently...
|
||||
$sLabel = $sValue;
|
||||
}
|
||||
// later, we could imagine a detailed description in the title
|
||||
return "<span title=\"\">".parent::GetAsHtml($sLabel)."</span>";
|
||||
@@ -843,6 +844,7 @@ class AttributeDate extends AttributeDBField
|
||||
self::$const_TIMEZONE = new DateTimeZone(self::MYDATETIMEZONE);
|
||||
|
||||
// #@# Init default timezone -> do not get a notice... to be improved !!!
|
||||
// duplicated in the email test page (the mail function does trigger a notice as well)
|
||||
date_default_timezone_set(self::MYDATETIMEZONE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user