$output['error'] = "Skipping incomplete entry\n"; break; } } else { $output['error'] = "Skipping incomplete entry\n"; break; } if ($task->get($task_activity->task_id) === FALSE) { $output['error'] = "Could not retreive task:\n" . $task->getLastError(); break; } if ($project->get($task->project_id) === FALSE) { $output['error'] = "Could not retreive project:\n" . $project->getLastError(); break; } if (!$project->hasRights(PROJECT_RIGHT_EDIT)) { $output['error'] = "Insufficent access rights for this project!\n"; break; } $task_activity->hourly_cost = $loggedin_user->hourly_rate; $company = $project->getCompany(); if ($company === FALSE) { $output['error'] = "Could not get company information:\n" . $project->getLastError(); break; } $task_activity->hourly_rate = $item_code->getCompanyPrice($company->id, $task_activity->item_code_id); if ($task_activity->hourly_rate === FALSE) { $output['error'] = "Error getting price for this item code:\n" . $item_code->getLastError(); break; } $sct = $task->getSalesCommissionType();
$title = ''; $task = new SI_Task(); $project = new SI_Project(); if($_REQUEST['mode'] == 'add'){ $title = "Add Task"; $task->due_ts = ''; if(empty($_REQUEST['project_id'])){ fatal_error("Error: No Project ID specified!\n"); }else{ $task->project_id = $_REQUEST['project_id']; if($project->get($task->project_id) === FALSE){ fatal_error("Could not retreive project!"); debug_message($project->getLastError()); } if(!$project->hasRights(PROJECT_RIGHT_EDIT)){ fatal_error('Insufficent access rights for this project!'); } } if($_POST['save']){ $_POST['due_ts'] = getTSFromInput($_POST['due_ts']); $task->updateFromAssocArray($_POST); if($task->add() !== false){ if($project->sendUpdateNotification(array("Added task ".$_POST['name'])) === FALSE){ $error_msg .= "Error sending update notification!\n"; debug_message($project->getLastError()); } if($_POST['save'] != "Add"){ goBack();
require_once('includes/SI_Project.php'); require_once('includes/SI_Task.php'); require_once('includes/SI_TaskActivity.php'); require_once('includes/SI_PaymentSchedule.php'); checkLogin(); $project = new SI_Project(); $task = new SI_Task(); $ta = new SI_TaskActivity(); $activities = array(); if(!empty($_REQUEST['task_id'])){ $task->get($_REQUEST['task_id']); $project->get($task->project_id); if(!$project->hasRights(PROJECT_RIGHT_VIEW)){ fatal_error('Insufficent access rights for this project!'); } $activities = $ta->retrieveSet("task_id = ".$task->id); if($activities === FALSE){ $error_msg .= "Error getting list of task time!\n"; debug_message($ta->getLastError()); } }else{ fatal_error("Task ID must be supplied!\n"); } $my_url = $_SERVER['PHP_SELF']."?task_id=".$task->id."&"; $_REQUEST['detail'] = strtolower(substr($_REQUEST['detail'],0,1)) == "y" ? TRUE : FALSE;
function soap_add_task_activity($username, $password, $task_activity) { global $loggedin_user; $user = auth_user($username, $password); if ($user === FALSE) { return new soap_fault('Client', '', 'Access Denied'); } $loggedin_user = $user; $task = new SI_Task(); $project = new SI_Project(); $item_code = new SI_ItemCode(); $ta = new SI_TaskActivity(); $ta->start_ts = $task_activity['start_ts']; $ta->end_ts = $task_activity['end_ts']; $ta->task_id = $task_activity['task_id']; $ta->user_id = $loggedin_user->id; $ta->text = $task_activity['text']; $ta->item_code_id = $task_activity['item_code_id']; if ($ta->task_id > 0 || $ta->start_ts > 0 || $ta->end_ts > 0) { if ($ta->task_id <= 0 || $ta->start_ts <= 0 || $ta->end_ts <= 0) { return new soap_fault('Client', '', 'Invalid data fields in task_activity'); } } if ($task->get($ta->task_id) === FALSE) { return new soap_fault('Client', '', 'Could not retreive task ID ' . $ta->task_id, $task->getLastError()); } if ($project->get($task->project_id) === FALSE) { return new soap_fault('Client', '', 'Could not retreive project!', $project->getLastError()); } if (!$project->hasRights(PROJECT_RIGHT_EDIT)) { return new soap_fault('Client', '', 'Insufficent access rights for this project!'); } $ta->hourly_cost = $loggedin_user->hourly_rate; $company = $project->getCompany(); if ($company === FALSE) { return new soap_fault('Client', '', 'Could not get company information!', $project->getLastError()); } $ta->hourly_rate = $item_code->getCompanyPrice($company->id, $ta->item_code_id); if ($ta->hourly_rate === FALSE) { return new soap_fault('Client', '', 'Error getting price for this item code!', $item_code->getLastError()); } $sct = $task->getSalesCommissionType(); $ta->sales_com_type_id = $sct->id; if ($ta->add()) { $project->sendUpdateNotification(array("Added new task activity " . $GLOBALS['CONFIG']['url'] . '/task_activity.php?mode=edit&id=' . $task_activity->id)); } else { return new soap_fault('Client', '', 'Error adding Task Activity!', $ta->getLastError()); } return $ta->id; }