mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-20 15:52:24 +02:00
Fix for #427 implemented into branch 1.1 (delete all team members)
SVN:1.1[1330]
This commit is contained in:
@@ -2069,16 +2069,49 @@ 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))
|
||||
{
|
||||
if ($oAttDef->IsLinkSet() && $oAttDef->IsIndirect())
|
||||
$aAttList = $this->FlattenZList(MetaModel::GetZListItems(get_class($this), 'details'));
|
||||
// Special case to process the case log, if any...
|
||||
// WARNING: if you change this also check the functions DisplayModifyForm and DisplayCaseLog
|
||||
foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef)
|
||||
{
|
||||
$iFlags = $this->GetAttributeFlags($sAttCode);
|
||||
if ($oAttDef instanceof AttributeCaseLog)
|
||||
{
|
||||
if (!($iFlags & (OPT_ATT_HIDDEN|OPT_ATT_SLAVE|OPT_ATT_READONLY)))
|
||||
{
|
||||
// The case log is editable, append it to the list of fields to retrieve
|
||||
$aAttList[] = $sAttCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($aAttList as $sAttCode)
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
|
||||
|
||||
$iFlags = $this->GetAttributeFlags($sAttCode);
|
||||
if ($oAttDef->IsWritable())
|
||||
{
|
||||
if ( $iFlags & (OPT_ATT_HIDDEN | OPT_ATT_READONLY))
|
||||
{
|
||||
// Non-visible, or read-only attribute, do nothing
|
||||
}
|
||||
elseif($iFlags & OPT_ATT_SLAVE)
|
||||
{
|
||||
$value = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null);
|
||||
if (!is_null($value) && ($value != $this->Get($sAttCode)))
|
||||
{
|
||||
$aErrors[] = Dict::Format('UI:AttemptingToSetASlaveAttribute_Name', $oAttDef->GetLabel());
|
||||
}
|
||||
}
|
||||
elseif ($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();
|
||||
@@ -2119,21 +2152,6 @@ EOF
|
||||
}
|
||||
$this->Set($sAttCode, $oLinkedSet);
|
||||
}
|
||||
else if ($oAttDef->IsWritable())
|
||||
{
|
||||
$iFlags = $this->GetAttributeFlags($sAttCode);
|
||||
if ( $iFlags & (OPT_ATT_HIDDEN | OPT_ATT_READONLY))
|
||||
{
|
||||
// Non-visible, or read-only attribute, do nothing
|
||||
}
|
||||
elseif($iFlags & OPT_ATT_SLAVE)
|
||||
{
|
||||
$value = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null);
|
||||
if (!is_null($value) && ($value != $this->Get($sAttCode)))
|
||||
{
|
||||
$aErrors[] = Dict::Format('UI:AttemptingToSetASlaveAttribute_Name', $oAttDef->GetLabel());
|
||||
}
|
||||
}
|
||||
elseif ($oAttDef->GetEditClass() == 'Document')
|
||||
{
|
||||
// There should be an uploaded file with the named attr_<attCode>
|
||||
|
||||
@@ -456,9 +456,9 @@ EOF
|
||||
return parent::GetAttributeFlags($sAttCode, $aReasons);
|
||||
}
|
||||
|
||||
public function UpdateObject($sFormPrefix = '')
|
||||
public function UpdateObject($sFormPrefix = '', $sAttList = null)
|
||||
{
|
||||
parent::UpdateObject($sFormPrefix);
|
||||
parent::UpdateObject($sFormPrefix, $sAttList);
|
||||
// And now read the other post parameters...
|
||||
$oAttributeSet = $this->Get('attribute_list');
|
||||
$aAttributes = array();
|
||||
|
||||
Reference in New Issue
Block a user