Commit 1adfbdc6 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1623282: property of non-object error for old annotations



When the old annotations have feedback on them

behatnotneeded

Change-Id: I1325ebf9d3067065730442b81c885d5b7178c777
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 83a2deee
......@@ -1275,24 +1275,27 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType {
safe_require('module', 'framework');
$evidence = get_record('framework_evidence', 'annotation', $metadata->block);
$defaultval = $evidence->state;
if ($options = Framework::get_my_assessment_options_for_user($view->get('owner'), $evidence->framework)) {
if (!array_key_exists($defaultval, $options)) {
$defaultval = null;
if (!empty($evidence)) {
// we are dealing with an annotation added since smartevidence was added
$defaultval = $evidence->state;
if ($options = Framework::get_my_assessment_options_for_user($view->get('owner'), $evidence->framework)) {
if (!array_key_exists($defaultval, $options)) {
$defaultval = null;
}
$form['elements']['assessment'] = array(
'type' => 'select',
'title' => get_string('assessment', 'module.framework'),
'options' => $options,
'defaultvalue' => $defaultval,
'width' => '280px',
);
$form['elements']['evidence'] = array(
'type' => 'hidden',
'value' => $evidence->id,
);
}
$form['elements']['assessment'] = array(
'type' => 'select',
'title' => get_string('assessment', 'module.framework'),
'options' => $options,
'defaultvalue' => $defaultval,
'width' => '280px',
);
$form['elements']['evidence'] = array(
'type' => 'hidden',
'value' => $evidence->id,
);
}
}
}
......
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