From 7d1a0b9fec31f6bb37004e02ae7d41380506e51f Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 27 Dec 2017 20:30:27 +0400 Subject: Updated the function to update the record --- lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib.php') diff --git a/lib.php b/lib.php index fd2921c..9f89bd8 100644 --- a/lib.php +++ b/lib.php @@ -120,10 +120,11 @@ function local_webhooks_create_record($record) { function local_webhooks_update_record($record) { global $DB; - if (!empty($record->events)) { - $record->events = local_webhooks_serialization_data($record->events); + if (empty($record->id)) { + print_error("missingparam", "error", null, "id"); } + $record->events = !empty($record->events) ? local_webhooks_serialization_data($record->events) : null; $result = $DB->update_record("local_webhooks_service", $record, false); local_webhooks_events::service_updated($record->id); return boolval($result); -- cgit v1.2.3