浏览代码

Implemented Track #582: "stable name" for synchro_data_xxx tables.
Do not allow changing read-only attributes by CSV import.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2133 a333f486-631f-4898-b8df-5754b55c2be0

dflaven 13 年之前
父节点
当前提交
7a28e07aeb
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      core/bulkchange.class.inc.php

+ 7 - 1
core/bulkchange.class.inc.php

@@ -401,7 +401,13 @@ class BulkChange
 			if ($sAttCode == 'id') continue;
 
 			$oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
-			if ($oAttDef->IsLinkSet() && $oAttDef->IsIndirect())
+			$aReasons = array();
+			$iFlags = $oTargetObj->GetAttributeFlags($sAttCode, $aReasons);
+			if ( (($iFlags & OPT_ATT_READONLY) == OPT_ATT_READONLY) && ( $oTargetObj->Get($sAttCode) != $aRowData[$iCol]) )
+			{
+					$aErrors[$sAttCode] = "the attribute '$sAttCode' is read-only and cannot be modified (current value: ".$oTargetObj->Get($sAttCode).", proposed value: {$aRowData[$iCol]}).";
+			}
+			else if ($oAttDef->IsLinkSet() && $oAttDef->IsIndirect())
 			{
 				try
 				{