mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7157 - Fix usage of Enum case value
This commit is contained in:
@@ -83,7 +83,7 @@ class NotificationsCenterController extends Controller
|
||||
// Add the action notification to the list of actions notifications for the trigger
|
||||
$oActionsNotificationsByTrigger[$iTriggerId][] = $oSubscribedActionNotification;
|
||||
// Add the subscribed status to the list of subscribed actions notifications for the trigger
|
||||
$aSubscribedActionsNotificationsByTrigger[$iTriggerId][$oSubscribedActionNotification->GetKey()] = $oLnkActionsNotifications->Get('subscribed') || $oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAllChannels;
|
||||
$aSubscribedActionsNotificationsByTrigger[$iTriggerId][$oSubscribedActionNotification->GetKey()] = $oLnkActionsNotifications->Get('subscribed') || $oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAllChannels->value;
|
||||
}
|
||||
|
||||
// Build table rows
|
||||
@@ -156,7 +156,7 @@ class NotificationsCenterController extends Controller
|
||||
$oChannelSet->SetOptionsTemplate('application/object/set/option_renderer.html.twig');
|
||||
$oChannelSet->SetItemsTemplate('application/preferences/notification-center/item_renderer.html.twig');
|
||||
// Disable the input set if the subscription policy is 'force_all_channels'
|
||||
if ($sTriggerSubscriptionPolicy === SubscriptionPolicy::ForceAllChannels) {
|
||||
if ($sTriggerSubscriptionPolicy === SubscriptionPolicy::ForceAllChannels->value) {
|
||||
$oChannelSet->SetIsDisabled(true);
|
||||
}
|
||||
// Add a CSRF Token
|
||||
@@ -192,7 +192,7 @@ $.ajax({
|
||||
JS
|
||||
);
|
||||
// Set the minimum number of channels to 1 if the subscription policy is {@see SubscriptionPolicy::ForceAtLeastOneChannel}
|
||||
if($sTriggerSubscriptionPolicy === SubscriptionPolicy::ForceAtLeastOneChannel)
|
||||
if($sTriggerSubscriptionPolicy === SubscriptionPolicy::ForceAtLeastOneChannel->value)
|
||||
{
|
||||
$oChannelSet->SetMinItems(1);
|
||||
}
|
||||
@@ -290,7 +290,7 @@ JS
|
||||
// Add the action notification to the list of actions notifications for the trigger
|
||||
$oActionsNotificationsByTrigger[$iTriggerId][] = $oSubscribedActionNotification;
|
||||
// Add the subscribed status to the list of subscribed actions notifications for the trigger
|
||||
$aSubscribedActionsNotificationsByTrigger[$iTriggerId][$oSubscribedActionNotification->GetKey()] = $oLnkActionsNotifications->Get('subscribed') || $oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAllChannels;
|
||||
$aSubscribedActionsNotificationsByTrigger[$iTriggerId][$oSubscribedActionNotification->GetKey()] = $oLnkActionsNotifications->Get('subscribed') || $oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAllChannels->value;
|
||||
}
|
||||
|
||||
$oPage->AddTabContainer('NotificationsCenter', '', $oNotificationsPanel);
|
||||
@@ -492,7 +492,7 @@ JS
|
||||
throw new \Exception('Invalid trigger');
|
||||
}
|
||||
// Check the trigger subscription policy
|
||||
if ($oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAllChannels) {
|
||||
if ($oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAllChannels->value) {
|
||||
throw new \Exception('You are not allowed to unsubscribe from this channel');
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ JS
|
||||
throw new \Exception('You are not subscribed to any channel');
|
||||
}
|
||||
// Check the trigger subscription policy and if we are subscribed to at least 1 channel if necessary
|
||||
if($oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAtLeastOneChannel) {
|
||||
if($oTrigger->Get('subscription_policy') === SubscriptionPolicy::ForceAtLeastOneChannel->value) {
|
||||
$oTotalSubscribedActionsNotificationsSet = NotificationsRepository::GetInstance()->SearchSubscriptionByTriggerContactAndSubscription($iTriggerId, \UserRights::GetContactId(), '1');
|
||||
if (($oTotalSubscribedActionsNotificationsSet->Count() - $oSubscribedActionsNotificationsSet->Count()) === 0) {
|
||||
throw new \Exception('You can\'t unsubscribe from this channel, you must be subscribed to at least one channel');
|
||||
|
||||
Reference in New Issue
Block a user