N°2039 - Rename iTopNewsroom into NewsroomNotification

This commit is contained in:
Molkobain
2024-05-02 09:30:47 +02:00
parent 0d1c3aa464
commit 635c1bda6e
11 changed files with 120 additions and 121 deletions

View File

@@ -15,7 +15,7 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
use Combodo\iTop\Service\Notification\Event\EventiTopNotificationService;
use Combodo\iTop\Service\Notification\Event\EventNotificationNewsroomService;
/**
@@ -535,7 +535,7 @@ class AsyncSendiTopNotifications extends AsyncTask {
foreach ($aRecipients as $iRecipientId)
{
$oEvent = EventiTopNotificationService::MakeEventFromAction($oAction, $iRecipientId, $iTriggerId, $sMessage, $sTitle, $sUrl, $iObjectId, $sObjectClass, $sDate);
$oEvent = EventNotificationNewsroomService::MakeEventFromAction($oAction, $iRecipientId, $iTriggerId, $sMessage, $sTitle, $sUrl, $iObjectId, $sObjectClass, $sDate);
$oEvent->DBInsertNoReload();
}

View File

@@ -244,7 +244,7 @@
<method id="DoExecute">
<comment> /**
*
* Create EventiTopNotification for each recipient
* Create EventNotificationNewsroom for each recipient
* @param $oTrigger
* @param $aContextArgs
*
@@ -317,7 +317,7 @@
if($bIsAsync === true) {
$aRecipients[] = $oRecipient->GetKey();
} else {
$oEvent = Combodo\iTop\Service\Notification\Event\EventiTopNotificationService::MakeEventFromAction($this, $oRecipient->GetKey(), $oTrigger->GetKey(), $sMessage, $sTitle, $sUrl, $iObjectId, $sObjectClass);
$oEvent = Combodo\iTop\Service\Notification\Event\EventNotificationNewsroomService::MakeEventFromAction($this, $oRecipient->GetKey(), $oTrigger->GetKey(), $sMessage, $sTitle, $sUrl, $iObjectId, $sObjectClass);
$oEvent->DBInsertNoReload();
}
@@ -343,7 +343,7 @@
</method>
</methods>
</class>
<class id="EventiTopNotification" _delta="define">
<class id="EventNotificationNewsroom" _delta="define">
<php_parent>
<name>EventNotification</name>
</php_parent>
@@ -352,7 +352,7 @@
<category>core/cmdb,view_in_gui</category>
<abstract>false</abstract>
<key_type>autoincrement</key_type>
<db_table>priv_event_itop_notif</db_table>
<db_table>priv_event_newsroom</db_table>
<db_key_field>id</db_key_field>
<db_final_class_field/>
<naming>

View File

@@ -480,38 +480,38 @@ Dict::Add('EN US', 'English', 'English', array(
));
//
// Class: EventiTopNotification
// Class: EventNotificationNewsroom
//
Dict::Add('EN US', 'English', 'English', array(
'Class:EventiTopNotification' => 'News sent',
'Class:EventiTopNotification+' => '',
'Class:EventiTopNotification/Attribute:title' => 'Title',
'Class:EventiTopNotification/Attribute:title+' => '',
'Class:EventiTopNotification/Attribute:icon' => 'Icon',
'Class:EventiTopNotification/Attribute:icon+' => '',
'Class:EventiTopNotification/Attribute:priority' => 'Priority',
'Class:EventiTopNotification/Attribute:priority+' => '',
'Class:EventiTopNotification/Attribute:priority/Value:1' => 'Critical',
'Class:EventiTopNotification/Attribute:priority/Value:1+' => 'Critical',
'Class:EventiTopNotification/Attribute:priority/Value:2' => 'Urgent',
'Class:EventiTopNotification/Attribute:priority/Value:2+' => 'Urgent',
'Class:EventiTopNotification/Attribute:priority/Value:3' => 'Important',
'Class:EventiTopNotification/Attribute:priority/Value:3+' => 'Important',
'Class:EventiTopNotification/Attribute:priority/Value:4' => 'Standard',
'Class:EventiTopNotification/Attribute:priority/Value:4+' => 'Standard',
'Class:EventiTopNotification/Attribute:url' => 'URL',
'Class:EventiTopNotification/Attribute:url+' => '',
'Class:EventiTopNotification/Attribute:read' => 'Read',
'Class:EventiTopNotification/Attribute:read+' => '',
'Class:EventiTopNotification/Attribute:read/Value:no' => 'No',
'Class:EventiTopNotification/Attribute:read/Value:no+' => 'No',
'Class:EventiTopNotification/Attribute:read/Value:yes' => 'Yes',
'Class:EventiTopNotification/Attribute:read/Value:yes+' => 'Yes',
'Class:EventiTopNotification/Attribute:read_date' => 'Read date',
'Class:EventiTopNotification/Attribute:read_date+' => '',
'Class:EventiTopNotification/Attribute:contact_id' => 'Contact',
'Class:EventiTopNotification/Attribute:contact_id+' => '',
'Class:EventNotificationNewsroom' => 'News sent',
'Class:EventNotificationNewsroom+' => '',
'Class:EventNotificationNewsroom/Attribute:title' => 'Title',
'Class:EventNotificationNewsroom/Attribute:title+' => '',
'Class:EventNotificationNewsroom/Attribute:icon' => 'Icon',
'Class:EventNotificationNewsroom/Attribute:icon+' => '',
'Class:EventNotificationNewsroom/Attribute:priority' => 'Priority',
'Class:EventNotificationNewsroom/Attribute:priority+' => '',
'Class:EventNotificationNewsroom/Attribute:priority/Value:1' => 'Critical',
'Class:EventNotificationNewsroom/Attribute:priority/Value:1+' => 'Critical',
'Class:EventNotificationNewsroom/Attribute:priority/Value:2' => 'Urgent',
'Class:EventNotificationNewsroom/Attribute:priority/Value:2+' => 'Urgent',
'Class:EventNotificationNewsroom/Attribute:priority/Value:3' => 'Important',
'Class:EventNotificationNewsroom/Attribute:priority/Value:3+' => 'Important',
'Class:EventNotificationNewsroom/Attribute:priority/Value:4' => 'Standard',
'Class:EventNotificationNewsroom/Attribute:priority/Value:4+' => 'Standard',
'Class:EventNotificationNewsroom/Attribute:url' => 'URL',
'Class:EventNotificationNewsroom/Attribute:url+' => '',
'Class:EventNotificationNewsroom/Attribute:read' => 'Read',
'Class:EventNotificationNewsroom/Attribute:read+' => '',
'Class:EventNotificationNewsroom/Attribute:read/Value:no' => 'No',
'Class:EventNotificationNewsroom/Attribute:read/Value:no+' => 'No',
'Class:EventNotificationNewsroom/Attribute:read/Value:yes' => 'Yes',
'Class:EventNotificationNewsroom/Attribute:read/Value:yes+' => 'Yes',
'Class:EventNotificationNewsroom/Attribute:read_date' => 'Read date',
'Class:EventNotificationNewsroom/Attribute:read_date+' => '',
'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact',
'Class:EventNotificationNewsroom/Attribute:contact_id+' => '',
));
//

View File

@@ -432,38 +432,38 @@ Dict::Add('FR FR', 'French', 'Français', array(
));
//
// Class: EventiTopNotification
// Class: EventNotificationNewsroom
//
Dict::Add('FR FR', 'French', 'Français', array(
'Class:EventiTopNotification' => 'News envoyée',
'Class:EventiTopNotification+' => '',
'Class:EventiTopNotification/Attribute:title' => 'Titre',
'Class:EventiTopNotification/Attribute:title+' => '',
'Class:EventiTopNotification/Attribute:icon' => 'Icône',
'Class:EventiTopNotification/Attribute:icon+' => '',
'Class:EventiTopNotification/Attribute:priority' => 'Priorité',
'Class:EventiTopNotification/Attribute:priority+' => '',
'Class:EventiTopNotification/Attribute:priority/Value:1' => 'Critique',
'Class:EventiTopNotification/Attribute:priority/Value:1+' => 'Critique',
'Class:EventiTopNotification/Attribute:priority/Value:2' => 'Urgent',
'Class:EventiTopNotification/Attribute:priority/Value:2+' => 'Urgent',
'Class:EventiTopNotification/Attribute:priority/Value:3' => 'Important',
'Class:EventiTopNotification/Attribute:priority/Value:3+' => 'Important',
'Class:EventiTopNotification/Attribute:priority/Value:4' => 'Standard',
'Class:EventiTopNotification/Attribute:priority/Value:4+' => 'Standard',
'Class:EventiTopNotification/Attribute:url' => 'URL',
'Class:EventiTopNotification/Attribute:url+' => '',
'Class:EventiTopNotification/Attribute:read' => 'Lu',
'Class:EventiTopNotification/Attribute:read+' => '',
'Class:EventiTopNotification/Attribute:read/Value:no' => 'Non',
'Class:EventiTopNotification/Attribute:read/Value:no+' => 'Non',
'Class:EventiTopNotification/Attribute:read/Value:yes' => 'Oui',
'Class:EventiTopNotification/Attribute:read/Value:yes+' => 'Oui',
'Class:EventiTopNotification/Attribute:read_date' => 'Date de lecture',
'Class:EventiTopNotification/Attribute:read_date+' => '',
'Class:EventiTopNotification/Attribute:contact_id' => 'Contact',
'Class:EventiTopNotification/Attribute:contact_id+' => '',
'Class:EventNotificationNewsroom' => 'News envoyée',
'Class:EventNotificationNewsroom+' => '',
'Class:EventNotificationNewsroom/Attribute:title' => 'Titre',
'Class:EventNotificationNewsroom/Attribute:title+' => '',
'Class:EventNotificationNewsroom/Attribute:icon' => 'Icône',
'Class:EventNotificationNewsroom/Attribute:icon+' => '',
'Class:EventNotificationNewsroom/Attribute:priority' => 'Priorité',
'Class:EventNotificationNewsroom/Attribute:priority+' => '',
'Class:EventNotificationNewsroom/Attribute:priority/Value:1' => 'Critique',
'Class:EventNotificationNewsroom/Attribute:priority/Value:1+' => 'Critique',
'Class:EventNotificationNewsroom/Attribute:priority/Value:2' => 'Urgent',
'Class:EventNotificationNewsroom/Attribute:priority/Value:2+' => 'Urgent',
'Class:EventNotificationNewsroom/Attribute:priority/Value:3' => 'Important',
'Class:EventNotificationNewsroom/Attribute:priority/Value:3+' => 'Important',
'Class:EventNotificationNewsroom/Attribute:priority/Value:4' => 'Standard',
'Class:EventNotificationNewsroom/Attribute:priority/Value:4+' => 'Standard',
'Class:EventNotificationNewsroom/Attribute:url' => 'URL',
'Class:EventNotificationNewsroom/Attribute:url+' => '',
'Class:EventNotificationNewsroom/Attribute:read' => 'Lu',
'Class:EventNotificationNewsroom/Attribute:read+' => '',
'Class:EventNotificationNewsroom/Attribute:read/Value:no' => 'Non',
'Class:EventNotificationNewsroom/Attribute:read/Value:no+' => 'Non',
'Class:EventNotificationNewsroom/Attribute:read/Value:yes' => 'Oui',
'Class:EventNotificationNewsroom/Attribute:read/Value:yes+' => 'Oui',
'Class:EventNotificationNewsroom/Attribute:read_date' => 'Date de lecture',
'Class:EventNotificationNewsroom/Attribute:read_date+' => '',
'Class:EventNotificationNewsroom/Attribute:contact_id' => 'Contact',
'Class:EventNotificationNewsroom/Attribute:contact_id+' => '',
));
//

View File

@@ -479,38 +479,38 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array(
));
//
// Class: EventiTopNotification
// Class: EventNotificationNewsroom
//
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
'Class:EventiTopNotification' => 'News sent~~',
'Class:EventiTopNotification+' => '',
'Class:EventiTopNotification/Attribute:title' => '标题',
'Class:EventiTopNotification/Attribute:title+' => '',
'Class:EventiTopNotification/Attribute:icon' => 'Icon',
'Class:EventiTopNotification/Attribute:icon+' => '',
'Class:EventiTopNotification/Attribute:priority' => '优先级',
'Class:EventiTopNotification/Attribute:priority+' => '优先级',
'Class:EventiTopNotification/Attribute:priority/Value:1' => '关键',
'Class:EventiTopNotification/Attribute:priority/Value:1+' => '关键',
'Class:EventiTopNotification/Attribute:priority/Value:2' => '紧急',
'Class:EventiTopNotification/Attribute:priority/Value:2+' => '紧急',
'Class:EventiTopNotification/Attribute:priority/Value:3' => '重要',
'Class:EventiTopNotification/Attribute:priority/Value:3+' => '重要',
'Class:EventiTopNotification/Attribute:priority/Value:4' => '标准',
'Class:EventiTopNotification/Attribute:priority/Value:4+' => '标准',
'Class:EventiTopNotification/Attribute:url' => 'URL',
'Class:EventiTopNotification/Attribute:url+' => '',
'Class:EventiTopNotification/Attribute:read' => '读取',
'Class:EventiTopNotification/Attribute:read+' => '',
'Class:EventiTopNotification/Attribute:read/Value:no' => '否',
'Class:EventiTopNotification/Attribute:read/Value:no+' => '否',
'Class:EventiTopNotification/Attribute:read/Value:yes' => '是',
'Class:EventiTopNotification/Attribute:read/Value:yes+' => '是',
'Class:EventiTopNotification/Attribute:read_date' => '读取日期',
'Class:EventiTopNotification/Attribute:read_date+' => '',
'Class:EventiTopNotification/Attribute:contact_id' => '联系人',
'Class:EventiTopNotification/Attribute:contact_id+' => '',
'Class:EventNotificationNewsroom' => 'News sent~~',
'Class:EventNotificationNewsroom+' => '',
'Class:EventNotificationNewsroom/Attribute:title' => '标题',
'Class:EventNotificationNewsroom/Attribute:title+' => '',
'Class:EventNotificationNewsroom/Attribute:icon' => 'Icon',
'Class:EventNotificationNewsroom/Attribute:icon+' => '',
'Class:EventNotificationNewsroom/Attribute:priority' => '优先级',
'Class:EventNotificationNewsroom/Attribute:priority+' => '优先级',
'Class:EventNotificationNewsroom/Attribute:priority/Value:1' => '关键',
'Class:EventNotificationNewsroom/Attribute:priority/Value:1+' => '关键',
'Class:EventNotificationNewsroom/Attribute:priority/Value:2' => '紧急',
'Class:EventNotificationNewsroom/Attribute:priority/Value:2+' => '紧急',
'Class:EventNotificationNewsroom/Attribute:priority/Value:3' => '重要',
'Class:EventNotificationNewsroom/Attribute:priority/Value:3+' => '重要',
'Class:EventNotificationNewsroom/Attribute:priority/Value:4' => '标准',
'Class:EventNotificationNewsroom/Attribute:priority/Value:4+' => '标准',
'Class:EventNotificationNewsroom/Attribute:url' => 'URL',
'Class:EventNotificationNewsroom/Attribute:url+' => '',
'Class:EventNotificationNewsroom/Attribute:read' => '读取',
'Class:EventNotificationNewsroom/Attribute:read+' => '',
'Class:EventNotificationNewsroom/Attribute:read/Value:no' => '否',
'Class:EventNotificationNewsroom/Attribute:read/Value:no+' => '否',
'Class:EventNotificationNewsroom/Attribute:read/Value:yes' => '是',
'Class:EventNotificationNewsroom/Attribute:read/Value:yes+' => '是',
'Class:EventNotificationNewsroom/Attribute:read_date' => '读取日期',
'Class:EventNotificationNewsroom/Attribute:read_date+' => '',
'Class:EventNotificationNewsroom/Attribute:contact_id' => '联系人',
'Class:EventNotificationNewsroom/Attribute:contact_id+' => '',
));
//

View File

@@ -400,7 +400,7 @@ return array(
'Combodo\\iTop\\Controller\\Base\\Layout\\ActivityPanelController' => $baseDir . '/sources/Controller/Base/Layout/ActivityPanelController.php',
'Combodo\\iTop\\Controller\\Base\\Layout\\ObjectController' => $baseDir . '/sources/Controller/Base/Layout/ObjectController.php',
'Combodo\\iTop\\Controller\\Links\\LinkSetController' => $baseDir . '/sources/Controller/Links/LinkSetController.php',
'Combodo\\iTop\\Controller\\Newsroom\\iTopNewsroomController' => $baseDir . '/sources/Controller/Newsroom/iTopNewsroomController.php',
'Combodo\\iTop\\Controller\\Newsroom\\NewsroomNotificationsController' => $baseDir . '/sources/Controller/Newsroom/iTopNewsroomController.php',
'Combodo\\iTop\\Controller\\Notifications\\ActionController' => $baseDir . '/sources/Controller/Notifications/ActionController.php',
'Combodo\\iTop\\Controller\\Notifications\\NotificationsCenterController' => $baseDir . '/sources/Controller/Notifications/NotificationsCenterController.php',
'Combodo\\iTop\\Controller\\OAuth\\OAuthLandingController' => $baseDir . '/sources/Controller/OAuth/OAuthLandingController.php',
@@ -506,8 +506,8 @@ return array(
'Combodo\\iTop\\Service\\Links\\LinkSetRepository' => $baseDir . '/sources/Service/Links/LinkSetRepository.php',
'Combodo\\iTop\\Service\\Links\\LinksBulkDataPostProcessor' => $baseDir . '/sources/Service/Links/LinksBulkDataPostProcessor.php',
'Combodo\\iTop\\Service\\Module\\ModuleService' => $baseDir . '/sources/Service/Module/ModuleService.php',
'Combodo\\iTop\\Service\\Notification\\Event\\EventiTopNotificationGC' => $baseDir . '/sources/Service/Notification/Event/EventiTopNotificationGC.php',
'Combodo\\iTop\\Service\\Notification\\Event\\EventiTopNotificationService' => $baseDir . '/sources/Service/Notification/Event/EventiTopNotificationService.php',
'Combodo\\iTop\\Service\\Notification\\Event\\EventNotificationNewsroomGC' => $baseDir . '/sources/Service/Notification/Event/EventNotificationNewsroomGC.php',
'Combodo\\iTop\\Service\\Notification\\Event\\EventNotificationNewsroomService' => $baseDir . '/sources/Service/Notification/Event/EventNotificationNewsroomService.php',
'Combodo\\iTop\\Service\\Notification\\NotificationsRepository' => $baseDir . '/sources/Service/Notification/NotificationsRepository.php',
'Combodo\\iTop\\Service\\Notification\\NotificationsService' => $baseDir . '/sources/Service/Notification/NotificationsService.php',
'Combodo\\iTop\\Service\\Router\\Exception\\RouteNotFoundException' => $baseDir . '/sources/Service/Router/Exception/RouteNotFoundException.php',

View File

@@ -783,7 +783,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Combodo\\iTop\\Controller\\Base\\Layout\\ActivityPanelController' => __DIR__ . '/../..' . '/sources/Controller/Base/Layout/ActivityPanelController.php',
'Combodo\\iTop\\Controller\\Base\\Layout\\ObjectController' => __DIR__ . '/../..' . '/sources/Controller/Base/Layout/ObjectController.php',
'Combodo\\iTop\\Controller\\Links\\LinkSetController' => __DIR__ . '/../..' . '/sources/Controller/Links/LinkSetController.php',
'Combodo\\iTop\\Controller\\Newsroom\\iTopNewsroomController' => __DIR__ . '/../..' . '/sources/Controller/Newsroom/iTopNewsroomController.php',
'Combodo\\iTop\\Controller\\Newsroom\\NewsroomNotificationsController' => __DIR__ . '/../..' . '/sources/Controller/Newsroom/iTopNewsroomController.php',
'Combodo\\iTop\\Controller\\Notifications\\ActionController' => __DIR__ . '/../..' . '/sources/Controller/Notifications/ActionController.php',
'Combodo\\iTop\\Controller\\Notifications\\NotificationsCenterController' => __DIR__ . '/../..' . '/sources/Controller/Notifications/NotificationsCenterController.php',
'Combodo\\iTop\\Controller\\OAuth\\OAuthLandingController' => __DIR__ . '/../..' . '/sources/Controller/OAuth/OAuthLandingController.php',
@@ -889,8 +889,8 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Combodo\\iTop\\Service\\Links\\LinkSetRepository' => __DIR__ . '/../..' . '/sources/Service/Links/LinkSetRepository.php',
'Combodo\\iTop\\Service\\Links\\LinksBulkDataPostProcessor' => __DIR__ . '/../..' . '/sources/Service/Links/LinksBulkDataPostProcessor.php',
'Combodo\\iTop\\Service\\Module\\ModuleService' => __DIR__ . '/../..' . '/sources/Service/Module/ModuleService.php',
'Combodo\\iTop\\Service\\Notification\\Event\\EventiTopNotificationGC' => __DIR__ . '/../..' . '/sources/Service/Notification/Event/EventiTopNotificationGC.php',
'Combodo\\iTop\\Service\\Notification\\Event\\EventiTopNotificationService' => __DIR__ . '/../..' . '/sources/Service/Notification/Event/EventiTopNotificationService.php',
'Combodo\\iTop\\Service\\Notification\\Event\\EventNotificationNewsroomGC' => __DIR__ . '/../..' . '/sources/Service/Notification/Event/EventNotificationNewsroomGC.php',
'Combodo\\iTop\\Service\\Notification\\Event\\EventNotificationNewsroomService' => __DIR__ . '/../..' . '/sources/Service/Notification/Event/EventNotificationNewsroomService.php',
'Combodo\\iTop\\Service\\Notification\\NotificationsRepository' => __DIR__ . '/../..' . '/sources/Service/Notification/NotificationsRepository.php',
'Combodo\\iTop\\Service\\Notification\\NotificationsService' => __DIR__ . '/../..' . '/sources/Service/Notification/NotificationsService.php',
'Combodo\\iTop\\Service\\Router\\Exception\\RouteNotFoundException' => __DIR__ . '/../..' . '/sources/Service/Router/Exception/RouteNotFoundException.php',

View File

@@ -358,7 +358,7 @@ JS
$oPage->AddUiBlock($oBulkActionsBlock);
// Search for all notifications for the current user
$oSearch = DBObjectSearch::FromOQL('SELECT EventiTopNotification');
$oSearch = DBObjectSearch::FromOQL('SELECT EventNotificationNewsroom');
$oSearch->AddCondition('contact_id', UserRights::GetContactId(), '=');
$oSet = new DBObjectSet($oSearch, array('read' => true, 'date' => false), array());
@@ -528,7 +528,7 @@ JS
$iContactId = UserRights::GetContactId();
if (utils::IsNotNullOrEmptyString($iContactId)) {
$oSearch = DBObjectSearch::FromOQL('SELECT EventiTopNotification WHERE contact_id = :contact_id AND read = "no"');
$oSearch = DBObjectSearch::FromOQL('SELECT EventNotificationNewsroom WHERE contact_id = :contact_id AND read = "no"');
$oSet = new DBObjectSet($oSearch, array(), array('contact_id' => $iContactId));
while ($oMessage = $oSet->Fetch()) {
@@ -542,7 +542,7 @@ $sMessage
HTML;
$sIcon = $oMessage->Get('icon') !== null ?
$oMessage->Get('icon')->GetDisplayURL('EventiTopNotification', $oMessage->GetKey(), 'icon') :
$oMessage->Get('icon')->GetDisplayURL('EventNotificationNewsroom', $oMessage->GetKey(), 'icon') :
Branding::GetCompactMainLogoAbsoluteUrl();
$aMessages[] = array(
'id' => $oMessage->GetKey(),
@@ -579,7 +579,7 @@ HTML;
if (utils::IsNotNullOrEmptyString($iContactId)) {
$oSearch = DBObjectSearch::FromOQL('SELECT EventiTopNotification WHERE contact_id = :contact_id AND read = "no"');
$oSearch = DBObjectSearch::FromOQL('SELECT EventNotificationNewsroom WHERE contact_id = :contact_id AND read = "no"');
$oSet = new DBObjectSet($oSearch, array(), array('contact_id' => $iContactId));
while ($oEvent = $oSet->Fetch()) {
@@ -609,7 +609,7 @@ HTML;
$sEventId = utils::ReadParam('event_id', 0);
if ($sEventId > 0) {
try {
$oEvent = MetaModel::GetObject('EventiTopNotification', $sEventId);
$oEvent = MetaModel::GetObject('EventNotificationNewsroom', $sEventId);
if ($oEvent !== null && $oEvent->Get('contact_id') === UserRights::GetContactId()) {
$oEvent->Set('read', 'yes');
$oEvent->SetCurrentDate('read_date');

View File

@@ -9,17 +9,16 @@ use ExceptionLog;
use iBackgroundProcess;
use MetaModel;
class EventiTopNotificationGC implements iBackgroundProcess
class EventNotificationNewsroomGC implements iBackgroundProcess
{
public function Process($iUnixTimeLimit)
{
try {
$iDeletionTime = (int) MetaModel::GetConfig()->Get('notifications.itop.read_notification_retention');
$oDBObjectSearch = DBObjectSearch::FromOQL("SELECT EventiTopNotification WHERE read='yes' AND read_date < DATE_SUB(NOW(), INTERVAL :deletion_time DAY)", ['deletion_time' => $iDeletionTime]);
$oEventiTopNotificationSet = new DBObjectSet($oDBObjectSearch);
while($oEventiTopNotification = $oEventiTopNotificationSet->Fetch()){
$oEventiTopNotification->DBDelete();
$oDBObjectSearch = DBObjectSearch::FromOQL("SELECT EventNotificationNewsroom WHERE read='yes' AND read_date < DATE_SUB(NOW(), INTERVAL :deletion_time DAY)", ['deletion_time' => $iDeletionTime]);
$oEventNotificationNewsroomSet = new DBObjectSet($oDBObjectSearch);
while($oEventNotificationNewsroom = $oEventNotificationNewsroomSet->Fetch()){
$oEventNotificationNewsroom->DBDelete();
}
}
catch (Exception $e) {

View File

@@ -2,22 +2,22 @@
namespace Combodo\iTop\Service\Notification\Event;
use Action;
use Combodo\iTop\Application\Branding;
use EventiTopNotification;
use EventNotificationNewsroom;
use MetaModel;
use utils;
/**
* Class EventiTopNotificationService
* Class EventNotificationNewsroomService
*
* Service to create EventiTopNotification objects from various sources.
* Service to create EventNotificationNewsroom objects from various sources.
*
* @package Combodo\iTop\Service\Notification\Event
* @since 3.2.0
* @api
*/
class EventiTopNotificationService {
class EventNotificationNewsroomService {
/**
* @param \Action $oAction
* @param int $iContactId
@@ -29,15 +29,15 @@ class EventiTopNotificationService {
* @param string|null $sObjectClass
* @param string|null $sDate
*
* @return \EventiTopNotification
* @return \EventNotificationNewsroom
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
*/
public static function MakeEventFromAction(Action $oAction, int $iContactId, int $iTriggerId, string $sMessage, string $sTitle, string $sUrl, int $iObjectId, ?string $sObjectClass, string|null $sDate = null): EventiTopNotification
public static function MakeEventFromAction(Action $oAction, int $iContactId, int $iTriggerId, string $sMessage, string $sTitle, string $sUrl, int $iObjectId, ?string $sObjectClass, string|null $sDate = null): EventNotificationNewsroom
{
$oEvent = new EventiTopNotification();
$oEvent = new EventNotificationNewsroom();
$oEvent->Set('title', $sTitle);
$oEvent->Set('message', $sMessage);
// Compute icon
@@ -47,11 +47,11 @@ class EventiTopNotificationService {
}
// - Then, check if the action is for a DM object and if its class has an icon
elseif ($iObjectId > 0 && utils::IsNotNullOrEmptyString(MetaModel::GetClassIcon($sObjectClass, false))) {
$oIcon = MetaModel::GetAttributeDef(EventiTopNotification::class, 'icon')->MakeRealValue(MetaModel::GetClassIcon($sObjectClass, false), $oEvent);
$oIcon = MetaModel::GetAttributeDef(EventNotificationNewsroom::class, 'icon')->MakeRealValue(MetaModel::GetClassIcon($sObjectClass, false), $oEvent);
}
// - Otherwise, fallback on the compact logo of the application
else {
$oIcon = MetaModel::GetAttributeDef(EventiTopNotification::class, 'icon')->MakeRealValue(Branding::GetCompactMainLogoAbsoluteUrl(), $oEvent);
$oIcon = MetaModel::GetAttributeDef(EventNotificationNewsroom::class, 'icon')->MakeRealValue(Branding::GetCompactMainLogoAbsoluteUrl(), $oEvent);
}
$oEvent->Set('icon', $oIcon);

View File

@@ -116,7 +116,7 @@ class NotificationsRepository
*/
protected function PrepareSearchForNotificationsByContact(int $iContactId, array $aNotificationIds = []): DBSearch
{
$oSearch = DBObjectSearch::FromOQL("SELECT EventiTopNotification WHERE contact_id = :contact_id");
$oSearch = DBObjectSearch::FromOQL("SELECT EventNotificationNewsroom WHERE contact_id = :contact_id");
$aParams = [
"contact_id" => $iContactId,
];