From 20c5e1b6ad7139152e53119544bf13f5456542e6 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Tue, 25 Sep 2012 08:31:42 +0000 Subject: [PATCH] Protects against temporary objects that exist only in memory (id < 0) SVN:trunk[2203] --- application/ui.linkswidget.class.inc.php | 2 +- application/wizardhelper.class.inc.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/application/ui.linkswidget.class.inc.php b/application/ui.linkswidget.class.inc.php index 8f9c233ad..7c689b96c 100644 --- a/application/ui.linkswidget.class.inc.php +++ b/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); } /** diff --git a/application/wizardhelper.class.inc.php b/application/wizardhelper.class.inc.php index befd88fbc..491df1c7c 100644 --- a/application/wizardhelper.class.inc.php +++ b/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