CC-4538: Cannot edit title or change time of repeating show if first instance has ended

- fixed by populating the edit show form with the next repeating show that is not in the past
This commit is contained in:
denise 2013-02-13 11:55:27 -05:00
parent eb38503d6e
commit 76cb04e296
2 changed files with 37 additions and 3 deletions

View file

@ -663,6 +663,30 @@ SQL;
$con->exec($sql);
}
public function getNextFutureRepeatShowTime()
{
$sql = <<<SQL
SELECT starts, ends FROM cc_show_instances
WHERE ends > now() at time zone 'UTC'
AND show_id = :showId
ORDER BY starts
LIMIT 1
SQL;
$result = Application_Common_Database::prepareAndExecute( $sql,
array( 'showId' => $this->getId() ), 'all' );
foreach ($result as $r) {
$show["starts"] = new DateTime($r["starts"], new DateTimeZone('UTC'));
$show["ends"] = new DateTime($r["ends"], new DateTimeZone('UTC'));
}
$currentUser = Application_Model_User::getCurrentUser();
$currentUserId = $currentUser->getId();
$userTimezone = Application_Model_Preference::GetUserTimezone($currentUserId);
$show["starts"]->setTimezone(new DateTimeZone($userTimezone));
$show["ends"]->setTimezone(new DateTimeZone($userTimezone));
return $show;
}
/**
* Get the start date of the current show in UTC timezone.
*