From 0d5f581e35a97f9cd3b61bdfc17fe96006f469b3 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 27 Apr 2012 14:07:14 -0400 Subject: [PATCH 1/2] CC-3731: Can add a show of zero length - fixed - extra fix: Changed all the duration format so it's consistent --- airtime_mvc/application/forms/AddShowWhen.php | 6 +++--- airtime_mvc/application/models/Schedule.php | 2 +- airtime_mvc/application/models/Show.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 4372a9b6c..0b7da6155 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -69,7 +69,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $this->addElement('text', 'add_show_duration', array( 'label' => 'Duration:', 'class' => 'input_text', - 'value' => '01h00m', + 'value' => '01h 00m', 'readonly' => true, 'decorators' => array('ViewHelper') )); @@ -99,8 +99,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm } } - if( $formData["add_show_duration"] == "0m" ) { - $this->getElement('add_show_duration')->setErrors(array('Cannot have duration 0m')); + if( $formData["add_show_duration"] == "00h 00m" ) { + $this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m')); $valid = false; }elseif(strpos($formData["add_show_duration"], 'h') !== false && intval(substr($formData["add_show_duration"], 0, strpos($formData["add_show_duration"], 'h'))) > 24) { $this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h')); diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 71538520b..97d8c9f03 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -618,7 +618,7 @@ class Application_Model_Schedule { 'add_show_start_time' => '00:00', 'add_show_end_date_no_repeate' => date("Y-m-d"), 'add_show_end_time' => '01:00', - 'add_show_duration' => '1h')); + 'add_show_duration' => '01h 00m')); $formRepeats->populate(array('add_show_end_date' => date("Y-m-d"))); diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index b3fa0f0f1..457000284 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -765,7 +765,7 @@ class Application_Model_Show { return $showDay->getDbDuration(); }else{ $info = explode(':',$showDay->getDbDuration()); - return ($info[0] != 0 ? intval($info[0]).'h'.' ' : '').($info[1] != 0 ? intval($info[1]).'m' : ''); + return str_pad(intval($info[0]),2,'0',STR_PAD_LEFT).'h '.str_pad(intval($info[1]),2,'0',STR_PAD_LEFT).'m'; } } From a289480e2789d23d9bdcdd599d5ea79eb4c195a5 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 27 Apr 2012 15:30:51 -0400 Subject: [PATCH 2/2] CC-3683: Upgraded database not equivalent to fresh install database part 1 - fixed cc_show table upgrade --- .../airtime-2.1.0/common/Version20120403143635.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install_minimal/upgrades/airtime-2.1.0/common/Version20120403143635.php b/install_minimal/upgrades/airtime-2.1.0/common/Version20120403143635.php index 9e5b19517..f69e84c43 100644 --- a/install_minimal/upgrades/airtime-2.1.0/common/Version20120403143635.php +++ b/install_minimal/upgrades/airtime-2.1.0/common/Version20120403143635.php @@ -10,10 +10,10 @@ class Version20120403143635 extends AbstractMigration public function up(Schema $schema) { $cc_show = $schema->getTable('cc_show'); - $cc_show->addColumn('live_stream_using_airtime_auth', 'boolean', array('default'=> 'false')); - $cc_show->addColumn('live_stream_using_custom_auth', 'boolean', array('default'=> 'false')); - $cc_show->addColumn('live_stream_user', 'string', array('notnull' => 0, 'length' => 255)); - $cc_show->addColumn('live_stream_pass', 'string', array('notnull' => 0, 'length' => 255)); + $cc_show->addColumn('live_stream_using_airtime_auth', 'boolean', array('default'=> 0, 'notnull' => 0)); + $cc_show->addColumn('live_stream_using_custom_auth', 'boolean', array('default'=> 0, 'notnull' => 0)); + $cc_show->addColumn('live_stream_user', 'string', array('default'=> 0, 'notnull' => 0, 'length' => 255)); + $cc_show->addColumn('live_stream_pass', 'string', array('default'=> 0, 'notnull' => 0, 'length' => 255)); } public function down(Schema $schema)