Restore prototypes of cmdbAbstractObject methods in which we added $sMode to preserve compatibility with existing extensions (#240)

* Restore prototypes of cmdbAbstractObject methods in which we added $sMode to preserve compatibility with existing extensions

* Rename cmdbAbstractObject::ENUM_OBJECT_MODE_XXX

* Add cmdbAbstractObject::ENUM_OBJECT_MODE_BULK_EDIT

* Refactor usage of $sDisplayMode in cmdbAbstractObject::DisplayModifyForm()
This commit is contained in:
Molkobain
2021-11-16 17:47:09 +01:00
committed by GitHub
parent 1b2d75efd6
commit 2a913cd484
10 changed files with 147 additions and 77 deletions

View File

@@ -54,7 +54,7 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
protected $sObjectName;
/**
* @var string The mode in which the object should be displayed (read, edit, create, ...)
* @see \cmdbAbstractObject::ENUM_OBJECT_MODE_XXX
* @see \cmdbAbstractObject::ENUM_DISPLAY_MODE_XXX
*/
protected $sObjectMode;
/** @var string */
@@ -70,14 +70,14 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
* ObjectDetails constructor.
*
* @param \DBObject $oObject The object for which we display the details
* @param string $sMode See \cmdbAbstractObject::ENUM_OBJECT_MODE_XXX
* @param string $sMode See \cmdbAbstractObject::ENUM_DISPLAY_MODE_XXX
* @param string|null $sId ID of the block itself, not the $oObject ID
*
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
public function __construct(DBObject $oObject, string $sMode = cmdbAbstractObject::DEFAULT_OBJECT_MODE, ?string $sId = null)
public function __construct(DBObject $oObject, string $sMode = cmdbAbstractObject::DEFAULT_DISPLAY_MODE, ?string $sId = null)
{
$this->sClassName = get_class($oObject);
$this->sClassLabel = MetaModel::GetName($this->GetClassName());
@@ -252,7 +252,7 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
*/
protected function ComputeObjectName(DBObject $oObject): void
{
if ($this->sObjectMode === cmdbAbstractObject::ENUM_OBJECT_MODE_CREATE) {
if ($this->sObjectMode === cmdbAbstractObject::ENUM_DISPLAY_MODE_CREATE) {
$this->sObjectName = Dict::Format('UI:CreationTitle_Class', $this->sClassLabel);
} else {
$this->sObjectName = $oObject->GetRawName();