Bugfix in cascading cohort sync

This commit is contained in:
PMKuipers 2023-06-30 10:54:59 +02:00
parent 13e862de9a
commit 5bbff0799c

View file

@ -118,7 +118,7 @@ class cascadecohortsync {
if(!in_array($this->studyplanid ,$plans)){
// if not, add it to the reference
$this->debug->write("Adding this plan to the list");
$plans[] = $this->studyplanid;
$plans[] = (int)($this->studyplanid);
$enrol->update_instance($instance,(object)["customtext4"=>json_encode($plans)]);
}
@ -139,7 +139,7 @@ class cascadecohortsync {
// in the customtext4 field in json format
$this->debug->write("Instance ({$instanceid} created. Updateing instance with studyplan id");
$instance = $DB->get_record('enrol', array('id' => $instanceid));
$enrol->update_instance($instance,(object)["customtext4"=>json_encode([$this->studyplanid])]);
$enrol->update_instance($instance,(object)["customtext4"=>json_encode([(int)($this->studyplanid)])]);
$this->debug->write("Synchronize the enrolment");
// Successfully added a valid new instance, so now instantiate it.