mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02: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 DBObject $oCurrentObj
|
||||||
* @param $aAlreadyLinked
|
* @param $aAlreadyLinked
|
||||||
*
|
*
|
||||||
|
* @param array $aPrefillFormParam
|
||||||
|
*
|
||||||
* @throws \CoreException
|
* @throws \CoreException
|
||||||
* @throws \Exception
|
* @throws \MissingQueryArgument
|
||||||
* @throws \OQLException
|
* @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";
|
$sHtml = "<div class=\"wizContainer\" style=\"vertical-align:top;\">\n";
|
||||||
|
|
||||||
@@ -333,6 +335,7 @@ class UILinksWidgetDirect
|
|||||||
|
|
||||||
$aArgs = array_merge($oCurrentObj->ToArgs('this'), $oFilter->GetInternalParams());
|
$aArgs = array_merge($oCurrentObj->ToArgs('this'), $oFilter->GetInternalParams());
|
||||||
$oFilter->SetInternalParams($aArgs);
|
$oFilter->SetInternalParams($aArgs);
|
||||||
|
$oCurrentObj->PrefillForm('search', $aPrefillFormParam);
|
||||||
}
|
}
|
||||||
$oBlock = new DisplayBlock($oFilter, 'search', false);
|
$oBlock = new DisplayBlock($oFilter, 'search', false);
|
||||||
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}",
|
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}",
|
||||||
|
|||||||
@@ -382,8 +382,16 @@ try
|
|||||||
$iInputId = utils::ReadParam('iInputId', '');
|
$iInputId = utils::ReadParam('iInputId', '');
|
||||||
$iCurrObjectId = utils::ReadParam('iObjId', 0);
|
$iCurrObjectId = utils::ReadParam('iObjId', 0);
|
||||||
$oPage->SetContentType('text/html');
|
$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 = new UILinksWidgetDirect($sClass, $sAttCode, $iInputId);
|
||||||
$oWidget->GetObjectsSelectionDlg($oPage, $oObj, $aAlreadyLinked);
|
$oWidget->GetObjectsSelectionDlg($oPage, $oObj, $aAlreadyLinked, $aPrefillFormParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// ui.linksdirectwidget
|
// ui.linksdirectwidget
|
||||||
|
|||||||
Reference in New Issue
Block a user