diff --git a/addons/userrights/userrightsprofile.class.inc.php b/addons/userrights/userrightsprofile.class.inc.php index 7a5b988f7..384284e02 100644 --- a/addons/userrights/userrightsprofile.class.inc.php +++ b/addons/userrights/userrightsprofile.class.inc.php @@ -169,11 +169,9 @@ class URP_Profiles extends UserRightsBaseClassGUI function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); - if (!$bEditMode) - { - $oPage->SetCurrentTab('UI:UserManagement:GrantMatrix'); - $this->DoShowGrantSumary($oPage); - } + + $oPage->SetCurrentTab('UI:UserManagement:GrantMatrix'); + $this->DoShowGrantSumary($oPage); } public static function GetReadOnlyAttributes() diff --git a/addons/userrights/userrightsprofile.db.class.inc.php b/addons/userrights/userrightsprofile.db.class.inc.php index 30652cd7d..39a6f6d56 100644 --- a/addons/userrights/userrightsprofile.db.class.inc.php +++ b/addons/userrights/userrightsprofile.db.class.inc.php @@ -311,11 +311,9 @@ class URP_Profiles extends UserRightsBaseClassGUI function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); - if (!$bEditMode) - { - $oPage->SetCurrentTab('UI:UserManagement:GrantMatrix'); - $this->DoShowGrantSumary($oPage); - } + + $oPage->SetCurrentTab('UI:UserManagement:GrantMatrix'); + $this->DoShowGrantSumary($oPage); } } diff --git a/addons/userrights/userrightsprojection.class.inc.php b/addons/userrights/userrightsprojection.class.inc.php index 36d3c2994..f5b00bb67 100644 --- a/addons/userrights/userrightsprojection.class.inc.php +++ b/addons/userrights/userrightsprojection.class.inc.php @@ -143,11 +143,9 @@ class URP_Profiles extends UserRightsBaseClass function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); - if (!$bEditMode) - { - $oPage->SetCurrentTab('UI:UserManagement:GrantMatrix'); - $this->DoShowGrantSumary($oPage); - } + + $oPage->SetCurrentTab('UI:UserManagement:GrantMatrix'); + $this->DoShowGrantSumary($oPage); } } diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index fe19125e9..0793d4ac0 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -738,45 +738,41 @@ EOF $oExtensionInstance->OnDisplayRelations($this, $oPage, $bEditMode); } - // Display Notifications after the other tabs since this tab disappears in edition - if (!$bEditMode) + // Look for any trigger that considers this object as "In Scope" + // If any trigger has been found then display a tab with notifications + // + $oTriggerSet = new CMDBObjectSet(new DBObjectSearch('Trigger')); + $aTriggers = array(); + while ($oTrigger = $oTriggerSet->Fetch()) { - // Look for any trigger that considers this object as "In Scope" - // If any trigger has been found then display a tab with notifications - // - $oTriggerSet = new CMDBObjectSet(new DBObjectSearch('Trigger')); - $aTriggers = array(); - while ($oTrigger = $oTriggerSet->Fetch()) + if ($oTrigger->IsInScope($this)) { - if ($oTrigger->IsInScope($this)) - { - $aTriggers[] = $oTrigger->GetKey(); - } + $aTriggers[] = $oTrigger->GetKey(); } - if (count($aTriggers) > 0) + } + if (count($aTriggers) > 0) + { + $iId = $this->GetKey(); + $aParams = array('triggers' => $aTriggers, 'id' => $iId); + $aNotifSearches = array(); + $iNotifsCount = 0; + $aNotificationClasses = MetaModel::EnumChildClasses('EventNotification', ENUM_CHILD_CLASSES_EXCLUDETOP); + foreach($aNotificationClasses as $sNotifClass) { - $iId = $this->GetKey(); - $aParams = array('triggers' => $aTriggers, 'id' => $iId); - $aNotifSearches = array(); - $iNotifsCount = 0; - $aNotificationClasses = MetaModel::EnumChildClasses('EventNotification', ENUM_CHILD_CLASSES_EXCLUDETOP); - foreach($aNotificationClasses as $sNotifClass) - { - $aNotifSearches[$sNotifClass] = DBObjectSearch::FromOQL("SELECT $sNotifClass AS Ev JOIN Trigger AS T ON Ev.trigger_id = T.id WHERE T.id IN (:triggers) AND Ev.object_id = :id"); - $aNotifSearches[$sNotifClass]->SetInternalParams($aParams); - $oNotifSet = new DBObjectSet($aNotifSearches[$sNotifClass], array()); - $iNotifsCount += $oNotifSet->Count(); - } - // Display notifications regarding the object: on block per subclass to have the interesting columns - $sCount = ($iNotifsCount > 0) ? ' ('.$iNotifsCount.')' : ''; - $oPage->SetCurrentTab('UI:NotificationsTab', Dict::S('UI:NotificationsTab').$sCount); + $aNotifSearches[$sNotifClass] = DBObjectSearch::FromOQL("SELECT $sNotifClass AS Ev JOIN Trigger AS T ON Ev.trigger_id = T.id WHERE T.id IN (:triggers) AND Ev.object_id = :id"); + $aNotifSearches[$sNotifClass]->SetInternalParams($aParams); + $oNotifSet = new DBObjectSet($aNotifSearches[$sNotifClass], array()); + $iNotifsCount += $oNotifSet->Count(); + } + // Display notifications regarding the object: on block per subclass to have the interesting columns + $sCount = ($iNotifsCount > 0) ? ' ('.$iNotifsCount.')' : ''; + $oPage->SetCurrentTab('UI:NotificationsTab', Dict::S('UI:NotificationsTab').$sCount); - foreach($aNotificationClasses as $sNotifClass) - { - $oPage->p(MetaModel::GetClassIcon($sNotifClass, true).' '.MetaModel::GetName($sNotifClass)); - $oBlock = new DisplayBlock($aNotifSearches[$sNotifClass], 'list', false); - $oBlock->Display($oPage, 'notifications_'.$sNotifClass, array('menu' => false)); - } + foreach($aNotificationClasses as $sNotifClass) + { + $oPage->p(MetaModel::GetClassIcon($sNotifClass, true).' '.MetaModel::GetName($sNotifClass)); + $oBlock = new DisplayBlock($aNotifSearches[$sNotifClass], 'list', false); + $oBlock->Display($oPage, 'notifications_'.$sNotifClass, array('menu' => false)); } } } diff --git a/core/userrights.class.inc.php b/core/userrights.class.inc.php index 96c6023bf..e5abcc130 100644 --- a/core/userrights.class.inc.php +++ b/core/userrights.class.inc.php @@ -512,25 +512,23 @@ abstract class User extends cmdbAbstractObject function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); - if (!$bEditMode) - { - $oPage->SetCurrentTab('UI:UserManagement:GrantMatrix'); - $this->DoShowGrantSumary($oPage, 'bizmodel,grant_by_profile'); - // debug - if (false) - { - $oPage->SetCurrentTab('More on user rigths (dev only)'); - $oPage->add("

User rights

\n"); - $this->DoShowGrantSumary($oPage, 'addon/userrights'); - $oPage->add("

Change log

\n"); - $this->DoShowGrantSumary($oPage, 'core/cmdb'); - $oPage->add("

Application

\n"); - $this->DoShowGrantSumary($oPage, 'application'); - $oPage->add("

GUI

\n"); - $this->DoShowGrantSumary($oPage, 'gui'); - - } + $oPage->SetCurrentTab('UI:UserManagement:GrantMatrix'); + $this->DoShowGrantSumary($oPage, 'bizmodel,grant_by_profile'); + + // debug + if (false) + { + $oPage->SetCurrentTab('More on user rigths (dev only)'); + $oPage->add("

User rights

\n"); + $this->DoShowGrantSumary($oPage, 'addon/userrights'); + $oPage->add("

Change log

\n"); + $this->DoShowGrantSumary($oPage, 'core/cmdb'); + $oPage->add("

Application

\n"); + $this->DoShowGrantSumary($oPage, 'application'); + $oPage->add("

GUI

\n"); + $this->DoShowGrantSumary($oPage, 'gui'); + } } diff --git a/datamodels/2.x/itop-config-mgmt/datamodel.itop-config-mgmt.xml b/datamodels/2.x/itop-config-mgmt/datamodel.itop-config-mgmt.xml index 9362fb03e..e601833c0 100755 --- a/datamodels/2.x/itop-config-mgmt/datamodel.itop-config-mgmt.xml +++ b/datamodels/2.x/itop-config-mgmt/datamodel.itop-config-mgmt.xml @@ -4808,8 +4808,6 @@ { parent::DisplayBareRelations($oPage, $bEditMode); - if (!$bEditMode) - { $oPage->SetCurrentTab('Class:Subnet/Tab:IPUsage'); $bit_ip = ip2long($this->Get('ip')); @@ -4852,7 +4850,6 @@ } $iAnIP++; } - } }]]> diff --git a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml index 96f726bbf..6b42eb376 100755 --- a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml +++ b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml @@ -1078,25 +1078,22 @@ { parent::DisplayBareRelations($oPage, $bEditMode); - if (!$bEditMode) + if (MetaModel::IsValidClass('KnownError')) { - if (MetaModel::IsValidClass('KnownError')) + //Search for known errors + $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); + $iTicketID = $this->GetKey();; + $oKnownErrorSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT KnownError AS ke JOIN lnkErrorToFunctionalCI AS l1 ON l1.error_id=ke.id JOIN FunctionalCI AS ci ON l1.functionalci_id=ci.id JOIN lnkFunctionalCIToTicket AS l2 ON l2.functionalci_id=ci.id WHERE l2.ticket_id=$iTicketID")); + $iNumberKE=$oKnownErrorSet->count(); + if ($iNumberKE > 0) { - //Search for known errors - $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); - $iTicketID = $this->GetKey();; - $oKnownErrorSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT KnownError AS ke JOIN lnkErrorToFunctionalCI AS l1 ON l1.error_id=ke.id JOIN FunctionalCI AS ci ON l1.functionalci_id=ci.id JOIN lnkFunctionalCIToTicket AS l2 ON l2.functionalci_id=ci.id WHERE l2.ticket_id=$iTicketID")); - $iNumberKE=$oKnownErrorSet->count(); - if ($iNumberKE > 0) - { - $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList', Dict::S('Class:UserRequest:KnownErrorList')." ($iNumberKE)"); - } - else - { - $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); - } - self::DisplaySet($oPage, $oKnownErrorSet, array ('menu' => false)); + $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList', Dict::S('Class:UserRequest:KnownErrorList')." ($iNumberKE)"); } + else + { + $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); + } + self::DisplaySet($oPage, $oKnownErrorSet, array ('menu' => false)); } }]]> diff --git a/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml b/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml index b11ce5256..79333aa66 100755 --- a/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml +++ b/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml @@ -1219,26 +1219,22 @@ { parent::DisplayBareRelations($oPage, $bEditMode); - if (!$bEditMode) + if (MetaModel::IsValidClass('KnownError')) { - - if (MetaModel::IsValidClass('KnownError')) - { - //Search for known errors - $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); - $iTicketID = $this->GetKey();; - $oKnownErrorSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT KnownError AS ke JOIN lnkErrorToFunctionalCI AS l1 ON l1.error_id=ke.id JOIN FunctionalCI AS ci ON l1.functionalci_id=ci.id JOIN lnkFunctionalCIToTicket AS l2 ON l2.functionalci_id=ci.id WHERE l2.ticket_id=$iTicketID")); - $iNumberKE=$oKnownErrorSet->count(); - if ($iNumberKE > 0) - { - $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList', Dict::S('Class:UserRequest:KnownErrorList')." ($iNumberKE)"); - } - else - { - $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); - } - self::DisplaySet($oPage, $oKnownErrorSet, array ('menu' => false)); + //Search for known errors + $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); + $iTicketID = $this->GetKey();; + $oKnownErrorSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT KnownError AS ke JOIN lnkErrorToFunctionalCI AS l1 ON l1.error_id=ke.id JOIN FunctionalCI AS ci ON l1.functionalci_id=ci.id JOIN lnkFunctionalCIToTicket AS l2 ON l2.functionalci_id=ci.id WHERE l2.ticket_id=$iTicketID")); + $iNumberKE=$oKnownErrorSet->count(); + if ($iNumberKE > 0) + { + $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList', Dict::S('Class:UserRequest:KnownErrorList')." ($iNumberKE)"); } + else + { + $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); + } + self::DisplaySet($oPage, $oKnownErrorSet, array ('menu' => false)); } }]]> diff --git a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml index 9e41292b0..7fbe02200 100755 --- a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml +++ b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml @@ -1237,26 +1237,23 @@ { parent::DisplayBareRelations($oPage, $bEditMode); - if (!$bEditMode) - { - if (MetaModel::IsValidClass('KnownError')) - { - //Search for known errors - $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); - $iTicketID = $this->GetKey();; - $oKnownErrorSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT KnownError AS ke JOIN lnkErrorToFunctionalCI AS l1 ON l1.error_id=ke.id JOIN FunctionalCI AS ci ON l1.functionalci_id=ci.id JOIN lnkFunctionalCIToTicket AS l2 ON l2.functionalci_id=ci.id WHERE l2.ticket_id=$iTicketID")); - $iNumberKE=$oKnownErrorSet->count(); - if ($iNumberKE > 0) - { - $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList', Dict::S('Class:UserRequest:KnownErrorList')." ($iNumberKE)"); - } - else - { - $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); - } - self::DisplaySet($oPage, $oKnownErrorSet, array ('menu' => false)); - } - } + if (MetaModel::IsValidClass('KnownError')) + { + //Search for known errors + $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); + $iTicketID = $this->GetKey();; + $oKnownErrorSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT KnownError AS ke JOIN lnkErrorToFunctionalCI AS l1 ON l1.error_id=ke.id JOIN FunctionalCI AS ci ON l1.functionalci_id=ci.id JOIN lnkFunctionalCIToTicket AS l2 ON l2.functionalci_id=ci.id WHERE l2.ticket_id=$iTicketID")); + $iNumberKE=$oKnownErrorSet->count(); + if ($iNumberKE > 0) + { + $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList', Dict::S('Class:UserRequest:KnownErrorList')." ($iNumberKE)"); + } + else + { + $oPage->SetCurrentTab('Class:UserRequest:KnownErrorList'); + } + self::DisplaySet($oPage, $oKnownErrorSet, array ('menu' => false)); + } }]]>