diff options
author | Valentin Popov <info@valentineus.link> | 2017-12-27 19:30:27 +0300 |
---|---|---|
committer | Valentin Popov <info@valentineus.link> | 2017-12-27 19:30:27 +0300 |
commit | 7d1a0b9fec31f6bb37004e02ae7d41380506e51f (patch) | |
tree | 35eb6739b0d44df62cee72d7bda47691d4149012 | |
parent | 51007a0fb5a50fdfbd9d3a8c2dd7f456f271d9e4 (diff) | |
download | local_webhooks-7d1a0b9fec31f6bb37004e02ae7d41380506e51f.tar.xz local_webhooks-7d1a0b9fec31f6bb37004e02ae7d41380506e51f.zip |
Updated the function to update the record
-rw-r--r-- | lib.php | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); |