From d5f6e8a6824795196ac5ee0833589cfceb1b0ac1 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 18 Sep 2014 16:37:03 -0400 Subject: [PATCH] Moved validation workaround for show logo in from Schedule Controller, added check to prevent warning about invalid path in readfile --- .../application/services/ShowFormService.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/services/ShowFormService.php b/airtime_mvc/application/services/ShowFormService.php index a228f4cb5..342e0abea 100644 --- a/airtime_mvc/application/services/ShowFormService.php +++ b/airtime_mvc/application/services/ShowFormService.php @@ -285,7 +285,8 @@ class Application_Service_ShowFormService private function populateFormStyle($form) { - $src = $this->imagePathToDataUri($this->ccShow->getDbImagePath()); + $src = $this->ccShow->getDbImagePath() ? + $this->imagePathToDataUri($this->ccShow->getDbImagePath()) : ''; $form->populate( array( @@ -463,7 +464,19 @@ class Application_Service_ShowFormService $live = $forms["live"]->isValid($formData); $record = $forms["record"]->isValid($formData); $who = $forms["who"]->isValid($formData); + + /* + * hack to prevent validating the file upload field since it + * isn't passed into $data + */ + $upload = $forms["style"]->getElement("add_show_logo"); + $forms["style"]->removeElement("add_show_logo"); + $style = $forms["style"]->isValid($formData); + + // re-add the upload element + $forms["style"]->addElement($upload); + $when = $forms["when"]->isWhenFormValid($formData, $validateStartDate, $originalStartDate, $editShow, $instanceId); @@ -504,7 +517,7 @@ class Application_Service_ShowFormService return ($what && $live && $record && $who && $style && $when && $repeats && $absRebroadcast && $rebroadcast); } - + public function calculateDuration($start, $end, $timezone) { try {