Commit 673884a4 authored by Elliot Pahl's avatar Elliot Pahl Committed by Elliot Pahl
Browse files

Prevent artefacts of one type from being instantiated as another.

If you are adding a casenote and  isn't set, get artefacttype from the class.
parent 9730fedd
......@@ -166,6 +166,13 @@ abstract class ArtefactType {
$this->artefacttype = $this->get_artefact_type();
if (!empty($data->artefacttype)) {
if ($this->artefacttype != $data->artefacttype) {
throw new SystemException(get_string('artefacttypemismatch', 'error', $data->artefacttype, $this->artefacttype));
// load tags
if ($this->id) {
$tags = get_column('artefact_tag', 'tag', 'artefact', $this->id);
......@@ -180,7 +187,6 @@ abstract class ArtefactType {
$this->atime = time();
$this->artefacttype = $this->get_artefact_type();
public function get_views_instances() {
......@@ -61,6 +61,7 @@ $string['dbversioncheckfailed'] = 'Your database server version is not new enoug
// general exception error messages
$string['blocktypenametaken'] = "Block type %s is already taken by another plugin (%s)";
$string['artefacttypenametaken'] = "Artefact type %s is already taken by another plugin (%s)";
$string['artefacttypemismatch'] = "Artefact type mismatch, you are trying to use this %s as a %s";
$string['classmissing'] = "class %s for type %s in plugin %s was missing";
$string['artefacttypeclassmissing'] = "Artefact types must all implement a class. Missing %s";
$string['artefactpluginmethodmissing'] = "Artefact plugin %s must implement %s and doesn't";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment