$obj = new CTimesheet(); $msg = ''; // reset the message string // bind the informations (variables) retrieved via post to the einstein object if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect(); } if ($_POST['progresso']) { $id = $obj->task_log_task; $sql2 = "UPDATE tasks set task_percent_complete = 100 WHERE task_id=" . $id; db_exec($sql2); } if ($obj->task_log_task) { $id = $obj->task_log_task; $sql = "SELECT task_name FROM tasks WHERE task_id=" . $id; $task = db_loadList($sql); foreach ($task as $row) { $task_log_name = $row['task_name']; } $obj->task_log_name = $task_log_name; } // simply store the added/edited log in database via the store method of the einstein child class of the CDpObject provided ba the dPFramework // no sql command is necessary here! :-) if ($msg = $obj->store()) { $AppUI->setMsg($msg, UI_MSG_ERROR); } else { $isNotNew = @$_POST['task_log_id']; $AppUI->setMsg($isNotNew ? 'Log task updated' : 'Log task inserted', UI_MSG_OK); } $AppUI->redirect();