mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Merge remote-tracking branch 'origin/support/3.2' into develop
This commit is contained in:
@@ -5923,14 +5923,14 @@ JS
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
final protected function FireEventCheckToWrite(): void
|
||||
final protected function FireEventCheckToWrite(?string $sStimulusBeingApplied): void
|
||||
{
|
||||
$this->FireEvent(EVENT_DB_CHECK_TO_WRITE, ['is_new' => $this->IsNew()]);
|
||||
$this->FireEvent(EVENT_DB_CHECK_TO_WRITE, ['is_new' => $this->IsNew(), 'stimulus_applied' => $sStimulusBeingApplied]);
|
||||
}
|
||||
|
||||
final protected function FireEventBeforeWrite()
|
||||
final protected function FireEventBeforeWrite(?string $sStimulusBeingApplied)
|
||||
{
|
||||
$this->FireEvent(EVENT_DB_BEFORE_WRITE, ['is_new' => $this->IsNew()]);
|
||||
$this->FireEvent(EVENT_DB_BEFORE_WRITE, ['is_new' => $this->IsNew(), 'stimulus_applied' => $sStimulusBeingApplied]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5942,11 +5942,11 @@ JS
|
||||
* @throws \CoreException
|
||||
* @since 3.1.0
|
||||
*/
|
||||
final protected function FireEventAfterWrite(array $aChanges, bool $bIsNew): void
|
||||
final protected function FireEventAfterWrite(array $aChanges, bool $bIsNew, ?string $sStimulusBeingApplied): void
|
||||
{
|
||||
$this->NotifyAttachedObjectsOnLinkClassModification();
|
||||
$this->RemoveObjectAwaitingEventDbLinksChanged(get_class($this), $this->GetKey());
|
||||
$this->FireEvent(EVENT_DB_AFTER_WRITE, ['is_new' => $bIsNew, 'changes' => $aChanges]);
|
||||
$this->FireEvent(EVENT_DB_AFTER_WRITE, ['is_new' => $bIsNew, 'changes' => $aChanges, 'stimulus_applied' => $sStimulusBeingApplied]);
|
||||
}
|
||||
|
||||
//////////////
|
||||
@@ -6179,9 +6179,9 @@ JS
|
||||
* @inheritDoc
|
||||
* @throws \CoreException
|
||||
*/
|
||||
final protected function FireEventComputeValues(): void
|
||||
final protected function FireEventComputeValues(?string $sStimulusBeingApplied): void
|
||||
{
|
||||
$this->FireEvent(EVENT_DB_COMPUTE_VALUES);
|
||||
$this->FireEvent(EVENT_DB_COMPUTE_VALUES, ['is_new' => $this->IsNew(), 'stimulus_applied' => $sStimulusBeingApplied]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -238,6 +238,10 @@ The object can be modified.]]></description>
|
||||
<description>Creation flag</description>
|
||||
<type>boolean</type>
|
||||
</event_datum>
|
||||
<event_datum id="stimulus_applied">
|
||||
<description>Life cycle stimulus applied (null if not within a transition)</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
@@ -263,6 +267,10 @@ Call $this->AddCheckWarning($sWarningMessage) to display a warning.
|
||||
<description>Creation flag</description>
|
||||
<type>boolean</type>
|
||||
</event_datum>
|
||||
<event_datum id="stimulus_applied">
|
||||
<description>Life cycle stimulus applied (null if not within a transition)</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
@@ -290,6 +298,10 @@ The modifications can be propagated to other objects.]]></description>
|
||||
<description><![CDATA[For updates, the list of changes done during this operation]]></description>
|
||||
<type>array</type>
|
||||
</event_datum>
|
||||
<event_datum id="stimulus_applied">
|
||||
<description>Life cycle stimulus applied (null if not within a transition)</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
@@ -420,6 +432,14 @@ The only action allowed is to deny transitions with $this->DenyTransition($sTran
|
||||
<description>The object inserted</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="is_new">
|
||||
<description>Creation flag</description>
|
||||
<type>boolean</type>
|
||||
</event_datum>
|
||||
<event_datum id="stimulus_applied">
|
||||
<description>Life cycle stimulus applied (null if not within a transition)</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
|
||||
@@ -212,7 +212,7 @@ abstract class DBObject implements iDisplay
|
||||
private $aEventListeners = [];
|
||||
private array $aAllowedTransitions = [];
|
||||
|
||||
private bool $bStimulusBeingApplied = false;
|
||||
private ?string $sStimulusBeingApplied = null;
|
||||
|
||||
/**
|
||||
* DBObject constructor.
|
||||
@@ -1208,7 +1208,7 @@ abstract class DBObject implements iDisplay
|
||||
if ($aCallInfo["function"] != "ComputeValues") continue;
|
||||
return; //skip!
|
||||
}
|
||||
$this->FireEventComputeValues();
|
||||
$this->FireEventComputeValues($this->sStimulusBeingApplied);
|
||||
$oKPI = new ExecutionKPI();
|
||||
$this->ComputeValues();
|
||||
$oKPI->ComputeStatsForExtension($this, 'ComputeValues');
|
||||
@@ -2671,7 +2671,7 @@ abstract class DBObject implements iDisplay
|
||||
|
||||
// Ultimate check - ensure DB integrity
|
||||
$this->SetReadOnly('No modification allowed during CheckToCreate');
|
||||
$this->FireEventCheckToWrite();
|
||||
$this->FireEventCheckToWrite($this->sStimulusBeingApplied);
|
||||
$this->SetReadWrite();
|
||||
|
||||
$oKPI = new ExecutionKPI();
|
||||
@@ -3400,7 +3400,7 @@ abstract class DBObject implements iDisplay
|
||||
$this->OnInsert();
|
||||
$oKPI->ComputeStatsForExtension($this, 'OnInsert');
|
||||
|
||||
$this->FireEventBeforeWrite();
|
||||
$this->FireEventBeforeWrite(null);
|
||||
|
||||
// If not automatically computed, then check that the key is given by the caller
|
||||
if (!MetaModel::IsAutoIncrementKey($sRootClass)) {
|
||||
@@ -3535,7 +3535,7 @@ abstract class DBObject implements iDisplay
|
||||
*/
|
||||
protected function PostInsertActions(): void
|
||||
{
|
||||
$this->FireEventAfterWrite([], true);
|
||||
$this->FireEventAfterWrite([], true, null);
|
||||
$oKPI = new ExecutionKPI();
|
||||
$this->AfterInsert();
|
||||
$oKPI->ComputeStatsForExtension($this, 'AfterInsert');
|
||||
@@ -3643,7 +3643,7 @@ abstract class DBObject implements iDisplay
|
||||
$this->OnUpdate();
|
||||
$oKPI->ComputeStatsForExtension($this, 'OnUpdate');
|
||||
|
||||
$this->FireEventBeforeWrite();
|
||||
$this->FireEventBeforeWrite($this->sStimulusBeingApplied);
|
||||
|
||||
// Freeze the changes at this point
|
||||
$this->InitPreviousValuesForUpdatedAttributes();
|
||||
@@ -3854,7 +3854,7 @@ abstract class DBObject implements iDisplay
|
||||
*/
|
||||
protected function PostUpdateActions(array $aChanges): void
|
||||
{
|
||||
$this->FireEventAfterWrite($aChanges, false);
|
||||
$this->FireEventAfterWrite($aChanges, false, $this->sStimulusBeingApplied);
|
||||
$oKPI = new ExecutionKPI();
|
||||
$this->AfterUpdate();
|
||||
$oKPI->ComputeStatsForExtension($this, 'AfterUpdate');
|
||||
@@ -3866,9 +3866,9 @@ abstract class DBObject implements iDisplay
|
||||
$this->ActivateOnObjectUpdateTriggersForTargetObjects();
|
||||
|
||||
$sClass = get_class($this);
|
||||
if ($this->bStimulusBeingApplied)
|
||||
if (utils::IsNotNullOrEmptyString($this->sStimulusBeingApplied))
|
||||
{
|
||||
$this->bStimulusBeingApplied = false;
|
||||
$this->sStimulusBeingApplied = null;
|
||||
$sStateAttCode = MetaModel::GetStateAttributeCode($sClass);
|
||||
$sPreviousState = $this->m_aPreviousValuesForUpdatedAttributes[$sStateAttCode];
|
||||
// Change state triggers...
|
||||
@@ -4604,7 +4604,7 @@ abstract class DBObject implements iDisplay
|
||||
}
|
||||
if ($bSuccess)
|
||||
{
|
||||
$this->bStimulusBeingApplied = true;
|
||||
$this->sStimulusBeingApplied = $sStimulusCode;
|
||||
// Stop watches
|
||||
foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
|
||||
{
|
||||
@@ -6619,7 +6619,7 @@ abstract class DBObject implements iDisplay
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventCheckToWrite(): void
|
||||
protected function FireEventCheckToWrite(?string $sStimulusBeingApplied): void
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6627,7 +6627,7 @@ abstract class DBObject implements iDisplay
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventBeforeWrite()
|
||||
protected function FireEventBeforeWrite(?string $sStimulusBeingApplied)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6637,7 +6637,7 @@ abstract class DBObject implements iDisplay
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventAfterWrite(array $aChanges, bool $bIsNew): void
|
||||
protected function FireEventAfterWrite(array $aChanges, bool $bIsNew, ?string $sStimulusBeingApplied): void
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6675,7 +6675,7 @@ abstract class DBObject implements iDisplay
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventComputeValues(): void
|
||||
protected function FireEventComputeValues(?string $sStimulusBeingApplied): void
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ use UserRights;
|
||||
|
||||
class OQLParserTest extends ItopDataTestCase
|
||||
{
|
||||
const USE_TRANSACTION = false;
|
||||
const CREATE_TEST_ORG = true;
|
||||
|
||||
/**
|
||||
* @group iTopChangeMgt
|
||||
@@ -46,7 +44,8 @@ class OQLParserTest extends ItopDataTestCase
|
||||
|
||||
public function testUnknownClassOqlException()
|
||||
{
|
||||
$sLogin = $this->GivenUserRestrictedToAnOrganizationInDB($this->getTestOrgId(), self::$aURP_Profiles['Portal user']);
|
||||
$oOrgId = $this->GivenObjectInDB('Organization', ['name' => 'TestOrg']);
|
||||
$sLogin = $this->GivenUserRestrictedToAnOrganizationInDB($oOrgId, self::$aURP_Profiles['Portal user']);
|
||||
UserRights::Login($sLogin);
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user