[Vtigercrm-commits] [vtiger-commits] r9817 - /vtigercrm/branches/5.0.3/include/utils/RecurringType.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Nov 13 04:34:33 EST 2006


Author: richie
Date: Mon Nov 13 02:34:28 2006
New Revision: 9817

Log:
Calendar weekly event not shown properly - fixed. Fixes #2341

Modified:
    vtigercrm/branches/5.0.3/include/utils/RecurringType.php

Modified: vtigercrm/branches/5.0.3/include/utils/RecurringType.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/RecurringType.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/RecurringType.php Mon Nov 13 02:34:28 2006
@@ -91,6 +91,8 @@
 		$startdate = $this->startdate->get_formatted_date();
 		$tempdate = $startdate;
 		$enddate = $this->enddate->get_formatted_date();
+		
+		$recurringDates[]=$startdate;	
 		while($tempdate <= $enddate)
 		{
 			if($this->recur_type == 'Daily')
@@ -113,6 +115,7 @@
 					'year'  => $st_date[0]
 				);
 				$tempdateObj = new DateTime($date_arr,true);
+				
 				if(isset($this->dayofweek_to_rpt) && $this->dayofweek_to_rpt != null)
 				{
 					$weekstartObj = $tempdateObj->getThisweekDaysbyIndex(0);
@@ -120,10 +123,12 @@
 					{
 						for($i=0;$i<count($this->dayofweek_to_rpt);$i++)
 						{
+							
 							$repeatdateObj = $weekstartObj->getThisweekDaysbyIndex($this->dayofweek_to_rpt[$i]);
 							if($repeatdateObj->get_formatted_date() <= $enddate)
 								$recurringDates[] = $repeatdateObj->get_formatted_date();
 						}
+						
 						if(isset($this->recur_freq))
 							$index = $this->recur_freq * 7;
 						else
@@ -134,9 +139,31 @@
 							'year'  => $st_date[0]
 						);
 						$tempdateObj = new DateTime($date_arr,true);
-					}
+						
+						//echo '<pre>';print_r($recurringDates); echo '</pre>';
+						
+					}
+					
 					else
 					{
+						
+						$eventStart = $this->startdate->get_formatted_date();
+						for($i=0;$i<count($this->dayofweek_to_rpt);$i++)
+                                                {
+
+							$repeatDay = $weekstartObj->getThisweekDaysbyIndex($this->dayofweek_to_rpt[$i]);
+							$repeatDate= $repeatDay->get_formatted_date();
+							
+							if($repeatDate >= $eventStart)
+							{
+								
+								if($repeatDate <= $enddate)
+								$recurringDates[] = $repeatDate;
+
+							}
+							
+						}
+											
 						if(isset($this->recur_freq))
 							$index = $this->recur_freq * 7;
 						else





More information about the vtigercrm-commits mailing list