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
|
//Changing the start date was disabled, since the
|
||||||
//array key does not exist. We need to repopulate this entry from the db.
|
//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.
|
//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");
|
$data['add_show_start_date'] = $dt->format("Y-m-d");
|
||||||
|
|
||||||
if (!array_key_exists('add_show_start_time', $data)){
|
if (!array_key_exists('add_show_start_time', $data)){
|
||||||
$startTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartTime());
|
$data['add_show_start_time'] = $dt->format("H:i");
|
||||||
$data['add_show_start_time'] = $startTime->format("H:i");
|
|
||||||
$validateStartTime = false;
|
$validateStartTime = false;
|
||||||
}
|
}
|
||||||
$validateStartDate = false;
|
$validateStartDate = false;
|
||||||
|
|
|
@ -557,15 +557,15 @@ class Application_Model_Show {
|
||||||
|
|
||||||
$con->exec($sql);
|
$con->exec($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the start date of the current show in UTC timezone.
|
* Get the start date of the current show in UTC timezone.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* The start date in the format YYYY-MM-DD
|
* The start date in the format YYYY-MM-DD
|
||||||
*/
|
*/
|
||||||
public function getStartDate(){
|
public function getStartDateAndTime(){
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$showId = $this->getId();
|
$showId = $this->getId();
|
||||||
$sql = "SELECT first_show, start_time, timezone FROM cc_show_days"
|
$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 = new DateTime($row["first_show"]." ".$row["start_time"], new DateTimeZone($row["timezone"]));
|
||||||
$dt->setTimezone(new DateTimeZone("UTC"));
|
$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.
|
* Get the start time of the current show in UTC timezone.
|
||||||
*
|
*
|
||||||
|
@ -595,25 +606,8 @@ class Application_Model_Show {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getStartTime(){
|
public function getStartTime(){
|
||||||
$con = Propel::getConnection();
|
list(,$time) = explode(" ", $this->getStartDateAndTime());
|
||||||
|
return $time;
|
||||||
$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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue