CC-2365 Shows from the past can be dragged into the future

adding a backend check if the show has started in the past.
This commit is contained in:
Naomi Aro 2011-06-06 18:56:32 +02:00
parent 1de4777de3
commit 02e259c0ea
1 changed files with 16 additions and 7 deletions

View File

@ -1172,7 +1172,7 @@ class Show {
$options["percent"] = $show_instance->getPercentScheduled();
}
if ($editable && strtotime($today_timestamp) < strtotime($show["starts"])) {
if ($editable && (strtotime($today_timestamp) < strtotime($show["starts"]))) {
$options["editable"] = true;
$events[] = Show::makeFullCalendarEvent($show, $options);
}
@ -1382,16 +1382,20 @@ class ShowInstance {
$mins = abs($deltaMin%60);
$today_timestamp = date("Y-m-d H:i:s");
$starts = $this->getShowStart();
$ends = $this->getShowEnd();
if(strtotime($today_timestamp) > strtotime($starts)) {
return "can't move a past show";
}
$sql = "SELECT timestamp '{$starts}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
$new_starts = $CC_DBC->GetOne($sql);
$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
$new_ends = $CC_DBC->GetOne($sql);
$today_timestamp = date("Y-m-d H:i:s");
if(strtotime($today_timestamp) > strtotime($new_starts)) {
return "can't move show into past";
}
@ -1430,9 +1434,14 @@ class ShowInstance {
$mins = abs($deltaMin%60);
$today_timestamp = date("Y-m-d H:i:s");
$starts = $this->getShowStart();
$ends = $this->getShowEnd();
if(strtotime($today_timestamp) > strtotime($starts)) {
return "can't resize a past show";
}
$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
$new_ends = $CC_DBC->GetOne($sql);