diff --git a/code/web/sys/Account/User.php b/code/web/sys/Account/User.php index 791a66bc8f..e29081508b 100644 --- a/code/web/sys/Account/User.php +++ b/code/web/sys/Account/User.php @@ -4301,27 +4301,28 @@ public function canReceiveNotifications($alertType): bool { } public function canReceiveILSNotification($code): bool { - $userHomeLocation = $this->homeLocationId; - $userLocation = new Location(); - $userLocation->locationId = $this->homeLocationId; - if($userLocation->find(true)) { - $userLibrary = $userLocation->getParentLibrary(); - if ($userLibrary) { - require_once ROOT_DIR . '/sys/AspenLiDA/NotificationSetting.php'; - $settings = new NotificationSetting(); - $settings->id = $userLibrary->lidaNotificationSettingId; - if ($settings->find(true)) { - $ilsMessageTypes = new ILSMessageType(); - $ilsMessageTypes->ilsNotificationSettingId = $settings->ilsNotificationSettingId; - $ilsMessageTypes->code = $code; - $ilsMessageTypes->isEnabled = 1; - if($ilsMessageTypes->find(true)) { - return true; + if($this->isNotificationHistoryEnabled()) { // check if ils notifications are enabled for the ils + $userHomeLocation = $this->homeLocationId; + $userLocation = new Location(); + $userLocation->locationId = $this->homeLocationId; + if($userLocation->find(true)) { + $userLibrary = $userLocation->getParentLibrary(); + if ($userLibrary) { + require_once ROOT_DIR . '/sys/AspenLiDA/NotificationSetting.php'; + $settings = new NotificationSetting(); + $settings->id = $userLibrary->lidaNotificationSettingId; + if ($settings->find(true)) { + $ilsMessageTypes = new ILSMessageType(); + $ilsMessageTypes->ilsNotificationSettingId = $settings->ilsNotificationSettingId; + $ilsMessageTypes->code = $code; + $ilsMessageTypes->isEnabled = 1; + if($ilsMessageTypes->find(true)) { + return true; + } } } } } - return false; } @@ -4654,6 +4655,11 @@ public function showRenewalLink(AccountSummary $ilsAccountSummary) : bool { } return $showRenewalLink; } + + public function isNotificationHistoryEnabled(): bool { + $catalogDriver = $this->getCatalogDriver(); + return $catalogDriver->hasIlsInbox(); + } } function modifiedEmpty($var) {