Project

General

Profile

Bug #5720

Events en course calendar dissapearing

Added by Jose Manuel Abuin Mosquera almost 7 years ago. Updated almost 7 years ago.

Status:
Bug resolved
Priority:
High
Category:
Agenda
Target version:
Start date:
13/11/2012
Due date:
% Done:

100%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

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:

File: main/calendar/agenda.lib.php

Line 187, code should be:
case 'course':
$id_curso=api_get_course_int_id();
$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)));
break;

Line 212, code should be:
case 'course':
$id_curso=api_get_course_int_id();
Database::delete($this->tbl_course_agenda, array('id = ? AND c_id = ?' =>array($id,$id_curso)));
//Database::delete($this->tbl_course_agenda, array('id = ?' =>$id));
break;

I was going crazy with this problem, I hope it helps you :)

Associated revisions

Revision 81ebef90 (diff)
Added by Julio Montoya almost 7 years ago

Adding c_id to query see #5720 fix provided by Jose Abuin

History

#1

Updated by Jose Manuel Abuin Mosquera almost 7 years ago

  • Target version set to 1.9.4
  • % Done changed from 60 to 80
#2

Updated by Julio Montoya almost 7 years ago

  • Status changed from New to Needs more info

Hello Jose,
Thanks for reporting and fixing the bug, the patch was added in the repo

http://code.google.com/p/chamilo/source/detail?r=3215f1efe5861898903b4b416d94b5c024867f15&name=1.9.x&repo=classic

#3

Updated by Julio Montoya almost 7 years ago

  • Status changed from Needs more info to Needs testing
#4

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...

Also available in: Atom PDF