Hi all,
my problem was to use custom field (dropdown multiple) in account module to be used in searching contacts to create target list (popupPicker.html): finally i did it!
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 you array orginal array
$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']
)
);
go to ->
$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!
bye all
Marco


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks