public function testsave()
 {
     $projectTask = new ProjectTask();
     $projectTask->name = 'test';
     //$projectTask->project_id = "1";
     $projectTask->assigned_user_id = '1';
     $projectTask->description = 'test description';
     $projectTask->parent_task_id = 1;
     $projectTask->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($projectTask->id));
     $this->assertEquals(36, strlen($projectTask->id));
     //test _get_depends_on_name method
     $this->_get_depends_on_name($projectTask->id);
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $projectTask->mark_deleted($projectTask->id);
     $result = $projectTask->retrieve($projectTask->id);
     $this->assertEquals(null, $result);
 }
Beispiel #2
0
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/
$sugarbean = new ProjectTask();
// perform the delete if given a record to delete
if (empty($_REQUEST['record'])) {
    $GLOBALS['log']->info('delete called without a record id specified');
} else {
    $record = $_REQUEST['record'];
    $sugarbean->retrieve($record);
    if (!$sugarbean->ACLAccess('Delete')) {
        ACLController::displayNoAccess(true);
        sugar_cleanup(true);
    }
    $GLOBALS['log']->info("deleting record: {$record}");
    $sugarbean->mark_deleted($record);
}
// handle the return location variables
$return_module = empty($_REQUEST['return_module']) ? 'ProjectTask' : $_REQUEST['return_module'];
$return_action = empty($_REQUEST['return_action']) ? 'index' : $_REQUEST['return_action'];
$return_id = empty($_REQUEST['return_id']) ? '' : $_REQUEST['return_id'];
$return_location = "index.php?module={$return_module}&action={$return_action}";
// append the return_id if given
if (!empty($return_id)) {
    $return_location .= "&record={$return_id}";
Beispiel #3
0
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/
$project = new ProjectTask();
if (!empty($_POST['record'])) {
    $project->retrieve($_POST['record']);
}
////
//// save the fields to the ProjectTask object
////
if (isset($_REQUEST['email_id'])) {
    $project->email_id = $_REQUEST['email_id'];
}
require_once 'include/formbase.php';
$project = populateFromPost('', $project);
if (!isset($_REQUEST['milestone_flag'])) {
    $project->milestone_flag = '0';
}
$GLOBALS['check_notify'] = false;
if (!empty($_POST['assigned_user_id']) && $project->assigned_user_id != $_POST['assigned_user_id'] && $_POST['assigned_user_id'] != $current_user->id) {
    $GLOBALS['check_notify'] = true;
Beispiel #4
0
 function getAllProjectTasks()
 {
     $projectTasks = array();
     $query = "SELECT * FROM project_task WHERE project_id = '" . $this->id . "' AND deleted = 0 ORDER BY project_task_id";
     $result = $this->db->query($query, true, "Error retrieving project tasks");
     $row = $this->db->fetchByAssoc($result);
     while ($row != null) {
         $projectTaskBean = new ProjectTask();
         $projectTaskBean->id = $row['id'];
         $projectTaskBean->retrieve();
         array_push($projectTasks, $projectTaskBean);
         $row = $this->db->fetchByAssoc($result);
     }
     return $projectTasks;
 }
Beispiel #5
0
$sugarbean = new Project();
$sugarbean = populateFromPost('', $sugarbean);
$projectTasks = array();
if (isset($_REQUEST['duplicateSave']) && $_REQUEST['duplicateSave'] === "true") {
    $base_project_id = $_REQUEST['relate_id'];
} else {
    $base_project_id = $sugarbean->id;
}
if (isset($_REQUEST['save_type']) || isset($_REQUEST['duplicateSave']) && $_REQUEST['duplicateSave'] === "true") {
    $query = "SELECT id FROM project_task WHERE project_id = '" . $base_project_id . "' AND deleted = 0";
    $result = $sugarbean->db->query($query, true, "Error retrieving project tasks");
    $row = $sugarbean->db->fetchByAssoc($result);
    while ($row != null) {
        $projectTaskBean = new ProjectTask();
        $projectTaskBean->id = $row['id'];
        $projectTaskBean->retrieve();
        $projectTaskBean->date_entered = '';
        $projectTaskBean->date_modified = '';
        array_push($projectTasks, $projectTaskBean);
        $row = $sugarbean->db->fetchByAssoc($result);
    }
}
if (isset($_REQUEST['save_type'])) {
    $sugarbean->id = '';
    $sugarbean->assigned_user_id = $current_user->id;
    if ($_REQUEST['save_type'] == 'TemplateToProject') {
        $sugarbean->name = $_REQUEST['project_name'];
        $sugarbean->is_template = 0;
    } else {
        if ($_REQUEST['save_type'] == 'ProjectToTemplate') {
            $sugarbean->name = $_REQUEST['template_name'];
Beispiel #6
0
 public function testResourceName()
 {
     $processingTask = $this->projectTasks['taskFive'];
     $processingTask->percent_complete = '65';
     $processingTask->save();
     $taskOne = new ProjectTask();
     $taskOne->retrieve($this->projectTasks['taskOne']->id);
     $this->assertEquals('22', $taskOne->percent_complete);
     $taskThree = new ProjectTask();
     $taskThree->retrieve($this->projectTasks['taskThree']->id);
     $this->assertEquals('33', $taskThree->percent_complete);
 }
Beispiel #7
0
 function update_task($id, $name, $start, $end, $project_id, $milestone_flag, $status, $predecessors, $rel_type, $duration, $duration_unit, $resource, $percent_complete, $description, $actual_duration)
 {
     $task = new ProjectTask();
     $task->retrieve($id);
     $task->name = $name;
     $task->date_start = $start;
     $task->date_finish = $end;
     $task->project_id = $project_id;
     $task->milestone_flag = $milestone_flag;
     $task->status = $status;
     // $task->parent_task_id = $parent_task_id;
     $task->predecessors = $predecessors;
     $task->relationship_type = $rel_type;
     $task->duration = $duration + 1;
     //+1 to make duration appear correct in project table
     $task->duration_unit = $duration_unit;
     $task->assigned_user_id = $resource;
     $task->percent_complete = $percent_complete;
     $task->actual_duration = $actual_duration;
     $task->description = $description;
     $task->save();
 }
Beispiel #8
0
 public function testResourceName()
 {
     $processingTask = $this->projectTasks['firstChildTask'];
     $processingTask->percent_complete = $this->newPercentValue;
     $processingTask->save();
     /**
      * New method testing
      */
     $processingTask->updateParentProjectTaskPercentage();
     $testparentTask = new ProjectTask();
     $testparentTask->retrieve($this->projectTasks['parentTask']->id);
     $average = $this->countAverage(array($this->newPercentValue, $this->projectTasks['secondChildTask']->percent_complete));
     $this->assertEquals($average, $testparentTask->percent_complete);
 }
require_once 'modules/ProjectTask/ProjectTask.php';
require_once 'modules/ProjectTask/Forms.php';
require_once 'include/time.php';
global $timedate;
global $app_strings;
global $app_list_strings;
global $current_language;
global $current_user;
global $sugar_version, $sugar_config;
// Unimplemented until jscalendar language files are fixed
// global $current_language;
// global $default_language;
// global $cal_codes;
$focus = new ProjectTask();
if (!empty($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->name, true);
echo "\n</p>\n";
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once $theme_path . 'layout_utils.php';
$GLOBALS['log']->info("ProjectTask detail view");
$xtpl = new XTemplate('modules/ProjectTask/EditView.html');
$xtpl->assign('MOD', $mod_strings);
$xtpl->assign('APP', $app_strings);
///
/// Populate the fields with existing data
///