Calendar: Update category list when updating/adding event

This commit is contained in:
Bart Visscher 2012-04-13 18:36:20 +02:00
parent 471e735b0c
commit 4c52007996
2 changed files with 10 additions and 0 deletions

View File

@ -116,6 +116,14 @@ class OC_Calendar_App{
}
}
/**
* check VEvent for new categories.
* @see OC_VCategories::loadFromVObject
*/
public static function loadCategoriesFromVCalendar(OC_VObject $calendar) {
self::getVCategories()->loadFromVObject($calendar->VEVENT, true);
}
public static function getRepeatOptions(){
return OC_Calendar_Object::getRepeatOptions(self::$l10n);
}

View File

@ -93,6 +93,7 @@ class OC_Calendar_Object{
*/
public static function add($id,$data){
$object = OC_VObject::parse($data);
OC_Calendar_App::loadCategoriesFromVCalendar($object);
list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object);
if(is_null($uid)){
@ -139,6 +140,7 @@ class OC_Calendar_Object{
$oldobject = self::find($id);
$object = OC_VObject::parse($data);
OC_Calendar_App::loadCategoriesFromVCalendar($object);
list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object);
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_objects SET objecttype=?,startdate=?,enddate=?,repeating=?,summary=?,calendardata=?, lastmodified = ? WHERE id = ?' );