X-Git-Url: https://jasonwoof.com/gitweb/?p=contractor-progress.git;a=blobdiff_plain;f=tasks.php;fp=tasks.php;h=44ff8139544a5b47bd867c0762ff4e53c897c4f4;hp=79669871288de7ec17916382ecac09ebaebbfc9b;hb=5128251de7e25e60838369d83945cc7af40a579e;hpb=db8720bf63328fee760fc2c1d1aebd7844c9f8ce diff --git a/tasks.php b/tasks.php index 7966987..44ff813 100644 --- 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