diff --git a/airtime_mvc/application/services/ShowFormService.php b/airtime_mvc/application/services/ShowFormService.php index 6202f4862..e8a085b08 100644 --- a/airtime_mvc/application/services/ShowFormService.php +++ b/airtime_mvc/application/services/ShowFormService.php @@ -149,12 +149,22 @@ class Application_Service_ShowFormService //subtract one day $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( array( - 'add_show_repeat_type' => $ccShowDays[0]->getDbRepeatType(), + 'add_show_repeat_type' => $repeatType, 'add_show_day_check' => $days, '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) diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 3fc150797..7f0d0e29f 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -214,7 +214,13 @@ function setAddShowEvents() { }); 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_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_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").hide(); } - toggleMonthlyRepeatType(); - }); - toggleMonthlyRepeatType(); + } function toggleMonthlyRepeatType() { if (form.find("#add_show_repeat_type").val() == 2) { form.find("#add_show_monthly_repeat_type-label, #add_show_monthly_repeat_type-element").show();