Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(inheritance) fix service close inheritance by host #7971

Merged
merged 2 commits into from
Oct 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions www/class/config-generate/abstract/service.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ protected function getContacts(array &$service): void
} else {
$contactResult = '';
$serviceListing = $this->listServicesWithContacts($service);
//check if we have Service link to a contact.
//check if we have Service link to a contact.i

if (!empty($serviceListing)) {
$contactResult = implode(',', $this->getInheritanceContact(array_unique($serviceListing)));
}
Expand Down Expand Up @@ -284,7 +285,7 @@ protected function getCumulativeInheritance(int $serviceId, &$serviceListing = a
protected function getContactCloseInheritance(int $serviceId, &$serviceListing = array()): void
{
$stmt = $this->backend_instance->db->query(
'SELECT GROUP_CONCAT(contact.`contact_id`) as contact_id,
'SELECT GROUP_CONCAT(contact.`contact_id`) as contact_id, service.`service_activate`,
(SELECT service_template_model_stm_id FROM service
WHERE service.`service_activate` = "1"
AND service.`service_id` = ' . $serviceId . ' ) as `service_template_model_stm_id`
Expand All @@ -294,9 +295,10 @@ protected function getContactCloseInheritance(int $serviceId, &$serviceListing =
AND contact.`contact_activate` = "1"
AND contact.`contact_enable_notifications` != "0"
AND service.`service_notifications_enabled` != "0"
AND service.`service_activate` = "1"
AND service.`service_id` = ' . $serviceId
);
if (($row = $stmt->fetch()) && empty($serviceListing)) {
if (($row = $stmt->fetch()) && empty($serviceListing) && ($row['service_activate'] !== '0')) {
if ($row['contact_id']) {
$serviceListing[] = $serviceId;
} elseif (!empty($row['service_template_model_stm_id'])) {
Expand Down Expand Up @@ -420,7 +422,7 @@ protected function getContactGroupsVerticalInheritance(int $serviceId, &$service
protected function getContactGroupsCloseInheritance(int $serviceId, &$serviceListing = array()): void
{
$stmt = $this->backend_instance->db->query(
'SELECT GROUP_CONCAT(contactgroup.cg_id) as cg_id,
'SELECT GROUP_CONCAT(contactgroup.cg_id) as cg_id, service.`service_activate`,
(SELECT service_template_model_stm_id FROM service
WHERE service.`service_activate` = "1"
AND service.`service_id` = ' . $serviceId . ' ) as `service_template_model_stm_id`
Expand All @@ -432,7 +434,7 @@ protected function getContactGroupsCloseInheritance(int $serviceId, &$serviceLis
AND service.`service_activate` = "1"
AND service.`service_id` = ' . $serviceId
);
if (($row = $stmt->fetch()) && empty($serviceListing)) {
if (($row = $stmt->fetch()) && empty($serviceListing) && ($row['service_activate'] !== '0')) {
if ($row['cg_id']) {
$serviceListing[] = $serviceId;
} elseif (!empty($row['service_template_model_stm_id'])) {
Expand Down