Subpanel doesn't link to parent record
Hi, again
I've successfully managed to make my custom subpanel (AccountSLAs) show in the Accounts detail view. Thing is, my 'quick create' and 'full form' in the subpanel do not automatically populate the related fields from the parent Accounts view (i.e. populate akkn_account and sla_account_name with accounts.id and accounts.name, respectively). I have, thus far, done the following:
1. Edited layout_defs.php and vardefs.php in the Accounts module to account for the relationship
2. Likewise, edited vardefs.php in AccountSLAs module
3. edited AccountSLA.php (bean file) to extend fill_in_additional_detail_fields() thus:
$query = "SELECT acc.id, acc.name FROM accounts AS acc, accountslas AS acc_sla WHERE acc.id=acc_sla.akkn_account AND acc_sla.id='$this->id' AND acc.dele\
ted=0";
$result = $this->db->query($query, true, "Error filling in additional detail fields");
$row = $this->db->fetchByAssoc($result);
if ($row != null) {
$this->sla_account_name = $row['name'];
$this->akkn_account = $row['id'];
} else {
$this->sla_account_name = '';
$this->akkn_account = '';
}
What am I missing?
JamesTM
OS: CentOS 5.2
Sugar: 5.1
Apache 2.2
PHP 5.1
MySQL 5
Bookmarks