JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
made css_mangler.php handle versioning (strips numerical postfixes) and made contract...
[contractor-progress.git] / tasks.php
index 7966987..44ff813 100644 (file)
--- a/tasks.php
+++ b/tasks.php
@@ -426,7 +426,7 @@ function tasks_edit_main() {
                        }
                }
 
-               if("you're happy with the POSTed values") { # if you change this change the one above
+               if(!logged_in_as_contractor() || $_REQUEST['client_id']) { # if you change this change the one above
                        if($edit_id) {
                                $tables = 'title,url,description,state';
                                $values = array($title, $url, $description, $state);
@@ -447,6 +447,7 @@ function tasks_edit_main() {
                                $client_id = logged_in();
                                if(logged_in_as_contractor() && $_REQUEST['client_id']) {
                                        $client_id = format_int($_REQUEST['client_id']);
+                                       $client_name = db_get_value('people', 'name', 'where id=%i', $client_id);
                                } else {
                                        # if client entered the task, no price is set
                                        $price = 0;
@@ -457,7 +458,11 @@ function tasks_edit_main() {
                                        $ord = 0;
                                }
                                db_insert('tasks', 'client_id,title,url,description,state,paid,price,ord', $client_id, $title, $url, $description, $state, $paid, $price, $ord);
-                               message('Task saved.');
+                               if(logged_in_as_contractor()) {
+                                       message("Task saved for $client_name.");
+                               } else {
+                                       message('Task saved.');
+                               }
                        }
                        if($GLOBALS['tasks_form_recipient'] != "fixme@example.com") {
                                $to = $GLOBALS['tasks_form_recipient'];
@@ -481,6 +486,8 @@ function tasks_edit_main() {
                        if($error !== true) {
                                return './';
                        }
+               } else {
+                       message('Error: you must select a client for the task');
                }
                # otherwise, we display the form again. tasks_get_fields() has
                # already put the posted values back into the template engine, so they will