Exemple #1
0
     }
     $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();
     $task_activity->sales_com_type_id = $sct->id;
     if ($task_activity->add()) {
         if ($project->sendUpdateNotification(array("Added new task activity " . $GLOBALS['CONFIG']['url'] . '/task_activity.php?mode=edit&id=' . $task_activity->id)) === FALSE) {
             $output['error'] = "Error sending update notification:\n" . $project->getLastError();
             break;
         }
     } else {
         $output['error'] = "Error adding Task Activity:\n" . $task_activity->getLastError();
         break;
     }
     break;
 default:
     if (isset($action_map[$request->action])) {
         if (is_array($action_map[$request->action])) {
             if (class_exists($action_map[$request->action][0])) {
                 $class = new $action_map[$request->action][0]();
                 if (method_exists($class, $action_map[$request->action][1])) {
                     $result = call_user_func_array(array($class, $action_map[$request->action][1]), $params);
Exemple #2
0
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;
}
	}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();
			}
		}else{
			$error_msg .= "Error adding Task!\n";
		}
	}
}else if($_REQUEST['mode'] == 'edit'){
	$title = "Edit Task";
	if(empty($_REQUEST['id'])){
		$error_msg .= "Error: No ID specified!\n";
Exemple #4
0
					$error_msg .= "Error adding user access to project!\n";
					debug_message($project->getLastError());
				}else{
					$activities[] = "Added user right level {$_POST['right_level']} to ".SI_User::getUserName($_POST['right_user_id']);
				}
			}
			if(isset($_POST['new_cc_id']) && $_POST['new_cc_id'] > 0){
				if($project->addCC($_POST['new_cc_id']) === FALSE){
					$error_msg .= "Error adding new CC to project!\n";
					debug_message($project->getLastError());
				}else{
					$activities[] = "Added ".SI_User::getUserName($_POST['new_cc_id'])." to project CC list";
				}
			}

			if($project->sendUpdateNotification($activities) === FALSE){
				$error_msg .= "Error sending update notification!\n";
				debug_message($project->getLastError());
			}

			if(empty($error_msg) && $_POST['save'] == "Save"){
				goBack();
			}
		}else{
			$error_msg .= "Error updating Project!\n";
			debug_message($project->getLastError());
		}
	}
}else if($_REQUEST['mode'] == 'delete'){
	$title = "Delete Project";
	$project->id = $_REQUEST['id'];