MDL-44321 events: make sure the full object is passed to add_record_snapshot in book
authorMarina Glancy <marina@moodle.com>
Wed, 5 Mar 2014 02:58:20 +0000 (10:58 +0800)
committerMarina Glancy <marina@moodle.com>
Wed, 5 Mar 2014 03:01:19 +0000 (11:01 +0800)
mod/book/edit.php

index 7732165..b6ca863 100644 (file)
@@ -81,7 +81,10 @@ if ($mform->is_cancelled()) {
             'objectid' => $data->id
         );
         $event = \mod_book\event\chapter_updated::create($params);
-        $event->add_record_snapshot('book_chapters', $data);
+        foreach ($data as $key => $value) {
+            $chapter->$key = $value;
+        }
+        $event->add_record_snapshot('book_chapters', $chapter);
         $event->trigger();
 
     } else {