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();

View File

@@ -271,7 +271,7 @@ EOF
$sHtml .= "<div style=\"background: #fff; border:0; text-align:center; vertical-align:middle;\"><p>".Dict::S('UI:Message:EmptyList:UseSearchForm')."</p></div>\n";
$sHtml .= "</div>\n";
$sHtml .= "<input type=\"hidden\" id=\"count_{$this->m_sAttCode}{$this->m_sNameSuffix}\" value=\"0\"/>";
$sHtml .= "<input type=\"button\" value=\"".Dict::S('UI:Button:Cancel')."\" onClick=\"$('#dlg_{$this->m_sAttCode}{$this->m_sNameSuffix}').dialog('close');\">&nbsp;&nbsp;<input id=\"btn_ok_{$this->m_sAttCode}{$this->m_sNameSuffix}\" type=\"submit\" value=\"".Dict::S('UI:Button:Add')."\">";
$sHtml .= "<input type=\"button\" value=\"".Dict::S('UI:Button:Cancel')."\" onClick=\"$('#dlg_{$this->m_sAttCode}{$this->m_sNameSuffix}').dialog('close');\">&nbsp;&nbsp;<input id=\"btn_ok_{$this->m_sAttCode}{$this->m_sNameSuffix}\" disabled=\"disabled\" type=\"submit\" value=\"".Dict::S('UI:Button:Add')."\">";
$sHtml .= "</div>\n";
$sHtml .= "</form>\n";
$sHtml .= "</div>\n";

View File

@@ -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();