Merge remote-tracking branch 'origin/support/3.0' into develop

This commit is contained in:
Eric Espie
2022-08-12 10:51:46 +02:00
3 changed files with 22 additions and 23 deletions

View File

@@ -237,7 +237,7 @@ class LoginWebPage extends NiceWebPage
}
// This token allows the user to change the password without knowing the previous one
$sToken = substr(md5(APPROOT.uniqid()), 0, 16);
$sToken = bin2hex(random_bytes(32));
$oUser->Set('reset_pwd_token', $sToken);
CMDBObject::SetTrackInfo('Reset password');
$oUser->AllowWrite(true);

View File

@@ -3202,15 +3202,15 @@ abstract class DBObject implements iDisplay
// - TriggerOnObjectMention
$this->ActivateOnMentionTriggers(false);
$bHasANewExternalKeyValue = false;
$bNeedReload = false;
$aHierarchicalKeys = array();
$aDBChanges = array();
foreach ($aChanges as $sAttCode => $valuecurr)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
if ($oAttDef->IsExternalKey())
if ($oAttDef->IsExternalKey() || $oAttDef->IsLinkSet())
{
$bHasANewExternalKeyValue = true;
$bNeedReload = true;
}
if ($oAttDef->IsBasedOnDBColumns())
{
@@ -3368,24 +3368,10 @@ abstract class DBObject implements iDisplay
$this->m_aModifiedAtt = array();
try {
// - TriggerOnObjectUpdate
$aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObjectUpdate AS t WHERE t.target_class IN (:class_list)"),
array(), $aParams);
while ($oTrigger = $oSet->Fetch()) {
/** @var \TriggerOnObjectUpdate $oTrigger */
try {
$oTrigger->DoActivate($this->ToArgs('this'));
}
catch (Exception $e) {
utils::EnrichRaisedException($oTrigger, $e);
}
}
$this->AfterUpdate();
// Reload to get the external attributes
if ($bHasANewExternalKeyValue) {
if ($bNeedReload) {
$this->Reload(true /* AllowAllData */);
} else {
// Reset original values although the object has not been reloaded
@@ -3398,6 +3384,20 @@ abstract class DBObject implements iDisplay
}
}
}
// - TriggerOnObjectUpdate
$aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnObjectUpdate AS t WHERE t.target_class IN (:class_list)'),
array(), $aParams);
while ($oTrigger = $oSet->Fetch()) {
/** @var \TriggerOnObjectUpdate $oTrigger */
try {
$oTrigger->DoActivate($this->ToArgs('this'));
}
catch (Exception $e) {
utils::EnrichRaisedException($oTrigger, $e);
}
}
}
catch (Exception $e)
{

View File

@@ -134,15 +134,14 @@
$sLabel = Dict::S('itop-oauth-client:UsedForSMTP');
$sTestLabel = Dict::S('itop-oauth-client:TestSMTP');
$sTestURL = utils::GetAbsoluteUrlAppRoot().'setup/email.test.php';
$sLabel = Dict::S('itop-oauth-client:UsedForSMTP')."&nbsp;<a href='$sTestURL' target='_blank'>$sTestLabel</a>";
$sLabel = Dict::S('itop-oauth-client:UsedForSMTP')." <a href='$sTestURL' target='_blank'>$sTestLabel</a>";
$sTitle = '';
$aTags['oauth-message'] = ['title' => $sTitle, 'css_classes' => 'ibo-object-details--tag--oauth-message', 'decoration_classes' => 'far fa-envelope', 'label' => $sLabel];
$aTags['oauth-message'] = ['title' => $sTitle, 'css_classes' => 'ibo-object-details--tag--oauth-message', 'decoration_classes' => 'fas fa-envelope', 'label' => $sLabel];
}
}
foreach ($aTags as $sIconId => $aIconData) {
$sTagTooltipContent = utils::EscapeHtml($aIconData['title']);
$aHeaderBlocks['subtitle'][static::HEADER_BLOCKS_SUBTITLE_TAG_PREFIX.$sIconId] = new Combodo\iTop\Application\UI\Base\Component\Html\Html(<<<HTML
<span id="{$sIconId}" class="ibo-object-details--tag {$aIconData['css_classes']}" data-tooltip-content="{$sTagTooltipContent}" data-tooltip-html-enabled="true"><span class="ibo-object-details--tag-icon"><span class="{$aIconData['decoration_classes']}"></span></span>{$aIconData['label']}</span>
<span id="{$sIconId}" class="ibo-object-details--tag {$aIconData['css_classes']}"><span class="ibo-object-details--tag-icon"><span class="{$aIconData['decoration_classes']}"></span></span>{$aIconData['label']}</span>
HTML
);
}