Moved validation workaround to Service
This commit is contained in:
parent
5af735654c
commit
6c0b94f9bb
|
@ -532,22 +532,11 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
list($data, $validateStartDate, $validateStartTime, $originalShowStartDateTime) =
|
list($data, $validateStartDate, $validateStartTime, $originalShowStartDateTime) =
|
||||||
$service_showForm->preEditShowValidationCheck($data);
|
$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,
|
if ($service_showForm->validateShowForms($forms, $data, $validateStartDate,
|
||||||
$originalShowStartDateTime, true, $data["add_show_instance_id"])) {
|
$originalShowStartDateTime, true, $data["add_show_instance_id"])) {
|
||||||
// Get the show ID from the show service to pass as a parameter to the RESTful ShowController
|
// Get the show ID from the show service to pass as a parameter to the RESTful ShowController
|
||||||
$this->view->showId = $service_show->addUpdateShow($data);
|
$this->view->showId = $service_show->addUpdateShow($data);
|
||||||
|
|
||||||
// re-add the upload element
|
|
||||||
$forms["style"]->addElement($upload);
|
|
||||||
|
|
||||||
$this->view->addNewShow = true;
|
$this->view->addNewShow = true;
|
||||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||||
} else {
|
} 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->when->getElement('add_show_start_time')->setOptions(array('disabled' => true));
|
||||||
}
|
}
|
||||||
//$this->view->rr->getElement('add_show_record')->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->addNewShow = false;
|
||||||
$this->view->action = "edit-show";
|
$this->view->action = "edit-show";
|
||||||
|
@ -584,7 +571,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
// TODO: move this to js
|
// TODO: move this to js
|
||||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||||
$data['add_show_day_check'] = $this->_getParam('days');
|
$data['add_show_day_check'] = $this->_getParam('days');
|
||||||
|
|
||||||
if ($data['add_show_day_check'] == "") {
|
if ($data['add_show_day_check'] == "") {
|
||||||
$data['add_show_day_check'] = null;
|
$data['add_show_day_check'] = null;
|
||||||
}
|
}
|
||||||
|
@ -600,13 +587,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->addNewShow = true;
|
$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)) {
|
if ($service_showForm->validateShowForms($forms, $data)) {
|
||||||
// Get the show ID from the show service to pass as a parameter to the RESTful ShowController
|
// Get the show ID from the show service to pass as a parameter to the RESTful ShowController
|
||||||
$this->view->showId = $service_show->addUpdateShow($data);
|
$this->view->showId = $service_show->addUpdateShow($data);
|
||||||
|
@ -617,9 +597,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
Logging::debug("Show creation succeeded");
|
Logging::debug("Show creation succeeded");
|
||||||
} else {
|
} else {
|
||||||
// re-add the element
|
|
||||||
$forms["style"]->addElement($upload);
|
|
||||||
|
|
||||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||||
Logging::debug("Show creation failed");
|
Logging::debug("Show creation failed");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue