First of all, I want to acknowledge the ease of using Studio and the productive it provides. Kudo's to the Sugar team!
My question or feature request, is how can you add a custom field to PopupDocuments.
Scenario: I want to relate multiple documents from the Document Module to an Account and then be able to attach these Documents from the Email Module filtering on Accounts.
For example, in Studio I created a custom field in the document module - account_c (LBL_ACCOUNT) and added it to my EditView, DetailedView, ListView and Basic Search. I then created a relationship in the Accounts Module creating a many-to-many relationship Accounts to Documents (see attached studio-account-documents-subpanel-mod.jpg) . EditView (see attached studio-document-editview-mod.jpg ), DetailedView, ListView and Basic Search work fine.
Studio currently doesn't appear to support the customization of Popup/PopDocuments. I’m stuck on the modification required to make PopupDocuments.php, PopupDocuments.html and PopupDef.php to work so I can attach Document from Sugar Documents and filter on Accounts to attach to an email. Essentially, I want to provide the same functionality Studio created for the basic search mod I made allowing the ability to filter on account_c/type: relate (see attached studio-document-basic-search-mod.jpg).
In /modules/Emails/PopupDocuments.php I added:
PHP Code:$account_c = empty($_REQUEST['account_c']) ? '' : $_REQUEST['account_c'];
I noticed that in the /modules/Emails/PopupDocuments.php the $where is defined as follows:PHP Code:$form->assign("ACCOUNT_C", get_select_options_with_id($app_list_strings['account_c'], $account_c));
Customize the $where appears to be the issue. Studio generated the following $where as:PHP Code:$where = '';
$where = $popup->_get_where_clause();
In /modules/Emails/PopupDocuments.php I added the account_c dataLabel to filter on.PHP Code:function _get_where_clause()
{
$where = '';
if(isset($_REQUEST['query']))
{
$where_clauses = array();
append_where_clause($where_clauses, "account_c", "documents_cstm.account_c");
append_where_clause($where_clauses, "document_name", "documents.document_name");
append_where_clause($where_clauses, "category_id", "documents.category_id");
append_where_clause($where_clauses, "subcategory_id", "documents.subcategory_id");
append_where_clause($where_clauses, "template_type", "documents.template_type");
append_where_clause($where_clauses, "is_template", "documents.is_template");
$where = generate_where_statement($where_clauses);
}
return $where;
}
I added this line to add the Account_C column to the list.HTML Code:<td class="dataLabel" nowrap="nowrap">{MOD.LBL_ACCOUNT}</td> <td class="dataField" nowrap="nowrap"><input type="text" name="account_c" class="dataField" size="30" value="{ACCOUNT_C}"</td>
The remaining issue appears to remain in the modifications necessary to filter on accounts and then only list the documents associated with those accounts to then be able to attach to an email.HTML Code:<td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{DOCUMENT.ACCOUNT_C}</td>
From a feature request standpoint, it would be nice to be able to make mods to Popup's from Studio.
Any assistance on this feature request and/or in the meantime a tactical solution to address this feature would be greatly appreciated.
John
SugarCRM version 5.2.0i
Apache version 2.2.11 (Unix)
PHP version 5.2.9
MySQL version 5.0.77-community
Operating system Linux


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks