Bug in Calendar
When category and location is enabled in calendering, information is distorted between the two. All new category is added into location, while no entry is added into category.
This appears to be caused by cut&paste error. I've rectified the code and appended below.
function set_item($user, $calitemId, $data) {
if (!$data%22locationId%22 and !$data%22newloc%22) {
$data%22newloc%22 = tra("not specified");
}
if $data%22newloc%22 {
$query = "delete from `tiki_calendar_locations` where `calendarId`=? and `name`=?";
$bindvars=array($data%22calendarId%22,trim($data%22newloc%22));
$this->query($query,$bindvars,-1,-1,false);
$query = "insert into `tiki_calendar_locations` (`calendarId`,`name`) values (?,?)";
$this->query($query,$bindvars);
$data%22locationId%22 = $this->GetOne("select `callocId` from `tiki_calendar_locations` where `calendarId`=? and `name`=?",$bindvars);
}
if (!$data%22categoryId%22 and !$data%22newcat%22) {
$data%22newcat%22 = tra("not specified");
}
if $data%22newcat%22 {
$query = "delete from `tiki_calendar_categories` where `calendarId`=? and `name`=?";
$bindvars=array($data%22calendarId%22,trim($data%22newcat%22));
$this->query($query,$bindvars,-1,-1,false);
$query = "insert into `tiki_calendar_categories` (`calendarId`,`name`) values (?,?)";
$this->query($query,$bindvars);
$data%22categoryId%22 = $this->GetOne("select `calcatId` from `tiki_calendar_categories` where `calendarId`=? and `name`=?",$bindvars);
}