i have found this wiki , but doesn`t works because is for ver 4.5 and i have the last version..... do you know what changes have to make to do this wiki works in 5.0?????
this is thw wiki... is located at... http://www.sugarcrm.com/wiki/index.p...in_target_list
and have the next instructions...
Use custom field account to search contact in target list
From SugarCRM Wiki
This contribution try to explain how to use custom field (dropdown multiple) in account module in searching contacts to create target list (popupPicker.html).
* First of all you have to create a dropdown list, name it "test_list_dom";
* Then create a custom field in account module (use studio), name it "test_list" (the system will name it test_list_c") as multiple and use your test_list_dom as values;
* Now you have to modify 3 file: Popup_picker.html (in ./modules/Contacts/), popupdefs.php (in ./modules/Contacts/metadata/) and Contact.php (in ./module/Contacts/).
in Popup_picker.html you have to add
<td class="dataField">
<select name='test_list[]' size='5' title='{TEST_LIST_C_HELP}' MULTIPLE=true>{OPTIONS_TEST_LIST_C}
</select>
</td>
in popupdefs.php your orginal array is
$popupMeta = array(
'moduleMain' => 'Contact',
'varName' => 'CONTACT',
'orderBy' => 'contacts.first_name, contacts.last_name',
'whereClauses' =>
array('first_name' => 'contacts.first_name',
'last_name' => 'contacts.last_name',
'account_name' => 'accounts.name',
'account_id' => 'accounts.id'),
'searchInputs' =>
array('first_name', 'last_name', 'account_name'),
'create' =>
array('formBase' => 'ContactFormBase.php',
'formBaseClass' => 'ContactFormBase',
'getFormBodyParams' => array('','','ContactSave'),
'createButton' => $mod_strings['LNK_NEW_CONTACT']
)
);
you have to modify, the result is:
$popupMeta = array('moduleMain' => 'Contact',
'varName' => 'CONTACT',
'orderBy' => 'contacts.first_name, contacts.last_name',
'whereClauses' =>
array('first_name' => 'contacts.first_name',
'last_name' => 'contacts.last_name',
'account_name' => 'accounts.name',
'test_list'=>'accounts_cstm.test_list_c',
'account_id' => 'accounts.id'),
'selectDoms' => array('OPTIONS_TEST_LIST_C' =>
array('dom' => 'test_list_dom','searchInput' => 'test_list'),
),
'searchInputs' =>
array('first_name', 'last_name', 'account_name','test_list'),
'create' =>
array('formBase' => 'ContactFormBase.php',
'formBaseClass' => 'ContactFormBase',
'getFormBodyParams' => array('','','ContactSave'),
'createButton' => $mod_strings['LNK_NEW_CONTACT']
)
);
finally, you have to modify your Contact.php at line 328, function create_list_query :
$query .="LEFT JOIN users
ON contacts.assigned_user_id=users.id
LEFT JOIN accounts_contacts
ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0
LEFT JOIN accounts
ON accounts_contacts.account_id=accounts.id " .
//add this
" LEFT JOIN accounts_cstm on accounts_cstm.id_c=accounts.id";
//end add
Now you can use your custom field to filter contacts for your target list
a lot of thanks..... from spain


LinkBack URL
About LinkBacks




Reply With Quote
Bookmarks