diff options
author | Valentin Popov <info@valentineus.link> | 2018-03-12 23:16:08 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2018-03-12 23:16:08 +0300 |
commit | 2bd5e80b10ffcb035063e0b2a6e9b08b4d9efd4f (patch) | |
tree | f6a35b60317b0664c8bbc0bbb2c9c652014545b4 | |
parent | af4224e8dbfe730ddd822207836702b274ba8f85 (diff) | |
download | local_webhooks-2bd5e80b10ffcb035063e0b2a6e9b08b4d9efd4f.tar.xz local_webhooks-2bd5e80b10ffcb035063e0b2a6e9b08b4d9efd4f.zip |
Rewritten 'local_webhooks_get_record' feature
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r-- | lib.php | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -83,13 +83,10 @@ function local_webhooks_search_services_by_event($eventname, $active = false) { function local_webhooks_get_record($serviceid) { global $DB; - $servicerecord = $DB->get_record(LOCAL_WEBHOOKS_TABLE_SERVICES, array("id" => $serviceid), "*", MUST_EXIST); + $record = $DB->get_record(LOCAL_WEBHOOKS_TABLE_SERVICES, array("id" => $serviceid), "*", IGNORE_MISSING); + $record->events = local_webhooks_get_list_events_for_service($serviceid); - if (!empty($servicerecord->events)) { - $servicerecord->events = local_webhooks_deserialization_data($servicerecord->events); - } - - return $servicerecord; + return $record; } /** |