Results 1 to 5 of 5

Thread: My Project Task in Sugar 4.5 bug!

  1. #1
    bennn is offline Sugar Community Member
    Join Date
    Oct 2005
    Posts
    64

    Default My Project Task in Sugar 4.5 bug!

    I've edited the my project task dashlet and make it show the project name of the project task. But it didn't show the name of project. Is it a bug of Sugar 4.5 GA?

  2. #2
    savyn is offline Member
    Join Date
    Jul 2006
    Posts
    8

    Default Re: My Project Task in Sugar 4.5 bug!

    Hi Everyone,

    Exact same problem. Would be grateful if someone can point us to a fix.

    thks
    savyn

  3. #3
    Eprst is offline Junior Member
    Join Date
    Oct 2006
    Posts
    1

    Default Re: My Project Task in Sugar 4.5 bug!

    any ideas ?

  4. #4
    ruchida's Avatar
    ruchida is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Feb 2005
    Location
    Japan
    Posts
    1,375

    Default Re: My Project Task in Sugar 4.5 bug!

    In modules/ProjectTask/Dashlets/MyProjectTaskDashlet/MyProjectTaskDashlet.data.php,

    replace;
    PHP Code:
    'parent_name' => array('width' => '15',
              
    'label' => 'LBL_PROJECT_NAME',
              
    'sortable' => false), 
    with;
    PHP Code:
    'parent_name' => array('width' => '29'
              
    'label' => 'LBL_PROJECT_NAME',
              
    'sortable' => false,
              
    'link' => true,
              
    'id' => 'parent_id',
              
    'ACLTag' => 'PARENT',
              
    'related_fields' => array('parent_id')), 
    then go to Admin->Repair and run Repair Dashlets.

    Filed as a bug#9693.
    Ryuhei Uchida
    Help Forum Moderator
    Calendar 2.0
    http://blogs.itmedia.co.jp/ruchida/

  5. #5
    frb
    frb is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    79

    Default Re: My Project Task in Sugar 4.5 bug!

    Hi,

    Luckily I found this very useful post :-)

    I am confused by the way relationships are working in Sugar, and I have the feeling to implement those 3 or 4 times:

    1) one defines a vardefs with a link and basically a left join query

    2) in the bean file, you define additional detail functions...
    and that what is also done in the ProjectTask.php file

    ==> the trick is if you comment out the get_parent_name line in fill_in_additional_list_fields , you then get the dashlet working (that's another work-around to fix the issue mentioned above)... but you lose the parent_name in the ProjectTask list.

    3) and on top of all that, the parent_name is also defined/used in the create_list_query

    4) and there's a get_parent_name function on top of that

    I am in the process of creating a TimeSheet module, and I basically stumble accross those definitions and how to make all this work at the same time ideally. I think I got the solution thanks to this thread... but that's seriously convoluted.

    Anyone with some lights on this topic? I suspect some code consolidation would help to make this all 'consistent'.

    Regards,

    Franck

    PS:
    1) vardefs.php for the link

    'employee_id' => array (
    'name' => 'employee_id',
    'vname' => 'LBL_EMPLOYEE_ID',
    'type' => 'id',
    'required'=>true,
    'reportable'=>false,
    ),

    'employee_name' => array (
    'name' => 'employee_name',
    'rname' => 'employee_name',
    'fields' => array('first_name','last_name'),
    'db_concat_fields'=> array(0=>'first_name', 1=>'last_name'),
    'id_name' => 'employee_id',
    'vname' => 'LBL_EMPLOYEE_NAME',
    'type' => 'relate',
    'join_name' => 'employees',
    'table' => 'users',
    'isnull' => 'false',
    'audited'=>true,
    'module'=>'Employees',
    'link'=>'employee_name_link',
    'massupdate'=>false,
    'source'=>'non-db',
    ),

    'employee_name_link' => array (
    'name' => 'employee_name_link',
    'type' => 'link',
    'relationship' => 'timesheet_employees',
    'vname' => 'LBL_EMPLOYEE_NAME',
    'link_type' => 'one',
    'module'=>'Employees',
    'bean_name'=>'Employee',
    'source'=>'non-db',
    ),

    2) ProjectTask.php : additional detail functions

    /**
    * Used to pick up the information from related objects (users, employee, ...) for DETAIL view
    */
    function fill_in_additional_detail_fields()
    {
    $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
    $this->employee_name = $this->get_employee_name($this->employee_id);
    }

    /**
    * Used to pick up the information from related objects (users, employee, ...) for LIST view
    */
    function fill_in_additional_list_fields()
    {
    $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
    // $this->employee_name = $this->get_employee_name($this->employee_id);
    }

    3) ProjectTask.php

    /**
    * overriding the base class function to do a join with users table
    */
    function create_list_query($order_by, $where, $show_deleted = 0)
    {
    $custom_join = $this->custom_fields->getJOIN();

    $query = "SELECT users.user_name assigned_user_name, project.name parent_name, project.assigned_user_id parent_name_owner, project_task.*";

    4) ProjectTask.php

    /*
    *
    */
    function _get_parent_name($parent_id)
    {
    $return_value = '';

    $query = "SELECT name, assigned_user_id FROM project WHERE id='{$parent_id}'";
    $result = $this->db->query($query,true," Error filling in additional detail fields: ");
    $row = $this->db->fetchByAssoc($result);
    if($row != null)
    {
    $this->parent_name_owner = $row['assigned_user_id'];
    $this->parent_name_mod = 'Project';
    $return_value = $row['name'];
    }

    return $return_value;
    }

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
  •