use timezone which has same calendar_id 82/47782/3
authorJeesun Kim <iamjs.kim@samsung.com>
Fri, 4 Sep 2015 08:52:20 +0000 (17:52 +0900)
committerjeesun kim <iamjs.kim@samsung.com>
Wed, 9 Sep 2015 03:09:20 +0000 (20:09 -0700)
Change-Id: If12bd072df9a322ac45321204fe22d328ea552dd

client/cal_client_ipc.c
packaging/calendar-service.spec
server/db/cal_db_plugin_event.c
server/db/cal_db_plugin_event_helper.c
server/db/cal_db_plugin_timezone_helper.c
server/db/cal_db_plugin_timezone_helper.h

index 2db962b..6571af1 100644 (file)
@@ -145,6 +145,7 @@ static int _cal_client_ipc_connect(calendar_h handle, pims_ipc_h ipc)
        }
        return ret;
 }
+
 static void _cal_client_ipc_disconnected_cb(void *user_data)
 {
        DBG("disconnected");
index 16e9346..2c545a8 100644 (file)
@@ -1,6 +1,6 @@
 Name:       calendar-service
 Summary:    DB library for calendar
-Version:    0.1.147
+Version:    0.1.149
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0
index abc21fd..4b11f97 100644 (file)
@@ -514,8 +514,9 @@ static int __update_record(calendar_record_h record, int is_dirty_in_time)
        }
 
        has_alarm = cal_db_alarm_has_alarm(event->alarm_list);
-       cal_db_timezone_search_with_tzid(event->start_tzid, &timezone_id);
+       cal_db_timezone_search_with_tzid(event->calendar_id, event->start_tzid, &timezone_id);
        input_ver = cal_db_util_get_next_ver();
+
        int is_allday = 0;
        if (CALENDAR_TIME_LOCALTIME == event->start.type
                        && (0 == event->start.time.date.hour)
@@ -1430,8 +1431,9 @@ static int _cal_db_event_replace_record(calendar_record_h record, int id)
                return _cal_db_event_update_dirty(record, -1);
        }
        has_alarm = cal_db_alarm_has_alarm(event->alarm_list);
-       cal_db_timezone_search_with_tzid(event->start_tzid, &timezone_id);
+       cal_db_timezone_search_with_tzid(event->calendar_id, event->start_tzid, &timezone_id);
        input_ver = cal_db_util_get_next_ver();
+
        int is_allday = 0;
        if (CALENDAR_TIME_LOCALTIME == event->start.type
                        && (0 == event->start.time.date.hour)
index 86edb2d..95ad6b0 100644 (file)
@@ -668,8 +668,9 @@ int cal_db_event_insert_record(calendar_record_h record, int original_event_id,
        calendar_record_destroy(record_calendar, true);
 
        has_alarm = cal_db_alarm_has_alarm(event->alarm_list);
-       cal_db_timezone_search_with_tzid(event->start_tzid, &timezone_id);
+       cal_db_timezone_search_with_tzid(event->calendar_id, event->start_tzid, &timezone_id);
        input_ver = cal_db_util_get_next_ver();
+
        int is_allday = 0;
        if (CALENDAR_TIME_LOCALTIME == event->start.type
                        && (0 == event->start.time.date.hour)
index edc1181..92cec4b 100644 (file)
 #include "cal_db.h"
 #include "cal_db_util.h"
 
-void cal_db_timezone_search_with_tzid(char *tzid, int *timezone_id)
+void cal_db_timezone_search_with_tzid(int book_id, char *tzid, int *timezone_id)
 {
        RET_IF(NULL == tzid);
        RET_IF('\0' == *tzid);
        RET_IF(NULL == timezone_id);
 
        char query[CAL_DB_SQL_MAX_LEN] = {0};
-       snprintf(query, sizeof(query), "SELECT id FROM %s WHERE standard_name='%s'", CAL_TABLE_TIMEZONE, tzid);
+       snprintf(query, sizeof(query), "SELECT id FROM %s WHERE calendar_id=%d AND standard_name='%s'"
+                       , CAL_TABLE_TIMEZONE, book_id, tzid);
        cal_db_util_query_get_first_int_result(query, NULL, timezone_id);
 }
index 67088e1..8aef5fc 100644 (file)
@@ -20,6 +20,6 @@
 #ifndef __CAL_DB_PLUGIN_TIMEZONE_HELPER_H__
 #define __CAL_DB_PLUGIN_TIMEZONE_HELPER_H__
 
-void cal_db_timezone_search_with_tzid(char *tzid, int *timezone_id);
+void cal_db_timezone_search_with_tzid(int book_id, char *tzid, int *timezone_id);
 
 #endif  /* __CAL_DB_PLUGIN_TIMEZONE_HELPER_H__ */