[Vtigercrm-commits] [vtiger-commits] r9340 - /vtigercrm/trunk/include/utils/RecurringType.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Thu Sep 7 04:06:53 EDT 2006
Author: saraj
Date: Thu Sep 7 02:06:47 2006
New Revision: 9340
Log:
changes made for weekly recurring events --Minnie
Modified:
vtigercrm/trunk/include/utils/RecurringType.php
Modified: vtigercrm/trunk/include/utils/RecurringType.php
==============================================================================
--- vtigercrm/trunk/include/utils/RecurringType.php (original)
+++ vtigercrm/trunk/include/utils/RecurringType.php Thu Sep 7 02:06:47 2006
@@ -42,12 +42,10 @@
'month' => $end_date[1],
'year' => $end_date[0]
);
- //echo '<pre>';print_r($end_date);echo '</pre>';
$this->recur_type = $repeat_arr['type'];
$this->recur_freq = $repeat_arr['repeat_frequency'];
$this->startdate = new DateTime($start_date,true);
$this->enddate = new DateTime($end_date,true);
- //echo '<pre>';print_r($this->startdate);echo '</pre>';die;
if($repeat_arr['sun_flag'])
{
$this->dayofweek_to_rpt[] = 0;
@@ -81,7 +79,6 @@
$this->rptmonth_datevalue = $repeat_arr['repeatmonth_date'];
$this->rptmonth_daytype = $repeat_arr['repeatmonth_daytype'];
$this->recurringdates = $this->getRecurringDates();
- //echo '<pre>';print_r($this);echo '</pre>';die;
}
/**
@@ -109,20 +106,6 @@
}
elseif($this->recur_type == 'Weekly')
{
- //echo '<pre>';print_r($this);echo '</pre>';die;
- $recurringDates[] = $tempdate;
- $st_date = explode("-",$tempdate);
- if(isset($this->recur_freq))
- $index = $this->recur_freq * 7;
- else
- $index = 7;
- $date_arr = Array(
- 'day' => $st_date[2] + $index,
- 'month' => $st_date[1],
- 'year' => $st_date[0]
- );
- $tempdateObj = new DateTime($date_arr,true);
- /*$recurringDates[] = $tempdate;
$st_date = explode("-",$tempdate);
$date_arr = Array(
'day' => $st_date[2],
@@ -130,28 +113,57 @@
'year' => $st_date[0]
);
$tempdateObj = new DateTime($date_arr,true);
- $firstdayofweekObj = $tempdateObj->getThisweekDaysbyIndex(0);
- $date_arr = Array(
- 'day' => $firstdayofweekObj->day+$this->dayofweek_to_rpt[0],
- 'month' => $st_date[1],
- 'year' => $st_date[0]
- );
- $firstrptObj = new DateTime($date_arr,true);
-
- if(isset($this->recur_freq) && $this->recur_freq != null)
- $index = $st_date[2] + ($this->recur_freq -1) ;
+ if(isset($this->dayofweek_to_rpt) && $this->dayofweek_to_rpt != null)
+ {
+ $weekstartObj = $tempdateObj->getThisweekDaysbyIndex(0);
+ if($weekstartObj->get_formatted_date() >= $this->startdate->get_formatted_date())
+ {
+ 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
+ $index = 7;
+ $date_arr = Array(
+ 'day' => $st_date[2] + $index,
+ 'month' => $st_date[1],
+ 'year' => $st_date[0]
+ );
+ $tempdateObj = new DateTime($date_arr,true);
+ }
+ else
+ {
+ if(isset($this->recur_freq))
+ $index = $this->recur_freq * 7;
+ else
+ $index = 7;
+ $date_arr = Array(
+ 'day' => $st_date[2] + $index,
+ 'month' => $st_date[1],
+ 'year' => $st_date[0]
+ );
+ $tempdateObj = new DateTime($date_arr,true);
+
+ }
+ }
else
- $index = $st_date[2] - 1 ;
- $index = $st_date[2] - 1 ;
- $tempdateObj = $this->startdate->getThismonthDaysbyIndex($index,'',$st_date[1],$st_date[0]);
- if(in_array($tempdateObj->dayofweek_inshort,$this->repeatdays))
- {
- $tempdate = $tempdateObj->get_formatted_date();
- }
- else
- {
- }
- //echo '<pre>';print_r($this);echo '</pre>';die;*/
+ {
+ $recurringDates[] = $tempdateObj->get_formatted_date();
+ if(isset($this->recur_freq))
+ $index = $this->recur_freq * 7;
+ else
+ $index = 7;
+ $date_arr = Array(
+ 'day' => $st_date[2] + $index,
+ 'month' => $st_date[1],
+ 'year' => $st_date[0]
+ );
+ $tempdateObj = new DateTime($date_arr,true);
+ }
$tempdate = $tempdateObj->get_formatted_date();
}
elseif($this->recur_type == 'Monthly')
More information about the vtigercrm-commits
mailing list