Merge branch '2.5.x' into cc-5594-date_default

This commit is contained in:
Naomi 2013-12-04 14:42:30 -05:00
commit 82b40f52e7
14 changed files with 86 additions and 67 deletions

View file

@ -199,8 +199,7 @@ SQL;
//convert instance to local timezone
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
$startsDT = new DateTime($ccShowInstance->getDbStarts(),
new DateTimeZone("UTC"));
$startsDT = $ccShowInstance->getDbStarts(null);
$timezone = $ccShow->getFirstCcShowDay()->getDbTimezone();
$startsDT->setTimezone(new DateTimeZone($timezone));
@ -262,8 +261,8 @@ SQL;
foreach ($showInstances as $si) {
array_push($instanceIds, $si->getDbId());
$startsDateTime = new DateTime($si->getDbStarts(), new DateTimeZone("UTC"));
$endsDateTime = new DateTime($si->getDbEnds(), new DateTimeZone("UTC"));
$startsDateTime = $si->getDbStarts(null);
$endsDateTime = $si->getDbEnds(null);
/* The user is moving the show on the calendar from the perspective
of local time. * incase a show is moved across a time change
@ -296,9 +295,6 @@ SQL;
$hours = ($hours > 0) ? floor($hours) : ceil($hours);
$mins = abs($deltaMin % 60);
//current timesamp in UTC.
$current_timestamp = gmdate("Y-m-d H:i:s");
$sql_gen = "UPDATE cc_show_instances ".
"SET ends = (ends + :deltaDay1::INTERVAL + :interval1::INTERVAL) ".
"WHERE (id IN (".implode($instanceIds, ",").") ".
@ -309,7 +305,7 @@ SQL;
array(
':deltaDay1' => "$deltaDay days",
':interval1' => "$hours:$mins",
':current_timestamp1' => $current_timestamp,
':current_timestamp1' => $nowDateTime->format("Y-m-d H:i:s"),
':deltaDay2' => "$deltaDay days",
':interval2' => "$hours:$mins"
), "execute");
@ -340,7 +336,7 @@ SQL;
CcShowInstancesPeer::clearInstancePool();
$instances = CcShowInstancesQuery::create()
->filterByDbEnds($current_timestamp, Criteria::GREATER_THAN)
->filterByDbEnds($nowDateTime->format("Y-m-d H:i:s"), Criteria::GREATER_THAN)
->filterByDbId($instanceIds, Criteria::IN)
->find($con);

View file

@ -95,15 +95,14 @@ class CcShow extends BaseCcShow {
*/
public function isRepeating()
{
//get ALL cc_show_day entries
//get all cc_show_day entries that are repeating
$ccShowDays = CcShowDaysQuery::create()
->filterByDbShowId($this->id)
->filterByDbRepeatType(0, Criteria::GREATER_EQUAL)
->find();
foreach ($ccShowDays as $day) {
if ($day->getDbRepeatType() >= 0) {
return true;
}
if (!$ccShowDays->isEmpty()) {
return true;
}
return false;

View file

@ -40,8 +40,7 @@ class CcShowDays extends BaseCcShowDays {
);
//set timezone to that of the show
$dt->setTimezone(new DateTimeZone($this->getDbTimezone()));
//$dt->setTimezone(new DateTimeZone($this->getDbTimezone()));
return $dt;
}
@ -50,9 +49,9 @@ class CcShowDays extends BaseCcShowDays {
* Returns the end of a show in the timezone it was created in
* @param DateTime $startDateTime first show in show's local time
*/
public function getLocalEndDateAndTime($showStart)
public function getLocalEndDateAndTime()
{
$startDateTime = clone $showStart;
$startDateTime = $this->getLocalStartDateAndTime();
$duration = explode(":", $this->getDbDuration());
return $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M'));