Results 1 to 4 of 4

Thread: Exporting Contacts associated with a Project

  1. #1
    janders0 is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    10

    Default Exporting Contacts associated with a Project

    Hello,

    I'm running Sugar 4.5.1 and I'd like to know if its possible to export the list of contacts that are associated with a Project. When I've tried the export I just get the project details and not the list of contacts which would be really useful,

    I think this would be possible by modifying the export query in project.php but am unsure of the SQL statement needed. Has anyone else done this and can they let me know what the create_export_query should be changed to?

    function create_export_query(&$order_by, &$where)
    {
    $custom_join = $this->custom_fields->getJOIN();
    $query = "SELECT
    project.*,
    users.user_name as assigned_user_name ";

    if($custom_join){
    $query .= $custom_join['select'];
    }
    $query .= "FROM project ";

    if($custom_join){
    $query .= $custom_join['join'];
    }
    $query .= " LEFT JOIN users
    ON project.assigned_user_id=users.id ";
    $where_auto = " project.deleted=0 ";

    if($where != "")
    $query .= "where ($where) AND ".$where_auto;
    else
    $query .= "where ".$where_auto;

    if(!empty($order_by)){
    //check to see if order by variable already has table name by looking for dot "."
    $table_defined_already = strpos($order_by, ".");

    if($table_defined_already === false){
    //table not defined yet, define accounts to avoid "ambigous column" SQL error
    $query .= " ORDER BY $order_by";
    }else{
    //table already defined, just add it to end of query
    $query .= " ORDER BY $order_by";
    }
    }
    return $query;

    Thanks very much,

    James

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Exporting Contacts associated with a Project

    Hi, James

    the create_export_query is just for exporting project itself.

    If you want to export the contacts related to a given project, you must create insert a Widget into Contacts Subpanel on Project.

    There is a topic about it in the forum.

    Cheers

    --
    André Lopes
    Lâmpada Global Services
    Rua Bela Cintra, 299 conjunto. 51
    São Paulo, SP 01415-000
    tel1. 55 11 3237-3110
    cel. 55 11 7636-5859
    e-mail: info@lampadacrm.com.br

  3. #3
    SamuelAugy is offline Sugar Community Member
    Join Date
    Sep 2007
    Location
    Paris (France)
    Posts
    238

  4. #4
    janders0 is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    10

    Smile Re: Exporting Contacts associated with a Project

    That's great, I'll try inserting the widgets. Thanks for your quick help and response I appreciate it

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 2007-12-06, 10:14 AM
  2. Project Tasks for Contacts
    By jimlyle in forum Feature Requests
    Replies: 0
    Last Post: 2007-06-27, 07:46 PM
  3. project <--> contact relationship confusing
    By mellamokb in forum Help
    Replies: 2
    Last Post: 2006-08-17, 11:47 PM
  4. Replies: 4
    Last Post: 2005-07-25, 07:41 PM

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
  •