N°2841 - Error when trying to delete a user with a no admin

This commit is contained in:
acognet
2021-03-18 18:19:18 +01:00
parent 46680d3854
commit c214d09e84
11 changed files with 157 additions and 110 deletions

View File

@@ -1,5 +1,5 @@
<?php
/**
/*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -7,6 +7,7 @@
namespace Combodo\iTop\Application\UI\Base\Component\Title;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -14,7 +15,7 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
*
* @package Combodo\iTop\Application\UI\Base\Component\Title
*/
class Title extends UIBlock
class Title extends UIContentBlock
{
// Overloaded constants
/** @inheritDoc */
@@ -31,8 +32,6 @@ class Title extends UIBlock
/** @var string */
public const DEFAULT_ICON_COVER_METHOD = self::ENUM_ICON_COVER_METHOD_CONTAIN;
/** @var string */
protected $sTitle;
/** @var int */
protected $iLevel;
/** @var string */
@@ -44,22 +43,14 @@ class Title extends UIBlock
/**
* @inheritDoc
*/
public function __construct(string $sTitle = '', int $iLevel = 1, ?string $sId = null)
public function __construct(UIBlock $oTitle, int $iLevel = 1, ?string $sId = null)
{
parent::__construct($sId);
$this->sTitle = $sTitle;
$this->iLevel = $iLevel;
$this->sIconUrl = null;
$this->sIconCoverMethod = static::DEFAULT_ICON_COVER_METHOD;
$this->bIsMedallion = true;
}
/**
* @return string
*/
public function GetTitle(): string
{
return $this->sTitle;
$this->AddSubBlock($oTitle);
}
/**

View File

@@ -1,5 +1,5 @@
<?php
/**
/*
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -9,6 +9,8 @@ namespace Combodo\iTop\Application\UI\Base\Component\Title;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Text\Text;
use Combodo\iTop\Application\UI\Base\UIBlock;
class TitleUIBlockFactory extends AbstractUIBlockFactory
{
@@ -17,7 +19,7 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
public static function MakeForPage(string $sTitle, ?string $sId = null)
{
return new Title($sTitle, 1, $sId);
return new Title(new Text($sTitle), 1, $sId);
}
public static function MakeForPageWithIcon(
@@ -25,7 +27,7 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
?string $sId = null
)
{
$oTitle = new Title($sTitle, 1, $sId);
$oTitle = new Title(new Text($sTitle), 1, $sId);
$oTitle->SetIcon($sIconUrl, $sIconCoverMethod, $bIsMedallion);
return $oTitle;
@@ -33,6 +35,11 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
public static function MakeNeutral(string $sTitle, int $iLevel = 1, ?string $sId = null)
{
return new Title($sTitle, $iLevel, $sId);
return new Title(new Text($sTitle), $iLevel, $sId);
}
public static function MakeStandard(UIBlock $oTitle, int $iLevel = 1, ?string $sId = null)
{
return new Title($oTitle, $iLevel, $sId);
}
}