From 32a1f50116daffea922a643a4a9a7ac3483de924 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 16 Jul 2013 14:56:32 +0200 Subject: [PATCH] livestatus: contacts table fixes (ignore special custom attr) refs #4372 --- components/livestatus/contactstable.cpp | 31 +++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/components/livestatus/contactstable.cpp b/components/livestatus/contactstable.cpp index b19ba6899..f224c42f7 100644 --- a/components/livestatus/contactstable.cpp +++ b/components/livestatus/contactstable.cpp @@ -141,7 +141,7 @@ Value ContactsTable::InHostNotificationPeriodAccessor(const Value& row) if (!timeperiod) return Empty; - return timeperiod->IsInside(Utility::GetTime()); + return (timeperiod->IsInside(Utility::GetTime()) ? 1 : 0); } Value ContactsTable::InServiceNotificationPeriodAccessor(const Value& row) @@ -151,7 +151,7 @@ Value ContactsTable::InServiceNotificationPeriodAccessor(const Value& row) if (!timeperiod) return Empty; - return timeperiod->IsInside(Utility::GetTime()); + return (timeperiod->IsInside(Utility::GetTime()) ? 1 : 0); } Value ContactsTable::CustomVariableNamesAccessor(const Value& row) @@ -167,6 +167,15 @@ Value ContactsTable::CustomVariableNamesAccessor(const Value& row) String key; Value value; BOOST_FOREACH(boost::tie(key, value), custom) { + if (key == "notes" || + key == "action_url" || + key == "notes_url" || + key == "icon_image" || + key == "icon_image_alt" || + key == "statusmap_image" || + key == "2d_coords") + continue; + cv->Add(key); } @@ -186,6 +195,15 @@ Value ContactsTable::CustomVariableValuesAccessor(const Value& row) String key; Value value; BOOST_FOREACH(boost::tie(key, value), custom) { + if (key == "notes" || + key == "action_url" || + key == "notes_url" || + key == "icon_image" || + key == "icon_image_alt" || + key == "statusmap_image" || + key == "2d_coords") + continue; + cv->Add(value); } @@ -205,6 +223,15 @@ Value ContactsTable::CustomVariablesAccessor(const Value& row) String key; Value value; BOOST_FOREACH(boost::tie(key, value), custom) { + if (key == "notes" || + key == "action_url" || + key == "notes_url" || + key == "icon_image" || + key == "icon_image_alt" || + key == "statusmap_image" || + key == "2d_coords") + continue; + Array::Ptr key_val = boost::make_shared(); key_val->Add(key); key_val->Add(value); -- 2.40.0