mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
N°9603 - Fix transitions applied when editing only caselog are not working (#908)
* N°9603 - Fix transitions applied when editing only caselog are not working * Remove unused variable
This commit is contained in:
@@ -13,7 +13,6 @@ use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu;
|
||||
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem\PopoverMenuItemFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\CaseLogEntryForm\CaseLogEntryForm;
|
||||
use DBObject;
|
||||
use DBObjectSet;
|
||||
use Dict;
|
||||
@@ -39,7 +38,7 @@ class CaseLogEntryFormFactory
|
||||
->AddMainActionButtons(static::PrepareCancelButton());
|
||||
|
||||
$oSaveButton = static::PrepareSaveButton();
|
||||
$oTransitionsMenu = static::PrepareTransitionsSelectionPopoverMenu($oObject, $sCaseLogAttCode);
|
||||
$oTransitionsMenu = static::PrepareTransitionsSelectionPopoverMenu($oObject, $sCaseLogAttCode, $oCaseLogEntryForm->GetId());
|
||||
// Prevent popover menu from landing behind caselog editor
|
||||
$oTransitionsMenu->SetContainer(PopoverMenu::ENUM_CONTAINER_BODY);
|
||||
if (true === $oTransitionsMenu->HasItems()) {
|
||||
@@ -71,7 +70,16 @@ class CaseLogEntryFormFactory
|
||||
return $oButton;
|
||||
}
|
||||
|
||||
protected static function PrepareTransitionsSelectionPopoverMenu(DBObject $oObject, string $sCaseLogAttCode): PopoverMenu
|
||||
/**
|
||||
* @param DBObject $oObject
|
||||
* @param string $sCaseLogAttCode
|
||||
* @param string $sCaseLogEntryFormId
|
||||
* @since 3.2.3 Add mandatory $sCaseLogEntryFormId parameter
|
||||
* @return PopoverMenu
|
||||
* @throws \ArchivedObjectException
|
||||
* @throws \CoreException
|
||||
*/
|
||||
protected static function PrepareTransitionsSelectionPopoverMenu(DBObject $oObject, string $sCaseLogAttCode, string $sCaseLogEntryFormId): PopoverMenu
|
||||
{
|
||||
$sObjClass = get_class($oObject);
|
||||
|
||||
@@ -79,8 +87,6 @@ class CaseLogEntryFormFactory
|
||||
$sSectionId = 'send-actions';
|
||||
$oMenu->AddSection($sSectionId);
|
||||
|
||||
$sCaseLogEntryFormDataRole = CaseLogEntryForm::BLOCK_CODE;
|
||||
|
||||
// Note: This code is inspired from cmdbAbstract::DisplayModifyForm(), it might be better to factorize it
|
||||
$aTransitions = $oObject->EnumTransitions();
|
||||
if (!isset($aExtraParams['custom_operation']) && count($aTransitions)) {
|
||||
@@ -99,7 +105,7 @@ class CaseLogEntryFormFactory
|
||||
CaseLogEntryForm::BLOCK_CODE.'--add-action--'.$sCaseLogAttCode.'--stimulus--'.$sStimulusCode,
|
||||
Dict::Format('UI:Button:SendAnd', $aStimuli[$sStimulusCode]->GetLabel()),
|
||||
<<<JS
|
||||
$(this).closest('[data-role="{$sCaseLogEntryFormDataRole}"]').trigger('save_entry.caselog_entry_form.itop', {stimulus_code: '{$sStimulusCode}'});
|
||||
$('#$sCaseLogEntryFormId').trigger('save_entry.caselog_entry_form.itop', {stimulus_code: '{$sStimulusCode}'});
|
||||
JS
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user