CC-3690: Able to create repeat show in the past, by editing an already ON AIR show
-fixed
This commit is contained in:
parent
3bc919affb
commit
63a5f45e9b
|
@ -752,12 +752,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
//Changing the start date was disabled, since the
|
||||
//array key does not exist. We need to repopulate this entry from the db.
|
||||
//The start date will be returned in UTC time, so lets convert it to local time.
|
||||
$dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDate());
|
||||
$dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDateAndTime());
|
||||
$data['add_show_start_date'] = $dt->format("Y-m-d");
|
||||
|
||||
if (!array_key_exists('add_show_start_time', $data)){
|
||||
$startTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartTime());
|
||||
$data['add_show_start_time'] = $startTime->format("H:i");
|
||||
$data['add_show_start_time'] = $dt->format("H:i");
|
||||
$validateStartTime = false;
|
||||
}
|
||||
$validateStartDate = false;
|
||||
|
|
|
@ -557,15 +557,15 @@ class Application_Model_Show {
|
|||
|
||||
$con->exec($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the start date of the current show in UTC timezone.
|
||||
*
|
||||
* @return string
|
||||
* The start date in the format YYYY-MM-DD
|
||||
*/
|
||||
public function getStartDate(){
|
||||
$con = Propel::getConnection();
|
||||
public function getStartDateAndTime(){
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$showId = $this->getId();
|
||||
$sql = "SELECT first_show, start_time, timezone FROM cc_show_days"
|
||||
|
@ -583,10 +583,21 @@ class Application_Model_Show {
|
|||
|
||||
$dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
|
||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||
return $dt->format("Y-m-d");
|
||||
return $dt->format("Y-m-d H:i");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the start date of the current show in UTC timezone.
|
||||
*
|
||||
* @return string
|
||||
* The start date in the format YYYY-MM-DD
|
||||
*/
|
||||
public function getStartDate(){
|
||||
list($date,) = explode(" ", $this->getStartDateAndTime());
|
||||
return $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the start time of the current show in UTC timezone.
|
||||
*
|
||||
|
@ -595,25 +606,8 @@ class Application_Model_Show {
|
|||
*/
|
||||
|
||||
public function getStartTime(){
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$showId = $this->getId();
|
||||
$sql = "SELECT first_show, start_time, timezone FROM cc_show_days"
|
||||
." WHERE show_id = $showId"
|
||||
." ORDER BY first_show"
|
||||
." LIMIT 1";
|
||||
|
||||
$query = $con->query($sql);
|
||||
|
||||
if ($query->rowCount() == 0){
|
||||
return "";
|
||||
} else {
|
||||
$rows = $query->fetchAll();
|
||||
$row = $rows[0];
|
||||
$dt = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
|
||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
||||
return $dt->format("H:i");
|
||||
}
|
||||
list(,$time) = explode(" ", $this->getStartDateAndTime());
|
||||
return $time;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue