JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added TASK_BUG state, improved home page so initial states are displayd and lebeled...
[contractor-progress.git] / tasks.php
index 0443889..e923b21 100644 (file)
--- a/tasks.php
+++ b/tasks.php
@@ -46,6 +46,12 @@ function _tasks_main() {
                tem_show('editing');
        }
 
+       if(isset($_REQUEST['tasks_new_bug'])) {
+               tem_show('bug_submit');
+       } else {
+               tem_show('normal_submits');
+       }
+
        $delete_id = format_int($_REQUEST['tasks_delete_id']);
        unset($_REQUEST['tasks_delete_id']);
        if($delete_id) {
@@ -62,22 +68,25 @@ function _tasks_main() {
        if(isset($_REQUEST['title'])) {
                list($title, $url, $description) = tasks_get_fields();
 
+               # FIXME
+               if(isset($_REQUEST['save_draft'])) {
+                       $state = TASK_DRAFT;
+               } elseif(isset($_REQUEST['save_bug'])) {
+                       $state = TASK_BUG;
+               } else {
+                       $state = TASK_NEEDS_QUOTE;
+               }
+
                if("you're happy with the POSTed values") {
                        if($edit_id) {
-                               db_update('tasks', 'title,url,description,state', $title, $url, $description, $state, $paid = 0, 'where id=%i', $edit_id);
+                               db_update('tasks', 'title,url,description,state', $title, $url, $description, $state, 'where id=%i', $edit_id);
                                message('Task updated.');
                        } else {
                                # new task
                                $paid = 0;
-                               if(isset($_REQUEST['save_draft'])) {
-                                       $state = TASK_DRAFT;
-                               } else {
-                                       $state = TASK_NEEDS_QUOTE;
-                               }
                                $client_id = 4; # FIXME
                                db_insert('tasks', 'client_id,title,url,description,state,paid', $client_id, $title, $url, $description, $state, $paid);
                                message('Task saved.');
-                               return './';
                        }
                        if($GLOBALS['tasks_form_recipient'] != "fixme@example.com") {
                                $to = $GLOBALS['tasks_form_recipient'];
@@ -99,8 +108,7 @@ function _tasks_main() {
                                }
                        }
                        if($error !== true) {
-                               tem_show('thankyou');
-                               return;
+                               return './';
                        }
                }
                # otherwise, we display the form again. tasks_get_fields() has