diff options
author | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2016-08-31 20:52:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-31 20:52:28 +0300 |
commit | d276ce08991385c5853ad24eff0fe38c25ee41d1 (patch) | |
tree | 4914c5a9669da7ee9e332a04bdd9156334e0da2f /RecurringType.php | |
parent | c5dadfc3de449081ce6b0f10ae2ef2795fd575e1 (diff) | |
parent | a664bd255cdede492e0c175be8054c2e863c622e (diff) | |
download | scheduler-helper-php-master.zip scheduler-helper-php-master.tar.gz scheduler-helper-php-master.tar.bz2 |
Merge pull request #31 from mperednya/masterHEADorigin/masterorigin/HEADmaster
Fix recurring getting when rec is finished before interval.
Diffstat (limited to 'RecurringType.php')
-rw-r--r-- | RecurringType.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/RecurringType.php b/RecurringType.php index bb82a3e..f5a52b8 100644 --- a/RecurringType.php +++ b/RecurringType.php @@ -33,10 +33,11 @@ class RecurringType { private $_fields_values = array(); private $_recurring_start_date_stamp; private $_recurring_end_date_stamp; + private $_recurring_length; private $_config = array(); - public function __construct($recurringType, $recurringStartDateStamp, $recurringEndDateStamp, $config = array()) + public function __construct($recurringType, $recurringStartDateStamp, $recurringEndDateStamp, $recurringLength = 0, $config = array()) { if(is_array($recurringType)) $recurringType = self::parseRecurringDataArrayToString($recurringType); @@ -44,6 +45,7 @@ class RecurringType { $this->_fields_values = self::_parseRecurringDataString($recurringType); $this->_recurring_start_date_stamp = $recurringStartDateStamp; $this->_recurring_end_date_stamp = $recurringEndDateStamp; + $this->_recurring_length = $recurringLength; $this->_config = $config; } @@ -397,6 +399,7 @@ class RecurringType { return false; //Correct interval by recurring interval. + $intervalStartDateStamp -= $this->_recurring_length; //If event ends before interval but event is in interval because of length $correctedInterval = $this->_getCorrectedRecurringInterval($intervalStartDateStamp, $intervalEndDateStamp); $intervalStartDateStamp = $correctedInterval["start_date_stamp"]; $intervalEndDateStamp = $correctedInterval["end_date_stamp"]; |