Exemplo n.º 1
0
 /**
  * Test deleting a tasklog
  *
  */
 public function testDelete()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $this->assertTrue($result);
     $original_id = $this->obj->task_log_id;
     $result = $this->obj->delete();
     $item = new CTask_Log();
     $item->overrideDatabase($this->mockDB);
     $this->mockDB->stageHash(array('task_log_name' => '', 'task_log_description' => ''));
     $item->load($original_id);
     $this->assertTrue(is_a($item, 'CTask_Log'));
     $this->assertEquals('', $item->task_log_name);
     $this->assertEquals('', $item->task_log_description);
     //TODO: figure out a way to test the CTask cascading totals
     //TODO: figure out a way to test the CProject cascading totals
 }
Exemplo n.º 2
0
global $AppUI, $obj, $percent, $can_edit_time_information, $cal_sdf;
$task = $obj;
$task_log_id = (int) w2PgetParam($_GET, 'task_log_id', 0);
$AppUI->loadCalendarJS();
// check permissions
$perms =& $AppUI->acl();
$canEditTask = $perms->checkModuleItem('tasks', 'edit', $obj->task_id);
$canViewTask = $perms->checkModuleItem('tasks', 'view', $obj->task_id);
$canEdit = canEdit('task_log');
$canAdd = canAdd('task_log');
$log = new CTask_Log();
if ($task_log_id) {
    if (!$canEdit || !$canViewTask) {
        $AppUI->redirect('m=public&a=access_denied');
    }
    $log->load($task_log_id);
} else {
    if (!$canAdd || !$canViewTask) {
        $AppUI->redirect('m=public&a=access_denied');
    }
    $log->task_log_task = $obj->task_id;
    $log->task_log_name = $obj->task_name;
}
$project = new CProject();
$project->load($obj->task_project);
$bcode = new CSystem_Bcode();
$companyBC = $bcode->getBillingCodes($project->project_company);
$neutralBC = $bcode->getBillingCodes(0);
$taskLogReference = w2PgetSysVal('TaskLogReference');
$billingCategory = w2PgetSysVal('BudgetCategory');
// Task Update Form