CC-4961: Show linking

Populate repeat show form correctly when a show is repeating monthly
on the same day of the week
This commit is contained in:
denise 2013-03-25 13:48:11 -04:00
parent 327d0dd6c9
commit 5b69761833
2 changed files with 20 additions and 6 deletions

View file

@ -149,12 +149,22 @@ class Application_Service_ShowFormService
//subtract one day //subtract one day
$repeatEndDate->sub(new DateInterval("P1D")); $repeatEndDate->sub(new DateInterval("P1D"));
$repeatType = $ccShowDays[0]->getDbRepeatType();
if ($repeatType == REPEAT_MONTHLY_WEEKLY) {
$monthlyRepeatType = $repeatType;
//a repeat type of 2 means the show is repeating monthly
$repeatType = 2;
} elseif ($repeatType == REPEAT_MONTHLY_MONTHLY) {
$monthlyRepeatType = $repeatType;
}
$form->populate( $form->populate(
array( array(
'add_show_repeat_type' => $ccShowDays[0]->getDbRepeatType(), 'add_show_repeat_type' => $repeatType,
'add_show_day_check' => $days, 'add_show_day_check' => $days,
'add_show_end_date' => $repeatEndDate->format("Y-m-d"), 'add_show_end_date' => $repeatEndDate->format("Y-m-d"),
'add_show_no_end' => (!$service_show->getRepeatingEndDate()))); 'add_show_no_end' => (!$service_show->getRepeatingEndDate()),
'add_show_monthly_repeat_type' => $monthlyRepeatType));
} }
private function populateFormWho($form) private function populateFormWho($form)

View file

@ -214,7 +214,13 @@ function setAddShowEvents() {
}); });
form.find("#add_show_repeat_type").change(function(){ form.find("#add_show_repeat_type").change(function(){
if($(this).val() == 2) { toggleRepeatDays();
toggleMonthlyRepeatType();
});
toggleMonthlyRepeatType();
toggleRepeatDays();
function toggleRepeatDays() {
if(form.find("#add_show_repeat_type").val() >= 2) {
form.find("#add_show_day_check-label, #add_show_day_check-element").hide(); form.find("#add_show_day_check-label, #add_show_day_check-element").hide();
//form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show(); //form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show();
} }
@ -222,9 +228,7 @@ function setAddShowEvents() {
form.find("#add_show_day_check-label, #add_show_day_check-element").show(); form.find("#add_show_day_check-label, #add_show_day_check-element").show();
//form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").hide(); //form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").hide();
} }
toggleMonthlyRepeatType(); }
});
toggleMonthlyRepeatType();
function toggleMonthlyRepeatType() { function toggleMonthlyRepeatType() {
if (form.find("#add_show_repeat_type").val() == 2) { if (form.find("#add_show_repeat_type").val() == 2) {
form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show(); form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show();