hi
i have created a custom module named aaa_cdr which has a one to may relationship with the account module .for this relationship both modules use custom key's aaa_cdr uses userid and account uses jbilling_id for the relationship.
when ever i try to show the subpanel for account the primary key of account is used instead of the my custom field. so far i'v haven't come across any similar cases .
hers my account vardef :
$dictionary['Account']['fields']['cdr'] = array (
'name' => 'cdr',
'type' => 'link',
'id_name' => 'jbilling_id',
'relationship' => 'aaa_account_cdr',
'module' => 'aaa_Cdr',
'bean_name' => 'aaa_Cdr',
'source' => 'non-db',
'vname' => 'LBL_AAA_CDR',
'join_name' =>'aaa_account_cdr',
);
$dictionary['Account']['relationships']['aaa_account_cdr'] = array (
'lhs_module' => 'Accounts',
'lhs_table' => 'accounts',
'lhs_key' => 'jbilling_id',
'rhs_module' => 'aaa_Cdr',
'rhs_table' => 'aaa_cdr',
'rhs_key' => 'userid',
'relationship_type' => 'one-to-many',
'join_table' => 'aaa_cdr',
'join_key_lhs' => 'jbilling_id',
'join_key_rhs' => 'userid',
);
and heres the query that it generates :
SELECT aaa_cdr.id , aaa_cdr.id , aaa_cdr.trans_dttm , aaa_cdr.callednum , aaa_cdr.destination , aaa_cdr.duration , aaa_cdr.ratedamount , 'aaa_cdr' panel_name FROM aaa_cdr where ( aaa_cdr.userid= '5351b95a-68af-a4c1-dbec-4a4454ef7797' AND aaa_cdr.deleted=0) AND aaa_cdr.deleted=0 ORDER BY aaa_cdr.id desc
the underscored value is the value for account id instead of jbilling_id.
how can i tell sugar to use the custom field (jbilling_id) instead off the primary key(id)?
thanks in advance.


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks