示例#1
0
			fatal_error("Could not retreive task!");
			debug_message($task->getLastError());
		}
		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!');
		}
		
		$company =& $project->getCompany();
	}

	if($_POST['save']){
		if(!$task_activity->isPaid() && !$task_activity->isBilled()){
			if(isset($_POST['start_ts'])) $_POST['start_ts'] = getTSFromInput($_POST['start_ts']['date'], $_POST['start_ts']['time']);
			if(isset($_POST['end_ts'])) $_POST['end_ts'] = getTSFromInput($_POST['end_ts']['date'], $_POST['end_ts']['time']);
		}
		$hourly_rate = $item_code->getCompanyPrice($company->id, $_POST['item_code_id']);
		if($hourly_rate === FALSE){
			$error_msg = "Error getting price for this item code!";
			debug_message($item_code->getLastError());
		}
		$task_activity->hourly_rate = $hourly_rate;
		$task_activity->updateFromAssocArray($_POST);
		if($task_activity->update()){
			if(is_array($_POST['item_ids'])){
				if($task_activity->setItems($_POST['item_ids']) === FALSE){
					$error_msg .= "Error adding completed items to activity!\n";
					debug_message($task_activity->getLastError());