Results 1 to 2 of 2

Thread: Mambo - See member cases

  1. #1
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Mambo - See member account's cases

    Anyone know of a way to get member account's cases to show up when you log into Mambo?

    So if John Doe was a member of the account XYZ and had a case and Sally Seasoning was a member of account ABC Sally would be able to see John Doe's case if XYZ was a member account of ABC.
    Last edited by eggsurplus; 2006-03-23 at 04:33 PM.

  2. #2
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Mambo - See member cases

    To do this you need to edit soap\SoapPortalHelper.php and change the query to return the user's child accounts as well:

    PHP Code:
    function get_accounts_from_contact($contact_id$orderBy '')
    {
                    
    // First, get the list of IDs.
            
    $query "SELECT account_id as id from accounts_contacts where contact_id='$contact_id' AND deleted=0"
                    
    ." UNION "
                    
    ."SELECT a2.id from accounts_contacts c "
                    
    ."inner join accounts a on c.account_id = a.id "
                    
    ."inner join accounts a2 on a.id = a2.parent_id "
                    
    ."where c.contact_id='$contact_id'  "
                    
    ."AND c.deleted=0 AND a.deleted = 0 AND a2.deleted = 0 ";
            if(!empty(
    $orderBy)){
                
    $query .= ' ORDER BY ' $orderBy;
            }
            
    $sugar = new Contact();

            
    set_module_in($sugar->build_related_in($query), 'Accounts');

    This will cause a problem when creating a new case now though because it will create the new case an attach it to contact's child account instead of the contact's direct account. To work around that edit this portion to set the account_id as the first id in the list:
    PHP Code:
    function set_module_in($arrayList$module_name){

            if(!isset(
    $_SESSION['viewable'][$module_name])){
                
    $_SESSION['viewable'][$module_name] = array();
            }
            
    /** [IC] 2006/03/23 - get first id as the main account id */
            
    $first_id "-1";
            foreach(
    $arrayList['list'] as $id){
                if(
    $first_id == "-1"$first_id $id;
                
    $_SESSION['viewable'][$module_name][$id] = $id;
            }
            if(
    $module_name == 'Accounts' && isset($first_id)){
                
    $_SESSION['account_id'] = $first_id;
            } 
    Next up is to be able to select from a dropdown which account to create a case for.

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
  •