SAAS-551: Cannot schedule shows due to overlapping show check bug

This commit is contained in:
drigato 2015-01-20 11:32:15 -05:00
parent c399250fbf
commit 6ac5a2950f
2 changed files with 30 additions and 12 deletions

View file

@ -209,8 +209,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$interval = 'P21D';
} elseif ($formData["add_show_repeat_type"] == 5) {
$interval = 'P28D';
} elseif ($formData["add_show_repeat_type"] == 2) {
} elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 2) {
$interval = 'P1M';
} elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) {
list($weekNumberOfMonth, $dayOfWeek) =
Application_Service_ShowService::getMonthlyWeeklyRepeatInterval(
new DateTime($start_time, $showTimezone));
}
/* Check first show
@ -287,12 +291,26 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
break 1;
} else {
$repeatShowStart->setTimezone($showTimezone);
$repeatShowEnd->setTimezone($showTimezone);
$repeatShowStart->add(new DateInterval($interval));
$repeatShowEnd->add(new DateInterval($interval));
$repeatShowStart->setTimezone($utc);
$repeatShowEnd->setTimezone($utc);
if ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) {
$monthlyWeeklyStart = new DateTime($repeatShowStart->format("Y-m"),
new DateTimeZone("UTC"));
$monthlyWeeklyStart->add(new DateInterval("P1M"));
$repeatShowStart = clone Application_Service_ShowService::getNextMonthlyWeeklyRepeatDate(
$monthlyWeeklyStart,
$formData["add_show_timezone"],
$formData['add_show_start_time'],
$weekNumberOfMonth,
$dayOfWeek);
$repeatShowEnd = clone $repeatShowStart;
$repeatShowEnd->add(new DateInterval("PT".$hours."H".$minutes."M"));
} else {
$repeatShowStart->setTimezone($showTimezone);
$repeatShowEnd->setTimezone($showTimezone);
$repeatShowStart->add(new DateInterval($interval));
$repeatShowEnd->add(new DateInterval($interval));
$repeatShowStart->setTimezone($utc);
$repeatShowEnd->setTimezone($utc);
}
}
}
}