}
}
- 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);
$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;
$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'];
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