mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-07 10:04:14 +01:00
N°2044: Enable Search form prefill when adding objects to 1:n
This commit is contained in:
@@ -286,11 +286,13 @@ class UILinksWidgetDirect
|
||||
* @param DBObject $oCurrentObj
|
||||
* @param $aAlreadyLinked
|
||||
*
|
||||
* @param array $aPrefillFormParam
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \Exception
|
||||
* @throws \MissingQueryArgument
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function GetObjectsSelectionDlg($oPage, $oCurrentObj, $aAlreadyLinked)
|
||||
public function GetObjectsSelectionDlg($oPage, $oCurrentObj, $aAlreadyLinked, $aPrefillFormParam = array())
|
||||
{
|
||||
$sHtml = "<div class=\"wizContainer\" style=\"vertical-align:top;\">\n";
|
||||
|
||||
@@ -333,6 +335,7 @@ class UILinksWidgetDirect
|
||||
|
||||
$aArgs = array_merge($oCurrentObj->ToArgs('this'), $oFilter->GetInternalParams());
|
||||
$oFilter->SetInternalParams($aArgs);
|
||||
$oCurrentObj->PrefillForm('search', $aPrefillFormParam);
|
||||
}
|
||||
$oBlock = new DisplayBlock($oFilter, 'search', false);
|
||||
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}",
|
||||
|
||||
@@ -382,8 +382,16 @@ try
|
||||
$iInputId = utils::ReadParam('iInputId', '');
|
||||
$iCurrObjectId = utils::ReadParam('iObjId', 0);
|
||||
$oPage->SetContentType('text/html');
|
||||
$oAppContext = new ApplicationContext();
|
||||
$aPrefillFormParam = array( 'user' => $_SESSION["auth_user"],
|
||||
'context' => $oAppContext->GetAsHash(),
|
||||
'att_code' => $sAttCode,
|
||||
'origin' => 'console',
|
||||
'source_obj' => $oObj,
|
||||
);
|
||||
$aPrefillFormParam['dest_class'] = ($oObj === null ? '' : $oObj->Get($sAttCode)->GetClass());
|
||||
$oWidget = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId);
|
||||
$oWidget->GetObjectsSelectionDlg($oPage, $oObj, $aAlreadyLinked);
|
||||
$oWidget->GetObjectsSelectionDlg($oPage, $oObj, $aAlreadyLinked, $aPrefillFormParam);
|
||||
break;
|
||||
|
||||
// ui.linksdirectwidget
|
||||
|
||||
Reference in New Issue
Block a user