Greetings,

Have been trying to get the Cases Module to be a little more streamlined and came across a few posts here on the forum that have been helpful so far. However I have been banging my head against a wall trying to figure out how to associate Cases to Accounts through Contacts instead of the email address that is associated with the Account.

I have been taking a look at this chunk for a while now:

Code:
                        if($accountIds = $this->getRelatedId($contactAddr, 'accounts')) {
                                if (sizeof($accountIds) == 1) {
                                        $c->account_id = $accountIds[0];

                                        $acct = new Account();
                                        $acct->retrieve($c->account_id);
                                        $c->account_name = $acct->name;
                                } // if
                        } // if
and this below it:

Code:
  if($contactIds = $this->getRelatedId($contactAddr, 'contacts')) {
                                if(!empty($contactIds) && $c->load_relationship('contacts')) {
                                        $c->contacts->add($contactIds);
                                } // if
                        } // if
After poking around in the database it would seemsomething along the lines of

Code:
Select accounts.id From accounts INNER JOIN accounts_contacts ON accounts.id = accounts_contacts.account_id where accounts_contacts.contact_id = {$contactIds[0]}
Would be workable but assigning anything like $c->account_id = $myvarID doesn't seem to work to well. Just started taking a look at this today and PHP is not my expertise, starting to wonder if this is harder than I am thinking it is?

Thanks for any input!