mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°3629 - Activity panel: Fix case logs not saved during object creation
This commit is contained in:
@@ -2754,9 +2754,14 @@ EOF
|
||||
/**
|
||||
* @param \WebPage $oPage
|
||||
* @param string $sClass
|
||||
* @param null $oObjectToClone
|
||||
* @param \DBObject|null $oSourceObject Object to use for the creation form, can be either the class to instantiate, an object to clone or an object to use (eg. already prefilled / modeled object)
|
||||
* @param array $aArgs
|
||||
* @param array $aExtraParams
|
||||
* @param array $aExtraParams Extra parameters depending on the context, below is a WIP attempt at documenting them:
|
||||
* [
|
||||
* ...
|
||||
* 'keep_source_object' => true|false, // Whether the $oSourceObject should be kept or cloned. Default is true.
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \CoreException
|
||||
@@ -2765,17 +2770,16 @@ EOF
|
||||
* @throws \MySQLException
|
||||
* @throws \MySQLHasGoneAwayException
|
||||
*/
|
||||
public static function DisplayCreationForm(WebPage $oPage, $sClass, $oObjectToClone = null, $aArgs = array(), $aExtraParams = array())
|
||||
public static function DisplayCreationForm(WebPage $oPage, $sClass, $oSourceObject = null, $aArgs = array(), $aExtraParams = array())
|
||||
{
|
||||
$sClass = ($oObjectToClone == null) ? $sClass : get_class($oObjectToClone);
|
||||
$sClass = ($oSourceObject == null) ? $sClass : get_class($oSourceObject);
|
||||
|
||||
if ($oObjectToClone == null)
|
||||
{
|
||||
if ($oSourceObject == null) {
|
||||
$oObj = DBObject::MakeDefaultInstance($sClass);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oObj = clone $oObjectToClone;
|
||||
} elseif (isset($aExtraParams['keep_source_object']) && (true === isset($aExtraParams['keep_source_object']))) {
|
||||
$oObj = $oSourceObject;
|
||||
} else {
|
||||
$oObj = clone $oSourceObject;
|
||||
}
|
||||
|
||||
// Pre-fill the object with default values, when there is only on possible choice
|
||||
|
||||
@@ -801,13 +801,14 @@ EOF
|
||||
$oAppContext->InitObjectFromContext($oObjToClone);
|
||||
// 2nd - set values from the page argument 'default'
|
||||
$oObjToClone->UpdateObjectFromArg('default');
|
||||
$aPrefillFormParam = array( 'user' => $_SESSION["auth_user"],
|
||||
$aPrefillFormParam = array(
|
||||
'user' => $_SESSION["auth_user"],
|
||||
'context' => $oAppContext->GetAsHash(),
|
||||
'default' => utils::ReadParam('default', array(), '', 'raw_data'),
|
||||
'origin' => 'console'
|
||||
'origin' => 'console',
|
||||
);
|
||||
// 3rd - prefill API
|
||||
$oObjToClone->PrefillForm('creation_from_0',$aPrefillFormParam);
|
||||
$oObjToClone->PrefillForm('creation_from_0', $aPrefillFormParam);
|
||||
|
||||
// Display the creation form
|
||||
$sClassLabel = MetaModel::GetName($sRealClass);
|
||||
@@ -817,7 +818,7 @@ EOF
|
||||
// Note: some code has been duplicated to the case 'apply_new' when a data integrity issue has been found
|
||||
$oP->set_title(Dict::Format('UI:CreationPageTitle_Class', $sClassLabel));
|
||||
$oP->SetContentLayout(PageContentFactory::MakeForObjectDetails($oObjToClone, cmdbAbstractObject::ENUM_OBJECT_MODE_CREATE));
|
||||
cmdbAbstractObject::DisplayCreationForm($oP, $sRealClass, $oObjToClone, array(), array('wizard_container' => 1)); // wizard_container: Display the title above the form
|
||||
cmdbAbstractObject::DisplayCreationForm($oP, $sRealClass, $oObjToClone, array(), array('wizard_container' => 1, 'keep_source_object' => true)); // wizard_container: Display the title above the form
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user