Index: branches/2.4/prototype/modules/calendar/interceptors/Notifications.php
===================================================================
--- branches/2.4/prototype/modules/calendar/interceptors/Notifications.php	(revision 6331)
+++ branches/2.4/prototype/modules/calendar/interceptors/Notifications.php	(revision 6754)
@@ -5,4 +5,6 @@
 require_once ROOTPATH . '/plugins/icalcreator/iCalcreator.class.php';
 require_once ROOTPATH . '/api/parseTPL.php';
+
+use prototype\api\Config as Config;
 
 class Notifications extends Helpers {
Index: branches/2.4/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- branches/2.4/prototype/modules/calendar/interceptors/DBMapping.php	(revision 6588)
+++ branches/2.4/prototype/modules/calendar/interceptors/DBMapping.php	(revision 6754)
@@ -5,4 +5,6 @@
 
 require_once ROOTPATH . '/modules/calendar/interceptors/Helpers.php';
+
+use prototype\api\Config as Config;
 
 class DBMapping extends Helpers {
@@ -147,8 +149,8 @@
 			.'(range_start >= \'' . $start[1] . '\' AND range_start <= \'' . $end[1] . '\') OR '
 			.'(range_start <= \'' . $start[2] . '\' AND range_end >= \'' . $end[2] . '\')) '
-		.(!empty($ids) ? ' ' .'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\') ' : ' ') 
- 	        .'AND calendar_object.dtstart NOT IN (SELECT calendar_repeat_occurrence.occurrence from calendar_repeat_occurrence, ' 
- 	        .'calendar_repeat where (calendar_repeat_occurrence.repeat_id = calendar_repeat.id) ' 
- 	        .'AND (calendar_repeat.object_id = calendar_object.id))';
+		.(!empty($ids) ? ' ' .'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\') ' : ' ')
+		.'AND calendar_object.dtstart NOT IN (SELECT calendar_repeat_occurrence.occurrence from calendar_repeat_occurrence, '
+		.'calendar_repeat where (calendar_repeat_occurrence.repeat_id = calendar_repeat.id) '
+		.'AND (calendar_repeat.object_id = calendar_object.id))';
 
 		$params = Controller::service('PostgreSQL')->execResultSql($sql.$where);
@@ -206,6 +208,6 @@
 	//Recurepa as execeções anteriores caso exista
 	if (isset($lastExceptions) && count($lastExceptions) && $lastExceptions)
-	    foreach ($lastExceptions as $value) 
- 	        array_push($exceptions, $value['occurrence']);
+	    foreach ($lastExceptions as $value)
+		array_push($exceptions, $value['occurrence']);
 
 	$params = array_diff(self::decodeRepeat($repeat, $ranges[0]['rangeStart'], $ranges[0]['rangeEnd']), $exceptions);
@@ -215,7 +217,7 @@
 	if (!empty($params))
 	    Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,exception,occurrence)VALUES('" . $id . "','0','" . implode("'),('" . $id . "','0','", $params) . "')" . ( empty($exceptions) ? "" : ",('" . $id . "','1','" . implode("'),('" . $id . "','1','", $exceptions) . "')" ));
-    	else if(!empty($exceptions)) 
- 	    Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,exception,occurrence)VALUES ('" . $id . "','1','" . implode("'),('" . $id . "','1','", $exceptions) . "')" ); 
-   }
+	else if(!empty($exceptions))
+	    Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,exception,occurrence)VALUES ('" . $id . "','1','" . implode("'),('" . $id . "','1','", $exceptions) . "')" );
+    }	    
 
     public function checkOccurrences($start, $end, $calendarIds) {
@@ -543,10 +545,10 @@
 
 		if (isset($v['id'])) {
-	            $data = self::decodeParticipantsEvent($uri, $v, $criteria, $original); 
- 	
- 	            $result[$i]['statusAttendees'] = isset($data['statusAttendees']) ? $data['statusAttendees'] : false; 
- 	            $result[$i]['sizeAttendees'] = isset($data['sizeAttendees']) ? $data['sizeAttendees'] : false; 
- 	            $result[$i]['participants'] = $data['attendees']; 
-	
+		    $data = self::decodeParticipantsEvent($uri, $v, $criteria, $original);
+
+		    $result[$i]['statusAttendees'] = isset($data['statusAttendees']) ? $data['statusAttendees'] : false;
+		    $result[$i]['sizeAttendees'] = isset($data['sizeAttendees']) ? $data['sizeAttendees'] : false;
+		    $result[$i]['participants'] = $data['attendees'];
+
 		    $attachmentRelation = Controller::find(array('concept' => 'schedulableToAttachment'), false, array('filter' => array('=', 'schedulable', $v['id'])));
 		    if (is_array($attachmentRelation)) {
@@ -571,5 +573,5 @@
 	return $result;
     }
-
+    
 
 //TODO: Remover apos suporte a deepness na api
@@ -698,69 +700,69 @@
 /////////////////////////////////////////////////////////////////////////
 
-    static function decodeParticipantsEvent( &$uri, $result, &$criteria, $original) { 
-        $participants = Controller::find( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('=', 'schedulable'  ,  $result['id']) )); 
- 		 
- 	if($participants && ($size = count($participants)) < 100){ 
- 	    if(isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0){ 
- 	       self::deepnessFindParticipant($uri, $participants, $criteria, $original); 
- 	        $participants['attendees'] = $participants; 
- 	    } 
- 		             
- 	}else if($participants && ($size = count($participants)) > 100){ 
- 	   $owner = Controller::read( array( 'concept' => 'calendarSignature' ) , false ,array( 'filter' => array('AND', array('=', 'calendar'  ,  $result['calendar']), array('=', 'isOwner', '1')))); 
- 	   $owner = Controller::read( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('AND', array('=', 'schedulable'  ,  $result['id']), array('=', 'user', $owner[0]['user'])), 'deepness' => 2)); 
- 	 
- 	   if(is_array($owner)) 
- 	       $owner = $owner[0]; 
- 	 
- 	   $reference = array_slice($participants, 0, 100); 
- 	   $organizer = false; 
- 	   $asOwner = false; 
- 		 
- 	    foreach($reference as $r => &$v){ 
- 	        if($v['id'] == $owner['id']){ 
- 	           $v = $owner; 
- 	           $asOwner = true; 
- 	           continue; 
- 	        } 
- 		 
- 	        self::deepnessReadParticipant($uri, $v, $criteria, $original); 
- 	 
- 	        if($v['isOrganizer'] == "1" ) 
- 	           $organizer = $v; 
- 	   } 
- 	 
- 	   if(!$organizer){ 
- 	       $organizer = Controller::find( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('AND', array('=', 'schedulable'  ,  $result['id']), array('=', 'isOrganizer', '1')), 'deepness' => 2)); 
- 		 
- 	       array_push($reference, $organizer[0]); 
- 	 
- 	   }else if($organizer && ($organizer['id'] != $owner['id'])) 
- 	       array_merge($reference, $organizer); 
- 	
- 	   if(!$asOwner) 
- 	       array_push($reference, $owner); 
- 		 
- 	   $statusAttendees = array( 'default' => 0, 'accepted' => 0, 'tentative' => 0, 'cancelled' => 0, 'unanswered' => 0, 'delegated' => 0 ); 
- 	   $statusLabels = array( 'default', 'accepted', 'tentative', 'cancelled', 'unanswered', 'delegated' ); 
- 		 
- 	   foreach($participants as $k => &$p){ 
- 	       if(!$organizer && $p['isOrganizer'] == "1"){ 
- 	           self::deepnessReadParticipant($uri, $p, $criteria, $original); 
- 	           $reference = array_merge($reference, array($p)); 
- 	       } 
- 		 
- 	       $statusAttendees[$statusLabels[$p['status']]]++; 
- 	   } 
- 		 
- 	   $participants['statusAttendees'] = $statusAttendees; 
- 	   $participants['sizeAttendees'] = $size; 
- 	   $participants['attendees'] = $reference; 
-        } 
- 		         
- 	return $participants; 
-    } 
- 	     
-    static function dayAlarm( &$uri , &$params , &$criteria , $original ) {    
+    static function decodeParticipantsEvent( &$uri, $result, &$criteria, $original) {
+	$participants = Controller::find( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('=', 'schedulable'  ,  $result['id']) ));
+
+	if($participants && ($size = count($participants)) < 100){
+	    if(isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0){
+		self::deepnessFindParticipant($uri, $participants, $criteria, $original);
+		 $participants['attendees'] = $participants;
+	    }
+	    
+	}else if($participants && ($size = count($participants)) > 100){
+	    $owner = Controller::read( array( 'concept' => 'calendarSignature' ) , false ,array( 'filter' => array('AND', array('=', 'calendar'  ,  $result['calendar']), array('=', 'isOwner', '1'))));
+	    $owner = Controller::read( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('AND', array('=', 'schedulable'  ,  $result['id']), array('=', 'user', $owner[0]['user'])), 'deepness' => 2));
+
+	    if(is_array($owner))
+		$owner = $owner[0];
+
+	    $reference = array_slice($participants, 0, 100);
+	    $organizer = false;
+	    $asOwner = false;
+
+	    foreach($reference as $r => &$v){
+		if($v['id'] == $owner['id']){
+		    $v = $owner;
+		    $asOwner = true;
+		    continue;
+		}
+
+		self::deepnessReadParticipant($uri, $v, $criteria, $original);
+
+		if($v['isOrganizer'] == "1" )
+		    $organizer = $v;
+	    }
+
+	    if(!$organizer){
+		$organizer = Controller::find( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('AND', array('=', 'schedulable'  ,  $result['id']), array('=', 'isOrganizer', '1')), 'deepness' => 2));
+
+		array_push($reference, $organizer[0]);
+
+	    }else if($organizer && ($organizer['id'] != $owner['id']))
+		array_merge($reference, $organizer);
+
+	    if(!$asOwner)
+		array_push($reference, $owner);
+
+	    $statusAttendees = array( 'default' => 0, 'accepted' => 0, 'tentative' => 0, 'cancelled' => 0, 'unanswered' => 0, 'delegated' => 0 );
+	    $statusLabels = array( 'default', 'accepted', 'tentative', 'cancelled', 'unanswered', 'delegated' );
+
+	    foreach($participants as $k => &$p){
+		if(!$organizer && $p['isOrganizer'] == "1"){
+		    self::deepnessReadParticipant($uri, $p, $criteria, $original);
+		    $reference = array_merge($reference, array($p));
+		}
+
+		$statusAttendees[$statusLabels[$p['status']]]++;
+	    }
+
+	    $participants['statusAttendees'] = $statusAttendees;
+	    $participants['sizeAttendees'] = $size;
+	    $participants['attendees'] = $reference;
+	}
+	
+	return $participants;
+    }
+    
+    static function dayAlarm( &$uri , &$params , &$criteria , $original ) {
         if(isset($criteria['filter'][1]) && $criteria['filter'][1] == 'date')
         {
@@ -898,11 +900,12 @@
         Controller::delete(array('concept' => 'attachment', 'id' => $original['URI']['id']));
     }
-
-    public function decodeDeleteCalendarSignatureAlarm(&$uri, &$params, &$criteria, $original) { 
-	    if ($original['URI']['id'] == '' && isset($original['criteria']['filter'])){ 
-	            Controller::deleteAll(array('concept' => 'calendarSignatureAlarm'), null,$original['criteria']); 
-	            return false; 
-	    } 
-    } 
+    
+    public function decodeDeleteCalendarSignatureAlarm(&$uri, &$params, &$criteria, $original) {
+		if ($original['URI']['id'] == '' && isset($original['criteria']['filter'])){
+			Controller::deleteAll(array('concept' => 'calendarSignatureAlarm'), null,$original['criteria']);
+			return false;
+		}
+    }
+
     public function createDefaultSignature(&$uri, &$result, &$criteria, $original) {
 
@@ -963,5 +966,5 @@
 		//Criaremos uma agenda padrão
 		$cal = array('name' => 'Calendario',
-		  'description' => 'Calendario Padrão', 
+		    'description' => 'Calendario Padrão',
 		    'timezone' => (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo',
 		    'dtstamp' => time() . '000'
Index: branches/2.4/prototype/modules/calendar/interceptors/DAViCalAdapter.php
===================================================================
--- branches/2.4/prototype/modules/calendar/interceptors/DAViCalAdapter.php	(revision 6010)
+++ branches/2.4/prototype/modules/calendar/interceptors/DAViCalAdapter.php	(revision 6754)
@@ -1,4 +1,5 @@
 <?php
 require_once ROOTPATH.'/modules/calendar/constants.php';
+use prototype\api\Config as Config;
 
 class DAViCalAdapter { 
