Fixed Trac #427: unable to remove all items from a linkset when editing an object.

SVN:trunk[1322]
This commit is contained in:
Denis Flaven
2011-07-04 08:21:19 +00:00
parent 56ac89f6a6
commit 6297526da6
3 changed files with 11 additions and 7 deletions

View File

@@ -2151,16 +2151,20 @@ EOF
/**
* Updates the object from the POSTed parameters
*/
public function UpdateObject($sFormPrefix = '')
public function UpdateObject($sFormPrefix = '', $aAttList = null)
{
$aErrors = array();
foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode=>$oAttDef)
if (!is_array($aAttList))
{
$sAttList = $this->FlattenZList(MetaModel::GetZListItems(get_class($this), 'details'));
}
foreach($sAttList as $sAttCode)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
if ($oAttDef->IsLinkSet() && $oAttDef->IsIndirect())
{
$aLinks = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null);
if (is_null($aLinks)) continue;
$sLinkedClass = $oAttDef->GetLinkedClass();
$sExtKeyToRemote = $oAttDef->GetExtKeyToRemote();
$sExtKeyToMe = $oAttDef->GetExtKeyToMe();