Index: /trunk/prototype/services/iCal.php
===================================================================
--- /trunk/prototype/services/iCal.php	(revision 6171)
+++ /trunk/prototype/services/iCal.php	(revision 6215)
@@ -130,5 +130,5 @@
     public function createAlarms($alarms, &$vevent)
     {	
-		foreach ($alarms as $ia => $va)
+	    foreach ($alarms as $ia => $va)
 	    {
 	    	$valarm = new valarm();
@@ -224,4 +224,5 @@
 	$method = $vcalendar->getProperty('method', FALSE, FALSE);
 	$params['prodid'] = $vcalendar->getProperty('prodid', false, false);
+	$params['X-WR-TIMEZONE'] = ( $xrTimezone = $vcalendar->getProperty('X-WR-TIMEZONE', false, false)) ? self::nomalizeTZID($xrTimezone[1]) : false ;
 
 	while ($component = $vcalendar->getComponent()) {
@@ -279,7 +280,9 @@
 				    $startTime = $component->getProperty('dtstart', false, true);
 
-				    /* Tiem zone do evento */
-				    if (isset($startTime['params']['TZID']))
-					$sc['timezone'] = self::nomalizeTZID($startTime['params']['TZID']);
+				    $tzid = isset($startTime['params']['TZID']) ? $startTime['params']['TZID'] : $params['X-WR-TIMEZONE'];
+
+				    /* Tiem zone do evento */	
+				    if ($tzid)
+					$sc['timezone'] = self::nomalizeTZID($tzid);
 				    else
 					$sc['timezone'] = isset($params['calendar_timezone']) ? $params['calendar_timezone'] : 'America/Sao_Paulo';
@@ -717,5 +720,4 @@
 	}
 
-
 	/* Data de Termino */
 	$endTime = $component->getProperty('dtend', false, true);
@@ -749,7 +751,9 @@
 	$startTime = $component->getProperty('dtstart', false, true);
 
+	$tzid = isset($startTime['params']['TZID']) ? $startTime['params']['TZID'] : $params['X-WR-TIMEZONE'];
+	
 	/* Tiem zone do evento */
-	if (isset($startTime['params']['TZID']))
-	    $schedulable['timezone'] = self::nomalizeTZID($startTime['params']['TZID']);
+	if ($tzid)
+	    $schedulable['timezone'] = $tzid;
 	else
 	    $schedulable['timezone'] = isset($params['calendar_timezone']) ? $params['calendar_timezone'] : 'America/Sao_Paulo';
@@ -760,6 +764,6 @@
 	    $schedulable['allDay'] = 1;
 	    $schedulable['startTime'] = self::date2timestamp($startTime['value']) - self::_getTzOffset('UTC', $schedulable['timezone'], '@' . self::date2timestamp($startTime['value'])) . '000';
-	} elseif (isset($startTime['params']['TZID']) && !isset($startTime['value']['tz'])) {/* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */
-	    $schedulable['startTime'] = self::date2timestamp($startTime['value']) - self::_getTzOffset('UTC', $startTime['params']['TZID'], '@' . self::date2timestamp($startTime['value'])) . '000';
+	} elseif ($tzid && !isset($startTime['value']['tz'])) {/* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */
+	    $schedulable['startTime'] = self::date2timestamp($startTime['value']) - self::_getTzOffset('UTC', $tzid, '@' . self::date2timestamp($startTime['value'])) . '000';
 	    $schedulable['allDay'] = 0;
 	} else {
@@ -774,12 +778,13 @@
 	}
 
-
 	/* Data de Termino */
 	$endTime = $component->getProperty('dtend', false, true);
 
+	$tzid = isset($endTime['params']['TZID']) ? $endTime['params']['TZID'] : $params['X-WR-TIMEZONE'];
+
 	if (isset($endTime['params']['VALUE']) && $endTime['params']['VALUE'] === 'DATE')
 	    $schedulable['endTime'] = self::date2timestamp($endTime['value']) - self::_getTzOffset('UTC', $schedulable['timezone'], '@' . self::date2timestamp($endTime['value'])) . '000';
-	else if (isset($endTime['params']['TZID']) && !isset($endTime['value']['tz'])) /* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */
-	    $schedulable['endTime'] = self::date2timestamp($endTime['value']) - self::_getTzOffset('UTC', $endTime['params']['TZID'], '@' . self::date2timestamp($endTime['value'])) . '000';
+	else if ($tzid && !isset($endTime['value']['tz'])) /* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */
+	    $schedulable['endTime'] = self::date2timestamp($endTime['value']) - self::_getTzOffset('UTC', $tzid, '@' . self::date2timestamp($endTime['value'])) . '000';
 	else {
 	    $schedulable['endTime'] = self::date2timestamp($endTime['value']) . '000';
Index: /trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 6200)
+++ /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 6215)
@@ -146,12 +146,5 @@
 		.(!empty($ids) ? ' ' .'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\') ' : ' ');
 
-		
-		ob_start();
-		print_r($sql.$where);
-
-		$output = ob_get_clean();
-		file_put_contents( "/tmp/acoutinho.log",  $output , FILE_APPEND);
-
-		
+
 		$params = Controller::service('PostgreSQL')->execResultSql($sql.$where);
 		$params = array_merge($params, $occ);		
