Skip to content

Commit

Permalink
MDL-39954 event: Fixed errors raised while triggering event
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Aug 14, 2013
1 parent dde244c commit 29b8b7c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace assignment_submitted\event;
namespace assignment_upload\event;

defined('MOODLE_INTERNAL') || die();

Expand Down
16 changes: 2 additions & 14 deletions mod/assignment/type/upload/classes/event/assessable_uploaded.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ protected function get_legacy_eventdata() {
$eventdata->itemid = $this->objectid;
$eventdata->courseid = $this->courseid;
$eventdata->userid = $this->userid;
if ($this->get_legacy_files()) {
$eventdata->files = $this->get_legacy_files(); // This is depreceated - please use pathnamehashes instead!
if ($this->legacyfiles) {
$eventdata->files = $this->legacyfiles; // This is depreceated - please use pathnamehashes instead!
}
$eventdata->pathnamehashes = $this->other['pathnamehashes'];
return $eventdata;
Expand Down Expand Up @@ -127,16 +127,4 @@ public function set_legacy_files($files) {
$this->legacyfiles = $files;
}

/**
* Custom validation
*
* @throws coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['triggeredfrom'])) {
throw new coding_exception('triggeredfrom must be set in $other');
}
}
}
2 changes: 1 addition & 1 deletion mod/workshop/submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
'objectid' => $submission->id,
'other' => array(
'content' => $formdata->content,
'files' => array_keys($files)
'pathnamehashes' => array_keys($files)
)
);
$event = \mod_workshop\event\assessable_uploaded::create($params);
Expand Down

0 comments on commit 29b8b7c

Please sign in to comment.