Commit de49a95f authored by Penny Leach's avatar Penny Leach
Browse files

leap2a: improved the detection of reimporting contactinformation artefacts


Signed-off-by: default avatarPenny Leach <penny@mjollnir.org>
parent aca3ae41
......@@ -212,20 +212,15 @@ class ArtefactTypeContactinformation extends ArtefactTypeResume {
}
public static function setup_new($userid) {
$code = get_random_key(10, range(0, 9));
try {
$existing = artefact_instance_from_type('contactinformation', $userid);
throw new ParamOutOfRangeException("Cannot create a new Contactinformation artefact for $userid - they already have one!", $code);
} catch (Exception $e) {
if ($e->getCode() == $code) { // it is the exception we *just* threw
throw $e;
}
}
return artefact_instance_from_type('contactinformation', $userid);
} catch (ArtefactNotFoundException $e) {
$artefact = new ArtefactTypeContactinformation(null, array(
'owner' => $userid,
'title' => get_string('contactinformation', 'artefact.resume')
));
$artefact->commit();
}
return $artefact;
}
......
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