DBObject
1
core/cmdb,view_in_gui
false
autoincrement
priv_lnk_action_notif_to_contact
id
false
true
action_id
ActionNotification
false
DEL_AUTO
contact_id
Contact
false
DEL_AUTO
trigger_id
Trigger
false
DEL_AUTO
subscribed
true
false
-
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
-
10
-
20
-
30
-
40
ActionNotification
cmdbAbstractObject
grant_by_profile,core/cmdb,application
false
autoincrement
priv_action_newsroom
id
title
false
message
false
icon
true
96
96
256
256
priority
1
2
3
4
4
false
test_recipient_id
true
Person
DEL_MANUAL
recipients
false
url
$this->url()$
false
-
-
-
10
-
20
-
30
-
40
-
50
-
60
-
-
10
-
20
-
-
-
10
-
20
-
30
-
40
-
50
-
10
-
20
-
30
-
40
/**
*
* Create EventNotificationNewsroom for each recipient
* @param $oTrigger
* @param $aContextArgs
*
* @return void
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \CoreWarning
* @throws \MySQLException
* @throws \OQLException
*/
false
public
Get('recipients'));
$oPotentialRecipientsSearch->AllowAllData();
$oPotentialRecipientsSet = new DBObjectSet($oPotentialRecipientsSearch, array(), $aContextArgs);
$bIsAsync = $this->IsAsynchronous();
[$sPreviousLanguage, $aPreviousPluginProperties] = $this->SetNotificationLanguage();
$sMessage = MetaModel::ApplyParams($this->Get('message'), $aContextArgs);
$sTitle = MetaModel::ApplyParams($this->Get('title'), $aContextArgs);
$sUrl = MetaModel::ApplyParams($this->Get('url'), $aContextArgs);
$iObjectId = 0;
$sObjectClass = null;
if (array_key_exists('this->object()', $aContextArgs)) {
$iObjectId = $aContextArgs['this->object()']->GetKey();
$sObjectClass = get_class($aContextArgs['this->object()']);
}
if ($this->IsBeingTested()) {
// If action is being tested, send notification to the test recipient only, no matter what (unsubscribed, disabled, no access to the backoffice, ...)
$iTestRecipientId = $this->Get('test_recipient_id');
if ($iTestRecipientId > 0) {
$aRecipientsIds[] = $iTestRecipientId;
}
} else {
// Otherwise, find the recipients to which we can actually send the notification among all the potential ones
while ($oPotentialRecipient = $oPotentialRecipientsSet->Fetch()) {
// Skip recipients that have no users
if ($oPotentialRecipient instanceof Person && UserRights::GetUserFromPerson($oPotentialRecipient, false) === null) {
continue;
}
// Skip potential recipient that have no user with access to the backoffice
$oPotentialRecipientUsersSearch = DBObjectSearch::FromOQL("SELECT User WHERE contactid = " . $oPotentialRecipient->GetKey() . " AND status = 'enabled'");
$oPotentialRecipientUsersSearch->AllowAllData();
$oPotentialRecipientUsersSet = new DBObjectSet($oPotentialRecipientUsersSearch);
$oPortalDispatcher = new PortalDispatcher('backoffice');
// - Check if the user has access to the backoffice
$bHasAccessToBackoffice = false;
while ($oPotentialRecipientUser = $oPotentialRecipientUsersSet->Fetch()) {
// Skip potential recipients with user that don't have access to the backoffice
if (false === $oPortalDispatcher->IsUserAllowed($oPotentialRecipientUser)) {
continue;
}
$bHasAccessToBackoffice = true;
break;
}
// - Skip it if necessary
if (false === $bHasAccessToBackoffice) {
continue;
}
// Skip potential recipients that have unsubscribed
if (!\Combodo\iTop\Service\Notification\NotificationsService::GetInstance()->IsSubscribed($oTrigger, $this, $oPotentialRecipient)) {
continue;
}
$aRecipientsIds[] = $oPotentialRecipient->GetKey();
// Register subscription even though the notification is not sent yet
\Combodo\iTop\Service\Notification\NotificationsService::GetInstance()->RegisterSubscription($oTrigger, $this, $oPotentialRecipient);
}
}
try {
if ($bIsAsync === true) {
AsyncSendNewsroom::AddToQueue($this->GetKey(), $oTrigger->GetKey(), $aRecipientsIds, $sMessage, $sTitle, $sUrl, $iObjectId, $sObjectClass);
} else {
foreach ($aRecipientsIds as $iRecipientId) {
$oEvent = Combodo\iTop\Service\Notification\Event\EventNotificationNewsroomService::MakeEventFromAction($this, $iRecipientId, $oTrigger->GetKey(), $sMessage, $sTitle, $sUrl, $iObjectId, $sObjectClass);
$oEvent->DBInsertNoReload();
}
}
} catch (CoreCannotSaveObjectException $e) {
ExceptionLog::LogException($e);
foreach($aRecipientsIds as $iRecipientId) {
$oEvent = Combodo\iTop\Service\Notification\Event\EventNotificationNewsroomService::MakeEventFromAction($this,
$iRecipientId,
$oTrigger->GetKey(),
Dict::S('Core:EventNotificationNewsroom:ErrorOnDBInsert'),
Dict::S('Core:EventNotificationNewsroom:ErrorNotificationNotSent'),
$sUrl,
$iObjectId,
$sObjectClass
);
$oEvent->DBInsertNoReload();
}
}
$this->SetNotificationLanguage($sPreviousLanguage, $aPreviousPluginProperties['language_code'] ?? null);
}
]]>
true
public
Get('notifications.itop.send_asynchronously');
}
]]>
EventNotification
cmdbAbstractObject
core/cmdb,view_in_gui
false
autoincrement
priv_event_newsroom
id
title
false
icon
true
priority
1
2
3
4
4
false
url
false
_blank
read
yes
no
no
false
read_date
true
contact_id
Contact
false
-
10
-
20
-
30
-
40
-
50
-
60
-
70
-
80
-
10
-
20
-
10
-
20
-
30
-
40
-
50
-
10
-
20
-
30
-
40
REST Services User
Only users having this profile are allowed to use the REST Web Services (unless 'secure_rest_services' is set to false
in the configuration file).
cmdbAbstractObject
core,grant_by_profile
Person
cmdbAbstractObject
addon/userrights,grant_by_profile
cmdbAbstractObject
addon/userrights,grant_by_profile
1
User
URP_Profiles
cmdbAbstractObject
addon/userrights,grant_by_profile
User
Organization
cmdbAbstractObject
grant_by_profile,core/cmdb
cmdbAbstractObject
grant_by_profile,core/cmdb
cmdbAbstractObject
core/cmdb,view_in_gui,grant_by_profile
User
Contact
cmdbAbstractObject
core/cmdb,view_in_gui,grant_by_profile
SynchroDataSource
cmdbAbstractObject
application, grant_by_profile
AuditCategory
cmdbAbstractObject
application, grant_by_profile
cmdbAbstractObject
application, grant_by_profile
cmdbAbstractObject
core/cmdb,view_in_gui,application,grant_by_profile
cmdbAbstractObject
grant_by_profile,core/cmdb,application
Action
Trigger
cmdbAbstractObject
bizmodel
Action
grant_by_profile,core/cmdb
DBObject
core/cmdb,view_in_gui
Event
core/cmdb,view_in_gui
Trigger
Action
sql
true
string
linked_class
true
string
ext_key_to_me
true
string
ext_key_to_remote
true
string
sql
true
string
class_attcode
true
string
extkey_attcode
true
string
target_attcode
true
string
item_code
true
string
relation_code
true
string
from_class
true
string
neighbour_id
true
string
enabled_mode
true
string
min_up_mode
true
string
min_up_type
true
string
handler_class
true
string
class_field
true
string
query_field
true
string
display_style
false
string
target
false
string
default_value
false
string
attribute_definition_list
false
string
attribute_definition_exclusion_list
false
string
class_exclusion_list
false
string
min_up
true
number
count_min
false
number
0
count_max
false
number
0
max_combo_length
false
number
min_autocomplete_chars
false
number
display_max_width
false
number
128
display_max_height
false
number
128
storage_max_width
false
number
256
storage_max_height
false
number
256
max_items
false
number
12
tag_code_max_len
false
number
20
enabled
true
boolean
duplicates
false
boolean
false
is_null_allowed
false
boolean
false
allow_target_creation
false
boolean
is_user_editable
false
boolean
true
with_php_constraint
false
boolean
false
with_php_computation
false
boolean
false
create_temporary_object
false
boolean
false
on_target_delete
false
php
targetclass
true
string
goal_computing
false
string
'DefaultMetricComputer'
working_time_computing
false
string