From 3e560bb082d921e8e9ce7167de4710aff3252a17 Mon Sep 17 00:00:00 2001
From: martin <martin@martin-ThinkPad-T410.(none)>
Date: Thu, 21 Apr 2011 21:50:50 -0400
Subject: [PATCH 1/3] CC-2227: Repeating weekday show -> Add weekend -> first
 weekend after show does not have new shows -Should be fixed

---
 airtime_mvc/application/models/Shows.php | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/airtime_mvc/application/models/Shows.php b/airtime_mvc/application/models/Shows.php
index ed3f076a2..a0a5ffbd7 100644
--- a/airtime_mvc/application/models/Shows.php
+++ b/airtime_mvc/application/models/Shows.php
@@ -283,6 +283,7 @@ class Show {
         $showId = $this->getId();
         $sql = "SELECT last_show FROM cc_show_days"
             ." WHERE show_id = $showId";
+            ." ORDER BY last_show DESC";
             
         $endDate = $CC_DBC->GetOne($sql);
         
@@ -367,7 +368,8 @@ class Show {
     
         $showId = $this->getId();
         $sql = "SELECT first_show FROM cc_show_days"
-            ." WHERE show_id = $showId";
+            ." WHERE show_id = $showId"
+            ." ORDER BY first_show";
             
         $firstDate = $CC_DBC->GetOne($sql);
         
@@ -661,16 +663,7 @@ class Show {
         $showId = $ccShow->getDbId();
         $show = new Show($showId);
 
-        //If show is a new show (not updated), then get
-        //isRecorded from POST data. Otherwise get it from
-        //the database since the user is not allowed to
-        //update this option.
-        if ($data['add_show_id'] == -1){
-            $isRecorded = ($data['add_show_record']) ? 1 : 0;
-        } else {
-            $isRecorded = $show->isRecorded();
-        } 
-
+        $isRecorded = ($data['add_show_record']) ? 1 : 0;
         
         if ($data['add_show_id'] != -1){
             Show::deletePossiblyInvalidInstances($data, $show, $endDate, $isRecorded, $repeatType);

From 6922c4d87c802d29cb2ffd7c1854735d9c4ea269 Mon Sep 17 00:00:00 2001
From: martin <martin@martin-ThinkPad-T410.(none)>
Date: Fri, 22 Apr 2011 00:55:31 -0400
Subject: [PATCH 2/3] CC-2193: Debian database install fixes

---
 install/include/AirtimeInstall.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/install/include/AirtimeInstall.php b/install/include/AirtimeInstall.php
index 00e9aae8e..35a7c5468 100644
--- a/install/include/AirtimeInstall.php
+++ b/install/include/AirtimeInstall.php
@@ -123,9 +123,9 @@ class AirtimeInstall
 
         echo "* Creating Airtime database user".PHP_EOL;
 
-        // Create the database user
-        $command = "sudo -u postgres psql postgres --command \"CREATE USER {$CC_CONFIG['dsn']['username']} "
-        ." ENCRYPTED PASSWORD '{$CC_CONFIG['dsn']['password']}' LOGIN CREATEDB NOCREATEUSER;\" 2>/dev/null";
+        $username = $CC_CONFIG['dsn']['username'];
+        $password = $CC_CONFIG['dsn']['password'];
+        $command = "echo \"CREATE USER $username ENCRYPTED PASSWORD '$password' LOGIN CREATEDB NOCREATEUSER;\" | sudo -u postgres psql";
 
         @exec($command, $output, $results);
         if ($results == 0) {
@@ -147,7 +147,9 @@ class AirtimeInstall
 
         echo "* Creating Airtime database".PHP_EOL;
 
-        $command = "sudo -u postgres createdb {$CC_CONFIG['dsn']['database']} --owner {$CC_CONFIG['dsn']['username']} 2> /dev/null";
+        $database = $CC_CONFIG['dsn']['database'];
+        $username = $CC_CONFIG['dsn']['username'];
+        $command = "echo \"CREATE DATABASE $database OWNER $username\" | sudo -u postgres psql";
         @exec($command, $output, $results);
         if ($results == 0) {
             echo "* Database '{$CC_CONFIG['dsn']['database']}' created.".PHP_EOL;

From 05ff297cf39ce1dadb9401d2b4cb017a2c0f5e9f Mon Sep 17 00:00:00 2001
From: martin <martin@martin-ThinkPad-T410.(none)>
Date: Fri, 22 Apr 2011 00:58:01 -0400
Subject: [PATCH 3/3] CC-2227 repeating weekday show bug -fixed syntax error

---
 airtime_mvc/application/models/Shows.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/airtime_mvc/application/models/Shows.php b/airtime_mvc/application/models/Shows.php
index a0a5ffbd7..085ddcec3 100644
--- a/airtime_mvc/application/models/Shows.php
+++ b/airtime_mvc/application/models/Shows.php
@@ -282,7 +282,7 @@ class Show {
     
         $showId = $this->getId();
         $sql = "SELECT last_show FROM cc_show_days"
-            ." WHERE show_id = $showId";
+            ." WHERE show_id = $showId"
             ." ORDER BY last_show DESC";
             
         $endDate = $CC_DBC->GetOne($sql);