Loading...
 
Skip to main content

deletion of calendar with no items causes database query error

Status
Closed
Subject
deletion of calendar with no items causes database query error
Version
1.9.x
Category
  • Error
Feature
Calendar
Resolution status
Fixed or Solved
Submitted by
Nelson Ko
Volunteered to solve
Nelson Ko
Lastmod by
Nelson Ko
Rating
(0)
Description

problem is in drop_calendar function within calendarlib.php.

1.9.x CVS Head Revision 1.50

Lines 103-104
$query = "delete from `tiki_calendar_roles` where `calitemId` in (".implode(',', array_fill(0,count($allItemsFromCalendar),'?')).")";
$this->query($query,array($allItemsFromCalendar));

If there are no items in calendar, $allItemsFromCalendar will not have any items. My setup with MySQL throws query error... don't know if this is universal. Anyway, fix is easy. Simply add if clause to check if $allItemsFromCalendar has any items.

Solution

if (count($allItemsFromCalendar) > 0) {
$query = "delete from `tiki_calendar_roles` where `calitemId` in (".implode(',', array_fill(0,count($allItemsFromCalendar),'?')).")";
$this->query($query,array($allItemsFromCalendar));
}

Importance
8
Priority
40
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
913
Created
Wednesday 18 October, 2006 16:14:40 UTC
by Unknown
LastModif
Wednesday 16 May, 2007 15:30:50 UTC


Show PHP error messages