Events en course calendar dissapearing
From a few weeks ago we noticed in our Chamilo 1.9.2 platform that some events in some courses were dissapearing.
Today I found the answer to this problem.
When you delete an event from your course agenda, in the code the c_id reference is not specified in the sql query, so, if you delete an event with id=1, all the events from all courses with the event id=1 are deleted. It also happens when you edit an event.
To solve this I changed the following:
Line 187, code should be:
$attributes['title'] = $title;
$attributes['content'] = $content;
$attributes['start_date'] = $start;
$attributes['end_date'] = $end;
//Database::update($this->tbl_course_agenda, $attributes, array('id = ?' => $id));
Database::update($this->tbl_course_agenda, $attributes, array('id = ? AND c_id = ?' =>array($id,$id_curso)));
Line 212, code should be:
Database::delete($this->tbl_course_agenda, array('id = ? AND c_id = ?' =>array($id,$id_curso)));
//Database::delete($this->tbl_course_agenda, array('id = ?' =>$id));
I was going crazy with this problem, I hope it helps you :)
Updated by Julio Montoya almost 7 years ago
- Status changed from New to Needs more info
Thanks for reporting and fixing the bug, the patch was added in the repo
Updated by Yannick Warnier almost 7 years ago
- Status changed from Needs testing to Bug resolved
- % Done changed from 80 to 100
I'm approving it, but it would be nice to consider returning values that help identify the problem. For example, in this case, return "false" when course_id is not defined, because we can't do anything without it anyway...