Explorar o código

Protects against temporary objects that exist only in memory (id < 0)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2203 a333f486-631f-4898-b8df-5754b55c2be0
dflaven %!s(int64=12) %!d(string=hai) anos
pai
achega
c0f5281fdc

+ 1 - 1
application/ui.linkswidget.class.inc.php

@@ -202,7 +202,7 @@ EOF
 	
 	protected function MakeID($sName)
 	{
-		return str_replace(array('[', ']'), '_', $sName);
+		return str_replace(array('[', ']', '-'), '_', $sName);
 	}
 
 	/**

+ 3 - 3
application/wizardhelper.class.inc.php

@@ -76,7 +76,7 @@ class WizardHelper
 							if ( isset($aLinkedObject[$sLinkedAttCode]) && ($aLinkedObject[$sLinkedAttCode] !== null) )
 							{
 								$sLinkedAttDef = MetaModel::GetAttributeDef($sLinkedClass, $sLinkedAttCode);
-								if (($sLinkedAttDef->IsExternalKey()) && ($aLinkedObject[$sLinkedAttCode] != '') && ($aLinkedObject[$sLinkedAttCode] != 0) )
+								if (($sLinkedAttDef->IsExternalKey()) && ($aLinkedObject[$sLinkedAttCode] != '') && ($aLinkedObject[$sLinkedAttCode] > 0) )
 								{
 									// For external keys: load the target object so that external fields
 									// get filled too
@@ -108,7 +108,7 @@ class WizardHelper
 						$oObj->Set($sAttCode, $oDocument);
 					}
 				}
-				else if (($oAttDef->IsExternalKey()) && (!empty($value)) )
+				else if (($oAttDef->IsExternalKey()) && (!empty($value)) && ($value > 0) )
 				{
 					// For external keys: load the target object so that external fields
 					// get filled too
@@ -260,7 +260,7 @@ class WizardHelper
 			foreach($aLinkObj as $sAttCode => $value)
 			{
 				$oAttDef = MetaModel::GetAttributeDef($sLinkClass, $sAttCode);
-				if (($oAttDef->IsExternalKey()) && ($value != '') )
+				if (($oAttDef->IsExternalKey()) && ($value != '')  && ($value > 0))
 				{
 					// For external keys: load the target object so that external fields
 					// get filled too