public function actionAddOpportunityRelation($relationModuleId, $portletId, $uniqueLayoutId, $id, $relationModelId, $relationAttributeName, $redirect) { $opportunityProduct = OpportunityProduct::GetById(intval($id)); $opportunity = Opportunity::GetById(intval($relationModelId)); if ($opportunityProduct->opportunity != $opportunity) { $opportunityProduct->opportunity = $opportunity; $opportunityProduct->save(); } if ((bool) $redirect) { $isViewLocked = ZurmoDefaultViewUtil::getLockKeyForDetailsAndRelationsView('lockPortletsForDetailsAndRelationsView'); $redirectUrl = Yii::app()->createUrl('/' . $relationModuleId . '/default/details', array('id' => $relationModelId)); $this->redirect(array('/' . $relationModuleId . '/defaultPortlet/modalRefresh', 'portletId' => $portletId, 'uniqueLayoutId' => $uniqueLayoutId, 'redirectUrl' => $redirectUrl, 'portletParams' => array('relationModuleId' => $relationModuleId, 'relationModelId' => $relationModelId), 'portletsAreRemovable' => !$isViewLocked)); } }