From 6c0b94f9bbe6b66c966fda62c17bf6b26466d0fa Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 18 Sep 2014 16:34:35 -0400 Subject: [PATCH] Moved validation workaround to Service --- .../controllers/ScheduleController.php | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 83ea54f26..dee745851 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -532,22 +532,11 @@ class ScheduleController extends Zend_Controller_Action list($data, $validateStartDate, $validateStartTime, $originalShowStartDateTime) = $service_showForm->preEditShowValidationCheck($data); - /* - * hack to prevent validating the file upload field since it - * isn't passed into $data - */ - $upload = $forms["style"]->getElement("upload"); - $forms["style"]->removeElement("upload"); - - if ($service_showForm->validateShowForms($forms, $data, $validateStartDate, $originalShowStartDateTime, true, $data["add_show_instance_id"])) { // Get the show ID from the show service to pass as a parameter to the RESTful ShowController $this->view->showId = $service_show->addUpdateShow($data); - // re-add the upload element - $forms["style"]->addElement($upload); - $this->view->addNewShow = true; $this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); } else { @@ -558,8 +547,6 @@ class ScheduleController extends Zend_Controller_Action $this->view->when->getElement('add_show_start_time')->setOptions(array('disabled' => true)); } //$this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true)); - // re-add the upload element - $forms["style"]->addElement($upload); $this->view->addNewShow = false; $this->view->action = "edit-show"; @@ -584,7 +571,7 @@ class ScheduleController extends Zend_Controller_Action // TODO: move this to js $data['add_show_hosts'] = $this->_getParam('hosts'); $data['add_show_day_check'] = $this->_getParam('days'); - + if ($data['add_show_day_check'] == "") { $data['add_show_day_check'] = null; } @@ -600,13 +587,6 @@ class ScheduleController extends Zend_Controller_Action $this->view->addNewShow = true; - /* - * hack to prevent validating the file upload field since it - * isn't passed into $data - */ - $upload = $forms["style"]->getElement("upload"); - $forms["style"]->removeElement("upload"); - if ($service_showForm->validateShowForms($forms, $data)) { // Get the show ID from the show service to pass as a parameter to the RESTful ShowController $this->view->showId = $service_show->addUpdateShow($data); @@ -617,9 +597,6 @@ class ScheduleController extends Zend_Controller_Action Logging::debug("Show creation succeeded"); } else { - // re-add the element - $forms["style"]->addElement($upload); - $this->view->form = $this->view->render('schedule/add-show-form.phtml'); Logging::debug("Show creation failed"); }