| 803 | } |
| 804 | |
| 805 | void DbEvents::AddAcknowledgementInternal(const Checkable::Ptr& checkable, AcknowledgementType type, bool add) |
| 806 | { |
| 807 | Host::Ptr host; |
| 808 | Service::Ptr service; |
| 809 | tie(host, service) = GetHostService(checkable); |
| 810 | |
| 811 | DbQuery query1; |
| 812 | query1.WhereCriteria = new Dictionary(); |
| 813 | |
| 814 | if (service) { |
| 815 | query1.Table = "servicestatus"; |
| 816 | query1.WhereCriteria->Set("service_object_id", service); |
| 817 | } else { |
| 818 | query1.Table = "hoststatus"; |
| 819 | query1.WhereCriteria->Set("host_object_id", host); |
| 820 | } |
| 821 | |
| 822 | query1.Type = DbQueryUpdate; |
| 823 | query1.Category = DbCatState; |
| 824 | query1.StatusUpdate = true; |
| 825 | query1.Object = DbObject::GetOrCreateByObject(checkable); |
| 826 | |
| 827 | query1.Fields = new Dictionary({ |
| 828 | { "acknowledgement_type", type }, |
| 829 | { "problem_has_been_acknowledged", add ? 1 : 0 } |
| 830 | }); |
| 831 | |
| 832 | query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ |
| 833 | |
| 834 | DbObject::OnQuery(query1); |
| 835 | } |
| 836 | |
| 837 | /* notifications */ |
| 838 | void DbEvents::AddNotificationHistory(const Checkable::Ptr& checkable, const std::set<User::Ptr>& users, NotificationType type, |