소스 검색

Internal: new setting to tweak the data model by allowing null for all external keys (use with care!)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3016 a333f486-631f-4898-b8df-5754b55c2be0
romainq 11 년 전
부모
커밋
7e5330827f
2개의 변경된 파일19개의 추가작업 그리고 3개의 파일을 삭제
  1. 10 2
      core/attributedef.class.inc.php
  2. 9 1
      core/config.class.inc.php

+ 10 - 2
core/attributedef.class.inc.php

@@ -1,5 +1,5 @@
 <?php
-// Copyright (C) 2010-2012 Combodo SARL
+// Copyright (C) 2010-2013 Combodo SARL
 //
 //   This file is part of iTop.
 //
@@ -2843,7 +2843,15 @@ class AttributeExternalKey extends AttributeDBFieldVoid
 	
 
 	public function GetDefaultValue() {return 0;}
-	public function IsNullAllowed() {return $this->Get("is_null_allowed");}
+	public function IsNullAllowed()
+	{
+		if (MetaModel::GetConfig()->Get('disable_mandatory_ext_keys'))
+		{
+			return true;
+		}
+		return $this->Get("is_null_allowed");
+	}
+
 
 	public function GetBasicFilterOperators()
 	{

+ 9 - 1
core/config.class.inc.php

@@ -1,5 +1,5 @@
 <?php
-// Copyright (C) 2010-2012 Combodo SARL
+// Copyright (C) 2010-2013 Combodo SARL
 //
 //   This file is part of iTop.
 //
@@ -147,6 +147,14 @@ class Config
 			'source_of_value' => '',
 			'show_in_conf_sample' => false,
 		),
+		'disable_mandatory_ext_keys' => array(
+			'type' => 'bool',
+			'description' => 'For developpers: allow every external keys to be undefined',
+			'default' => true,
+			'value' => true,
+			'source_of_value' => '',
+			'show_in_conf_sample' => false,
+		),
 		'graphviz_path' => array(
 			'type' => 'string',
 			'description' => 'Path to the Graphviz "dot" executable for graphing objects lifecycle',