Index: contrib/Resources/inc/class.boresources.inc.php
===================================================================
--- contrib/Resources/inc/class.boresources.inc.php	(revision 3524)
+++ contrib/Resources/inc/class.boresources.inc.php	(revision 4362)
@@ -267,5 +267,5 @@
 			}
 
-			/*$this->so = CreateObject('resources.soresources',
+			$this->so = CreateObject('calendar.socalendar',
 				Array(
 					'owner'		=> $this->owner,
@@ -274,5 +274,5 @@
 					'g_owner'	=> $this->g_owner
 				)
-			);*/
+			);
 			$this->rpt_day = array(	// need to be after creation of soresources
 				MCAL_M_SUNDAY    => 'Sunday',
@@ -589,8 +589,24 @@
 
 			$event = $this->so->read_entry($id);
-				echo $event;
+				//echo $event;
 			
 			
 			return False;
+		}
+		
+		
+	function read_entry2($id,$ignore_acl=False)
+		{
+			
+			
+				$event = $this->so->read_entry($id);
+				if(!isset($event['participants'][$this->owner]) && $this->user_is_a_member($event,$this->owner))
+				{
+					$this->so->add_attribute('participants','U',(int)$this->owner);
+					$this->so->add_entry($event);
+					$event = $this->get_cached_event();
+				}
+				return $this->xmlrpc ? $this->xmlrpc_prepare($event) : $event;
+			
 		}
 
@@ -774,4 +790,5 @@
 
 			
+			
 			$send_to_ui = True;
 			//if ((!is_array($l_start) || !is_array($l_end)) && !isset($_GET['readsess']))	// xmlrpc call
@@ -799,4 +816,5 @@
 					foreach($params['participants'] as $user => $data)
 					{
+						
 						$l_participants[] = $user.$data['status'];
 					}
@@ -1204,4 +1222,5 @@
 				}
 
+				
 				$overlapping_events = $this->overlap(
 					$this->maketime($event['start']),
@@ -1471,5 +1490,5 @@
 		}
 
-		function overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False)
+	function overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False,$location='n/a')
 		{
 //			$retval = Array();
@@ -1478,4 +1497,9 @@
 /* This needs some attention.. by commenting this chunk of code it will fix bug #444265 */
 
+			//	  foreach($id as $c=>$v)
+     		  //   echo "<p>El 565vector con indice $c tiene el valor $v </p>";
+		
+			
+			
 			if($restore_cache)
 			{
@@ -1488,7 +1512,11 @@
 //			$temp_end_time = (int)$GLOBALS['phpgw']->common->show_date($endtime,'Hi');
 			$temp_start = (int)(date('Ymd',$starttime));
+
 			$temp_start_time = (int)(date('Hi',$starttime));
 			$temp_end = (int)(date('Ymd',$endtime));
 			$temp_end_time = (int)(date('Hi',$endtime));
+		//	echo "<br>inicio".$temp_start_time." <br> fin ".$temp_end_time."<br>   ".(int)(date('Hi a',$endtime))."<br>";
+		//	echo "<br>inicio".$temp_start." <br> fin ".$temp_end."<br>   ".(int)(date('Hi a',$endtime))."<br>";
+			
 			if($this->debug)
 			{
@@ -1509,4 +1537,5 @@
 				$users[] = $this->owner;
 			}
+
 
 			$possible_conflicts = $this->store_to_cache(
@@ -1518,5 +1547,6 @@
 					'eday'	=> substr(strval($temp_end),6,2),
 					'eyear'	=> substr(strval($temp_end),0,4),
-					'owner'	=> $users
+					'owner'	=> $users,
+					'location'	=> $location
 				)
 			);
@@ -1527,5 +1557,6 @@
 				echo '<!-- Possible Conflicts ('.$temp_start.'): '.count($possible_conflicts[$temp_start]).' '.count($id).' -->'."\n";
 			}
-
+//echo "aaa".$possible_conflicts[$temp_start];
+//echo "bbbb".$possible_conflicts[$temp_end];
 			if($possible_conflicts[$temp_start] || $possible_conflicts[$temp_end])
 			{
@@ -1569,15 +1600,25 @@
 							$temp_event_end = sprintf("%d%02d",$event['end']['hour'],$event['end']['min']);
 //							if((($temp_start_time <= $temp_event_start) && ($temp_end_time >= $temp_event_start) && ($temp_end_time <= $temp_event_end)) ||
+
+
+			/*}*/
+
+
+
 							if(($temp_start_time <= $temp_event_start &&
-								$temp_end_time > $temp_event_start &&
-								$temp_end_time <= $temp_event_end ||
-								$temp_start_time >= $temp_event_start &&
-								$temp_start_time < $temp_event_end &&
-								$temp_end_time >= $temp_event_end ||
-								$temp_start_time <= $temp_event_start &&
-								$temp_end_time >= $temp_event_end ||
-								$temp_start_time >= $temp_event_start &&
-								$temp_end_time <= $temp_event_end) &&
-								$this->participants_not_rejected($participants,$event))
+								$temp_end_time >= $temp_event_start &&
+								$temp_end_time <= $temp_event_end) ||
+								($temp_start_time <= $temp_event_start &&
+								$temp_end_time >= $temp_event_start &&
+								$temp_end_time >= $temp_event_end)||
+								($temp_start_time <= $temp_event_start &&
+								$temp_end_time >= $temp_event_end) ||		
+
+								($temp_start_time >= $temp_event_start &&
+								$temp_start_time <= $temp_event_end &&
+								$temp_end_time >= $temp_event_end) ||
+								
+								($temp_start_time >= $temp_event_start &&
+								$temp_end_time <= $temp_event_end)) 
 							{
 								if($this->debug)
@@ -1585,5 +1626,5 @@
 									echo ' Conflicts';
 								}
-								$retval[] = $event['id'];
+								$retval[] = $event;
 							}
 							if($this->debug)
@@ -1597,5 +1638,6 @@
 			else
 			{
-				$retval = False;
+				$retval1 = False;
+				$retval = Array();
 			}
 
@@ -2022,9 +2064,14 @@
 			}
 			$repeated = $this->repeating_events;
+
+//echo $repeated."repeat<br>" ;
 			$r_events = count($repeated);
+//echo $r_events."  ".$this->repeating_event[1]. "repeat23<br>" ;
 			for ($i=0;$i<$r_events;$i++)
 			{
 				$rep_events = $this->repeating_events[$i];
+
 				$id = $rep_events['id'];
+//echo $id;
 				$event_beg_day = mktime(0,0,0,$rep_events['start']['month'],$rep_events['start']['mday'],$rep_events['start']['year']);
 				if($rep_events['recur_enddate']['month'] != 0 && $rep_events['recur_enddate']['mday'] != 0 && $rep_events['recur_enddate']['year'] != 0)
@@ -2160,5 +2207,8 @@
 				return False;
 			}
-			if (isset($params['start']) && ($datearr = $GLOBALS['server']->iso86012date($params['start'])))
+$location=$params['location'];
+
+	//echo "location".$location;		
+	if (isset($params['start']) && ($datearr = $GLOBALS['server']->iso86012date($params['start'])))
 			{
 				$syear = $datearr['year'];
@@ -2219,5 +2269,5 @@
 				//Se $emonth nao tem valor, recebe o valor de $smonth (que recebe $params['smonth']) e soma 1.
 				//O valor $params['emonth'] indica o mes final para a pesquisa de eventos, e passou a ser
-				//informado na a impressao de eventos mensais. Mudancas feitas em class.uiresources.inc.php, 
+				//informado na a impressao de eventos mensais. Mudancas feitas em class.uicalendar.inc.php, 
 				//function display_month_print();
 				if(!$emonth)
@@ -2236,5 +2286,5 @@
 				$edate = mktime(23,59,59,$emonth,$eday,$eyear);
 			}
-			//echo "<p>boresources::store_to_cache(".print_r($params,True).") syear=$syear, smonth=$smonth, sday=$sday, eyear=$eyear, emonth=$emonth, eday=$eday, xmlrpc='$param[xmlrpc]'</p>\n";
+			//echo "<p>bocalendar::store_to_cache(".print_r($params,True).") syear=$syear, smonth=$smonth, sday=$sday, eyear=$eyear, emonth=$emonth, eday=$eday, xmlrpc='$param[xmlrpc]'</p>\n";
 			if($this->debug)
 			{
@@ -2248,16 +2298,18 @@
 			if($owner_id)
 			{
-				$cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id);
-				$cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id);
+
+				$cached_event_ids = $this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id,$location);
+				$cached_event_ids_repeating = $this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,$owner_id,$location);
 			}
 			else
 			{
-				$cached_event_ids = "";//$this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday);
-				$cached_event_ids_repeating = "";//$this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday);
+
+				$cached_event_ids = $this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday,0,$location);
+				$cached_event_ids_repeating = $this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday,0,$location);
 			}
 
 			$c_cached_ids = count($cached_event_ids);
 			$c_cached_ids_repeating = count($cached_event_ids_repeating);
-
+//echo "totaless".$c_cached_ids." -  ".$c_cached_ids_repeating;
 			if($this->debug)
 			{
@@ -2274,10 +2326,15 @@
 
 			$cache_start = (int)(sprintf("%04d%02d%02d",$syear,$smonth,$sday));
+
 			$cached_event=$this->get_cached_event();
+
 			if($c_cached_ids)
 			{
+
 				for($i=0;$i<$c_cached_ids;$i++)
 				{
-					$event = "";//$this->so->read_entry($cached_event_ids[$i]);
+					$event = $this->so->read_entry($cached_event_ids[$i]);
+
+//echo "<br>antrrrrroooo".$event['start']."  a ".$event['end']." b ".$event['id'];
 					if ($event['recur_type'])
 					{
@@ -2287,4 +2344,5 @@
 					$enddate = (int)(date('Ymd',$this->maketime($event['end'])));
 					$this->cached_events[$startdate][] = $event;
+//echo "ver".$event['recur_type'].$startdate." ---".$enddate."<br>antrrrrroooo";;
 					if($startdate != $enddate)
 					{
@@ -2294,5 +2352,8 @@
 						for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=(int)(date('Ymd',mktime(0,0,0,$start['month'],$start['mday'] + $k,$start['year']))))
 						{
+
+
 							$c_evt_day = count($this->cached_events[$j]) - 1;
+//echo "<br>aaaa".$c_evt_day."<br>antrrrrroooo"; ;
 							if($c_evt_day < 0)
 							{
@@ -2310,4 +2371,5 @@
 								}
 								$this->cached_events[$j][] = $event;
+//echo "<br>llll:".$event."<br>antrrrrroooo";;
 							}
 							if ($j >= $cache_start && (@$params['no_doubles'] || @$this->xmlrpc))
@@ -2323,7 +2385,10 @@
 			if($c_cached_ids_repeating)
 			{
+//echo "repeaiting".$c_cached_ids_repeating;
+
 				for($i=0;$i<$c_cached_ids_repeating;$i++)
 				{
-					$this->repeating_events[$i] = "";//$this->so->read_entry($cached_event_ids_repeating[$i]);
+					$this->repeating_events[$i] = $this->so->read_entry($cached_event_ids_repeating[$i]);
+//echo "abc".$this->repeating_events[$i]."<br>";
 					if($this->debug)
 					{
@@ -2339,4 +2404,6 @@
 					}
 					$this->check_repeating_events($date);
+
+
 					if($this->debug)
 					{
@@ -2349,7 +2416,10 @@
 				}
 			}
+
+//echo "countt".count($this->cached_events);
 			$retval = Array();
 			for($j=date('Ymd',mktime(0,0,0,$smonth,$sday,$syear)),$k=0;$j<=date('Ymd',mktime(0,0,0,$emonth,$eday,$eyear));$k++,$j=date('Ymd',mktime(0,0,0,$smonth,$sday + $k,$syear)))
 			{
+//echo "vueltaaaa".$j."<br>";
 				if(is_array($this->cached_events[$j]))
 				{
@@ -2359,4 +2429,5 @@
 						{
 							$retval[] = $this->xmlrpc_prepare($event);
+//echo "cachhhhhheeeeeqqq2222".$this->xmlrpc_prepare($event)."<br>";
 						}
 					}
@@ -2364,9 +2435,14 @@
 					{
 						$retval[$j] = $this->cached_events[$j];
-					}
-				}
+						//foreach($this->cached_events[$j][0] as $c=>$v)
+     						//echo "<p>El vector con indice $c tiene el valor $v </p>";
+//echo "cachhhhhheeeeeqqq".$this->cached_events[$j][0]['public']."<br>";
+					}
+				}
+
+
 			}
 			//echo "store_to_cache(".print_r($params,True).")=<pre>".print_r($retval,True)."</pre>\n";
-			//$this->so->cal->event = $cached_event;
+			$this->so->cal->event = $cached_event;
 			return $retval;
 		}
