[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] calendar/inc class.bocalendar.inc.php, 1.71.2.33.2.29
From: |
skwashd |
Subject: |
[Phpgroupware-cvs] calendar/inc class.bocalendar.inc.php, 1.71.2.33.2.29 |
Date: |
Tue, 6 Dec 2005 09:45:00 +0100 |
Update of calendar/inc
Modified Files:
Branch: Version-0_9_16-branch
class.bocalendar.inc.php lines: +83 -11
Log Message:
fix for bug #3852
====================================================
Index: calendar/inc/class.bocalendar.inc.php
diff -u calendar/inc/class.bocalendar.inc.php:1.71.2.33.2.28
calendar/inc/class.bocalendar.inc.php:1.71.2.33.2.29
--- calendar/inc/class.bocalendar.inc.php:1.71.2.33.2.28 Sat Nov 6
16:13:42 2004
+++ calendar/inc/class.bocalendar.inc.php Tue Dec 6 08:45:45 2005
@@ -1159,7 +1159,7 @@
function
overlap($starttime,$endtime,$participants,$owner=0,$id=0,$restore_cache=False)
{
-// $retval = Array();
+ $retval = array();
// $ok = False;
/* This needs some attention.. by commenting this chunk of code it will fix
bug #444265 */
@@ -1179,8 +1179,8 @@
$temp_end_time = intval(date('Hi',$endtime));
if($this->debug)
{
- echo '<!-- Temp_Start: '.$temp_start.'
-->'."\n";
- echo '<!-- Temp_End: '.$temp_end.' -->'."\n";
+ echo "<!-- Temp_Start: {$temp_start} (epoch
{$starttime}) -->\n"
+ . "<!-- Temp_End: {$temp_end} (epoch
{$endtime}) -->\n";
}
$users = Array();
@@ -1198,10 +1198,10 @@
$possible_conflicts = $this->store_to_cache(
Array(
- 'smonth' =>
substr(strval($temp_start),4,2),
+ 'smonth'=>
substr(strval($temp_start),4,2),
'sday' =>
substr(strval($temp_start),6,2),
'syear' =>
substr(strval($temp_start),0,4),
- 'emonth' =>
substr(strval($temp_end),4,2),
+ 'emonth'=>
substr(strval($temp_end),4,2),
'eday' =>
substr(strval($temp_end),6,2),
'eyear' =>
substr(strval($temp_end),0,4),
'owner' => $users
@@ -1213,8 +1213,13 @@
echo '<!-- Possible Conflicts ('.($temp_start -
1).'): '.count($possible_conflicts[$temp_start - 1]).' -->'."\n";
echo '<!-- Possible Conflicts
('.$temp_start.'): '.count($possible_conflicts[$temp_start]).' '.count($id).'
-->'."\n";
}
+
+ if ( !is_array($possible_conflicts) )
+ {
+ $possible_conflicts = array();
+ }
- if($possible_conflicts[$temp_start] ||
$possible_conflicts[$temp_end])
+ if( isset($possible_conflicts[$temp_start]) ||
isset($possible_conflicts[$temp_end]) )
{
if($temp_start == $temp_end)
{
@@ -1222,8 +1227,8 @@
{
echo '<!-- Temp_Start ==
Temp_End -->'."\n";
}
-
@reset($possible_conflicts[$temp_start]);
- while(list($key,$event) =
each($possible_conflicts[$temp_start]))
+
+ foreach (
$possible_conflicts[$temp_start] as $key => $event )
{
$found = False;
if($id)
@@ -1283,9 +1288,76 @@
}
else
{
- $retval = False;
- }
+ foreach ( $possible_conflicts as $event_list )
+ {
+ if ( is_array($event_list) )
+ {
+ foreach ($event_list as $event)
+ {
+ $found = False;
+ if ( is_array($id) )
+ {
+ foreach ( $id
as $key => $event_id)
+ {
+
if($this->debug)
+ {
+
echo '<!-- $id['.$key.'] = '.$id[$key].' = '.$event_id.' -->'."\n"
+
. '<!-- '.$event['id'].' == '.$event_id.' -->'."\n";
+ }
+
if($event['id'] == $event_id)
+ {
+
$found = True;
+ }
+ }
+ }
+ if($this->debug)
+ {
+ echo "<!-- Item
found: $found -->\n";
+ }
+
+ if(!$found)
+ {
+ if($this->debug)
+ {
+ echo
"'<!-- \nChecking event id #{$event['id']}\n";
+ }
+
+
$temp_event_start = mktime($event['start']['hour'], $event['start']['min'],
1,$event['start']['month'], $event['start']['day'], $event['start']['year']);
+ $temp_event_end
= mktime($event['end']['hour'], $event['end']['min']-1,
59,$event['end']['month'], $event['end']['day'], $event['end']['year']);
+
+ if (
$this->debug)
+ {
+ echo
"Temp Event Start (epoch) = $temp_event_start\n"
+
. "Temp Event End (epoch) = $temp_event_end\n";
+ }
+
+ if ( (
($starttime >= $temp_event_start && $starttime <= $temp_event_end )
+ ||
($endtime <= $temp_event_end && $endtime >= $temp_event_start ) )
+ &&
!$this->participants_not_rejected($participants,$event) )
+ {
+
if($this->debug)
+ {
+
echo ' Conflicts';
+ }
+
$retval[] = $event['id'];
+ }
+
+ if($this->debug)
+ {
+ echo "
-->\n";
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ( $this->debug )
+ {
+ echo "<!-- \nretval = " . print_r($retval,true)
. "-->\n";
+ }
+
if($restore_cache)
{
$this->cached_events = $temp_cache_events;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] calendar/inc class.bocalendar.inc.php, 1.71.2.33.2.29,
skwashd <=