Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Sub-Tasks for Project Tasks

  1. #1
    y2chuck is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    84

    Default Sub-Tasks for Project Tasks

    I'm trying to think of a way to track sub-tasks of a certain project task.

    For example, say I had a "Develop CRM system" project and one of the tasks was "create document module". I'd like to break the "create document module" into a bunch of sub-tasks. So the project tree would look like:

    Project: Develop CRM system
    Project Task: Create Document Module
    Sub task1: file upload tool
    Sub task2: categorization
    Sub task3: auto-experation of docs

    etc etc

    I was going to just create a custom field and create the sub-tasks as actual Project Tasks and then use the custom field to define what part of the project those tasks belong to. So in this case, I'd have 1 project, 3 Project tasks with "task type" of "create document module"

    I could then write some custom reports to pull the info out.

    Any suggestions or should I just try and add a "task" subpanel to the Project Task module?

  2. #2
    lvangool is offline Sugar Community Member
    Join Date
    Jul 2006
    Location
    Near Rotterdam, Holland
    Posts
    280

    Default Re: Sub-Tasks for Project Tasks

    You should create a parent_id field in the tasks table in the database. This is easy by editing vardefs.php and repairing the db from the Sugar admin. If you want to display the subtasks in a subpanel you should look at layout_defs.php.

    Also, the Sugar Wiki can ben useful to you. http://www.sugarcrm.com/wiki/

  3. #3
    y2chuck is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    84

    Default Re: Sub-Tasks for Project Tasks

    yeah, I've read the sub-panel how to a couple times, just not quite sure how to get it done as I'm not a REAL developer. I see there already is a parent_id in that table so I just added the "create task" (array('widget_class' => 'SubPanelTopCreateTaskButton'),) button on the Project task layout_defs file.

    Now I just need to figure out how to make the task show up on the Project Task screen. Think I'm on the right track tho. Thanks for the tip.

  4. #4
    cywolf's Avatar
    cywolf is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Toronto, Canada
    Posts
    223

    Default Re: Sub-Tasks for Project Tasks

    Actually, I think the parent_id that's already defined is a reference to the Project it belongs to. You probably want a new field for a parent Project Task.

    [Edit] I thought you were adding a field to Project Tasks - reusing the parent_id field on a Task would be appropriate.
    Last edited by cywolf; 2006-08-23 at 05:17 PM.
    Andrew Whitehead
    The Long Reach Corporation
    http://infoathand.com

  5. #5
    y2chuck is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    84

    Default Re: Sub-Tasks for Project Tasks

    Quote Originally Posted by cywolf
    Actually, I think the parent_id that's already defined is a reference to the Project it belongs to. You probably want a new field for a parent Project Task.
    right.......that's probably why I get ALL tasks when I view a project task.

    I followed the instructions in Ken's sub-panel tutorial and this is the relationship I defined in project_relationMetaData.php:

    'projects_tasks' => array('lhs_module'=> 'ProjectTask', 'lhs_table'=> 'project_task', 'lhs_key' => 'id',
    'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
    'relationship_type'=>'many-to-many',
    'join_table'=> 'project_relation', 'join_key_lhs'=>'project_id', 'join_key_rhs'=>'relation_id',
    'relationship_role_column'=>'relation_type','relat ionship_role_column_value'=>'task'),

    I still get all tasks showing up even though when I create the task, it shows as being associated with the project task. I did a rebuild relationships from the admin panel, but I don't see a record in the project_relation table that associates project tasks with tasks.

    I have this error in the log:

    Error fetching relationship from cache project_tasks

  6. #6
    cywolf's Avatar
    cywolf is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Toronto, Canada
    Posts
    223

    Default Re: Sub-Tasks for Project Tasks

    I think you're just trying to add a Tasks subpanel to Project Tasks, right? If so, you need to define a relationship like this in ProjectTask/vardefs.php. The definition is based on the existing relationships which are defined there, for linking to other Activity types. This uses the existing parent_type and parent_id fields on the Task to create the link.

    Code:
    ,'project_task_tasks' => array('lhs_module'=> 'ProjectTask', 'lhs_table'=> 'project_task', 'lhs_key' => 'id',
    		'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
    		'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
    		'relationship_role_column_value'=>'ProjectTask')
    You would then add a virtual field definition like this, which uses the relationship definition to define the list of related objects for the subpanel.

    Code:
    'tasks' => array (
      		'name' => 'tasks',
        		'type' => 'link',
        		'relationship' => 'project_task_tasks',
        		'source'=>'non-db',
    		'vname'=>'LBL_TASKS',
     ),
    Hope this helps.
    Andrew Whitehead
    The Long Reach Corporation
    http://infoathand.com

  7. #7
    y2chuck is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    84

    Default Re: Sub-Tasks for Project Tasks

    This is what I did:

    1) added the following code to /metadata/project_relationMetaData.php:

    'projects_tasks' => array('lhs_module'=> 'ProjectTask', 'lhs_table'=> 'project_task', 'lhs_key' => 'id',
    'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
    'relationship_type'=>'one-to-many',
    'join_table'=> 'project_relation', 'join_key_lhs'=>'project_id', 'join_key_rhs'=>'relation_id',
    'relationship_role_column'=>'relation_type','relat ionship_role_column_value'=>'ProjectTask'),

    2) added the following code to /modules/projecttask/vardefs.php:

    'tasks' =>array (
    'name' => 'tasks',
    'type' => 'link',
    'relationship' => 'project_tasks',
    'module' => 'Tasks',
    'source'=> 'non-db',
    'ignore_role' =>true,
    'vname'=> 'LBL_Tasks',
    ),

    3) added the following code to /modules/projecttask/layout_defs.php:

    array('widget_class' => 'SubPanelTopCreateTaskButton'), \\so I get the "create task" button under activities

    4) added LBL_Tasks in the language file

    5) rebuilt relationships in the admin panel.

    I just get all tasks showing up under every project task. I did try creating a meeting under project task and it only shows up under the proper project task so I think my relationship info is not correct. Isn't there supposed to be an entry in the project_relation table since that's what I specified

  8. #8
    y2chuck is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    84

    Default Re: Sub-Tasks for Project Tasks

    aha!!!!!! got it. Thanks cywolf. When I added the relationship info to the vardefs.php page, it worked. I guess the metadata file I edited wasn't the right one to use.

  9. #9
    realrene is offline Junior Member
    Join Date
    Aug 2006
    Posts
    4

    Default Re: Sub-Tasks for Project Tasks

    I tried Posting #6 from cywolf but nothing happend.

    I inserted

    ,'project_task_tasks' => array('lhs_module'=> 'ProjectTask', 'lhs_table'=> 'project_task', 'lhs_key' => 'id',
    'rhs_module'=> 'Tasks', 'rhs_table'=> 'tasks', 'rhs_key' => 'parent_id',
    'relationship_type'=>'one-to-many', 'relationship_role_column'=>'parent_type',
    'relationship_role_column_value'=>'ProjectTask')

    and

    'tasks' => array (
    'name' => 'tasks',
    'type' => 'link',
    'relationship' => 'project_task_tasks',
    'source'=>'non-db',
    'vname'=>'LBL_TASKS',
    ),

    in modules/ProjektTask/vardefs.php.

    After that, I rebuilded the relationship. But as I say, nothing happend. Whats to do now?

    I use Sugar 4.2.1a with german language pack.

    Thanks for help!

  10. #10
    y2chuck is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    84

    Default Re: Sub-Tasks for Project Tasks

    are there any errors in the log files?

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •