浏览代码

Fix for a regression introduced by [r3394] while fixing #1000: handling of OPT_ATT_MUSTCHANGE. The fix was not working when the original value contained several lines.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3436 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 10 年之前
父节点
当前提交
819e8855b2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      application/cmdbabstract.class.inc.php

+ 1 - 1
application/cmdbabstract.class.inc.php

@@ -1854,7 +1854,7 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay
 				{
 					$sNullValue = "'$sNullValue'"; // Add quotes to turn this into a JS string if it's not a number
 				}
-				$sOriginalValue = ($iFlags & OPT_ATT_MUSTCHANGE) ? "'".addslashes($value)."'" : 'undefined';
+				$sOriginalValue = ($iFlags & OPT_ATT_MUSTCHANGE) ? json_encode($value) : 'undefined';
 				$oPage->add_ready_script("$('#$iId').bind('".implode(' ', $aEventsList)."', function(evt, sFormId) { return ValidateField('$iId', '$sPattern', $bMandatory, sFormId, $sNullValue, $sOriginalValue) } );\n"); // Bind to a custom event: validate
 			}
 			$aDependencies = MetaModel::GetDependentAttributes($sClass, $sAttCode); // List of attributes that depend on the current one