Results 1 to 1 of 1

Thread: Adding a custom field to PopupDocument

  1. #1
    john.phortse is offline Member
    Join Date
    Sep 2009
    Posts
    9

    Default Adding a custom field to PopupDocument

    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']; 
    PHP Code:
    $form->assign("ACCOUNT_C"get_select_options_with_id($app_list_strings['account_c'], $account_c)); 
    I noticed that in the /modules/Emails/PopupDocuments.php the $where is defined as follows:
    PHP Code:
    $where '';

    $where $popup->_get_where_clause(); 
    Customize the $where appears to be the issue. Studio generated the following $where as:

    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;

    In /modules/Emails/PopupDocuments.php I added the account_c dataLabel to filter on.
    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>
    I added this line to add the Account_C column to the list.
    HTML Code:
    <td valign="top" class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}">{DOCUMENT.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.

    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
    Attached Images Attached Images     

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Adding custom field
    By ArivoliGovindasamy in forum Help
    Replies: 4
    Last Post: 2009-07-04, 06:06 AM
  2. Adding Custom Field
    By mariodelzo in forum Help
    Replies: 2
    Last Post: 2008-03-26, 06:52 PM
  3. Error when adding custom field
    By arrigenna in forum Help
    Replies: 0
    Last Post: 2006-03-31, 05:26 PM
  4. Adding a custom field and its label
    By jonesre in forum Help
    Replies: 2
    Last Post: 2005-09-15, 09:38 AM
  5. Custom Field - Adding a LABEL
    By Belmann in forum Help
    Replies: 1
    Last Post: 2005-04-08, 01:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •