CC-5405: When editing a single show instance from a repeating series, should not create a new cc_show
Removed redundant timestamp var Removed redundant DateTime object creation
This commit is contained in:
parent
22595c1098
commit
b78fa994f7
|
@ -199,8 +199,7 @@ SQL;
|
||||||
|
|
||||||
//convert instance to local timezone
|
//convert instance to local timezone
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
||||||
$startsDT = new DateTime($ccShowInstance->getDbStarts(),
|
$startsDT = $ccShowInstance->getDbStarts(null);
|
||||||
new DateTimeZone("UTC"));
|
|
||||||
$timezone = $ccShow->getFirstCcShowDay()->getDbTimezone();
|
$timezone = $ccShow->getFirstCcShowDay()->getDbTimezone();
|
||||||
$startsDT->setTimezone(new DateTimeZone($timezone));
|
$startsDT->setTimezone(new DateTimeZone($timezone));
|
||||||
|
|
||||||
|
@ -262,8 +261,8 @@ SQL;
|
||||||
foreach ($showInstances as $si) {
|
foreach ($showInstances as $si) {
|
||||||
array_push($instanceIds, $si->getDbId());
|
array_push($instanceIds, $si->getDbId());
|
||||||
|
|
||||||
$startsDateTime = new DateTime($si->getDbStarts(), new DateTimeZone("UTC"));
|
$startsDateTime = $si->getDbStarts(null);
|
||||||
$endsDateTime = new DateTime($si->getDbEnds(), new DateTimeZone("UTC"));
|
$endsDateTime = $si->getDbEnds(null);
|
||||||
|
|
||||||
/* The user is moving the show on the calendar from the perspective
|
/* The user is moving the show on the calendar from the perspective
|
||||||
of local time. * incase a show is moved across a time change
|
of local time. * incase a show is moved across a time change
|
||||||
|
@ -296,9 +295,6 @@ SQL;
|
||||||
$hours = ($hours > 0) ? floor($hours) : ceil($hours);
|
$hours = ($hours > 0) ? floor($hours) : ceil($hours);
|
||||||
$mins = abs($deltaMin % 60);
|
$mins = abs($deltaMin % 60);
|
||||||
|
|
||||||
//current timesamp in UTC.
|
|
||||||
$current_timestamp = gmdate("Y-m-d H:i:s");
|
|
||||||
|
|
||||||
$sql_gen = "UPDATE cc_show_instances ".
|
$sql_gen = "UPDATE cc_show_instances ".
|
||||||
"SET ends = (ends + :deltaDay1::INTERVAL + :interval1::INTERVAL) ".
|
"SET ends = (ends + :deltaDay1::INTERVAL + :interval1::INTERVAL) ".
|
||||||
"WHERE (id IN (".implode($instanceIds, ",").") ".
|
"WHERE (id IN (".implode($instanceIds, ",").") ".
|
||||||
|
@ -309,7 +305,7 @@ SQL;
|
||||||
array(
|
array(
|
||||||
':deltaDay1' => "$deltaDay days",
|
':deltaDay1' => "$deltaDay days",
|
||||||
':interval1' => "$hours:$mins",
|
':interval1' => "$hours:$mins",
|
||||||
':current_timestamp1' => $current_timestamp,
|
':current_timestamp1' => $nowDateTime->format("Y-m-d H:i:s"),
|
||||||
':deltaDay2' => "$deltaDay days",
|
':deltaDay2' => "$deltaDay days",
|
||||||
':interval2' => "$hours:$mins"
|
':interval2' => "$hours:$mins"
|
||||||
), "execute");
|
), "execute");
|
||||||
|
@ -340,7 +336,7 @@ SQL;
|
||||||
CcShowInstancesPeer::clearInstancePool();
|
CcShowInstancesPeer::clearInstancePool();
|
||||||
|
|
||||||
$instances = CcShowInstancesQuery::create()
|
$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)
|
->filterByDbId($instanceIds, Criteria::IN)
|
||||||
->find($con);
|
->find($con);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue