Results 1 to 7 of 7

Thread: relate field to show in listview and subpanel

  1. #1
    Join Date
    Feb 2009
    Posts
    13

    Default relate field to show in listview and subpanel

    I have two modules. Short Term and Interest Repayments. I created a 1-M relationship through modulebuilder and it automatically placed a relate style field in the Interest Repayments modules. the Short Term Relate style field that appears on the Interest Repayments EditView and DetailView. There is no field in the vardef files that has short_term_name or _id for the relate style field so i am wondering how i would go about adding this field to the ListView and Subpanel views.

    http://www.fsppp.com.au/sugar/example.jpg shows my scenario.

    If any one can point me in the direction of how i might accomplish listing the relate field in listview and subpanel would be greatly appreciated.

    Thanks

    Mark
    Last edited by marktaylor5151; 2009-03-05 at 05:48 AM.

  2. #2
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: relate field to show in listview and subpanel

    If you look at the vardefs your short term relate field actually consists of two fields
    short_term_name and short_term_id (or something like that).

    Simply try adding the short_term_name field to your listviewdefs.php (or listview in studio) and to the subpanel definition (modules/<module>/metadata/subpanels/default.php).

    And make sure that you have 'fill_in_additional_fields' => true in the subpanel definition.
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  3. #3
    Join Date
    Feb 2009
    Posts
    13

    Default Re: relate field to show in listview and subpanel

    Marnus,

    i checked the vardefs and there is nothing like that. I know when i have created previous relate fields manually through module builder the fields that you mention have come up. But in this instance i never created a relate field in module builder i just added a relationship through module builder and it created that short term relate style field. That field created by modulebuilder relationship function can be seen only in edit and viewdefs through module builder, there is not field available in listview.

    Does anyone have any other suggestions?

  4. #4
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: relate field to show in listview and subpanel

    Where have you checked?
    Bets place to make sure they exist is in cache/modules/<module>/<module>vardefs.php file replacing <module> with the module name.

    If they are NOT there then the fields do not exist! If they are then you should see one of them (the name) in studio when you edit layouts.

    M
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  5. #5
    Join Date
    Feb 2009
    Posts
    13

    Default Re: relate field to show in listview and subpanel

    I have most of it working thank you.


    http://www.fsppp.com.au/sugar/nwc_In...ntsvardefs.txt is the vardefs from the cache folder cache\modules\nwc_InterestRepayments\nwc_InterestR epaymentsvardefs.php


    There only sections i see relevant are


    'nwc_shortterm_nwc_interestrepayments' =>
    array (
    'name' => 'nwc_shortterm_nwc_interestrepayments',
    'type' => 'link',
    'relationship' => 'nwc_shortterm_nwc_interestrepayments',
    'source' => 'non-db',
    ),
    'nwc_shortterm_nwc_interestrepayments_name' =>
    array (
    'name' => 'nwc_shortterm_nwc_interestrepayments_name',
    'type' => 'relate',
    'source' => 'non-db',
    'vname' => 'LBL_NWC_SHORTTERM_NWC_INTERESTREPAYMENTS_FROM_NWC _SHORTTERM_TITLE',
    'save' => true,
    'id_name' => 'nwc_shortt3910ortterm_ida',
    'link' => 'nwc_shortterm_nwc_interestrepayments',
    'table' => 'nwc_shortterm',
    'module' => 'nwc_ShortTerm',
    'rname' => 'name',
    ),
    'nwc_shortt3910ortterm_ida' =>
    array (
    'name' => 'nwc_shortt3910ortterm_ida',
    'type' => 'link',
    'relationship' => 'nwc_shortterm_nwc_interestrepayments',
    'source' => 'non-db',
    ),
    ),



    Interest Repayments Module

    C:\wamp\www\test04c\custom\modulebuilder\packages\ nwc\modules\InterestRepayments\metadata\listviewde fs.php


    now has

    'NWC_SHORTTERM_NWC_INTERESTREPAYMENTS_NAME' =>
    array (
    'width' => '15%',
    'label' => 'LBL_NWC_SHORTTERM_NWC_INTERESTREPAYMENTS_FROM_NWC _SHORTTERM_TITLE',
    'module' => 'nwc_ShortTerm',
    'id' => 'nwc_shortt3910ortterm_ida',
    'widget_class' => 'SubPanelDetailViewLink',
    'link' => true,
    'default' => true,
    'ACLTag' => 'nwc_ShortTerm',
    'related_fields' => array('nwc_shortt3910ortterm_ida'),
    ),

    and now it lists the column that i wanted. http://www.fsppp.com.au/sugar/ScreenShot011.jpg

    Now when i click on this column i want it to take me to the short term module which it does but it rather than displaying the record it displays the error message 'Error retrieving record. This record may be deleted or you may not be authorized to view it.' http://www.fsppp.com.au/sugar/ScreenShot012.jpg


    is there something i am doing incorrectly that may rectified the error showing and actually display the short term record it relates to.


    the Interest Repayments Subpanel now has
    C:\wamp\www\test04c\custom\modulebuilder\packages\ nwc\modules\InterestRepayments\metadata\subpanels\ default.php

    'nwc_shortterm_nwc_interestrepayments_name' =>
    array(
    'name' => 'nwc_shortterm_nwc_interestrepayments_name',
    'module' => 'nwc_ShortTerm',
    'widget_class' => 'SubPanelDetailViewLink',
    'target_record_key' => 'nwc_shortt3910ortterm_ida',
    'target_module' => 'nwc_ShortTerm',
    'vname' => 'LBL_NWC_SHORTTERM_NWC_INTERESTREPAYMENTS_FROM_NWC _SHORTTERM_TITLE',
    width' => '10%',
    ),

    which displays the column in the subpanel on the short term module and when i click on the new column it takes me to the short term record. so that is working fine. http://www.fsppp.com.au/sugar/ScreenShot010.jpg

  6. #6
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: relate field to show in listview and subpanel

    PHP Code:
        // This is the NAME field
        
    'nwc_shortterm_nwc_interestrepayments_name' => 
        array (
          
    'name' => 'nwc_shortterm_nwc_interestrepayments_name',
          
    'type' => 'relate',
          
    'source' => 'non-db',
          
    'vname' => 'LBL_NWC_SHORTTERM_NWC_INTERESTREPAYMENTS_FROM_NWC_SHORTTERM_TITLE',
          
    'save' => true,
          
    'id_name' => 'nwc_shortt3910ortterm_ida',
          
    'link' => 'nwc_shortterm_nwc_interestrepayments',
          
    'table' => 'nwc_shortterm',
          
    'module' => 'nwc_ShortTerm',
          
    'rname' => 'name',
        ),
        
    // This is the ID
        
    'nwc_shortt3910ortterm_ida' => 
        array (
          
    'name' => 'nwc_shortt3910ortterm_ida',
          
    'type' => 'link',
          
    'relationship' => 'nwc_shortterm_nwc_interestrepayments',
          
    'source' => 'non-db',
        ),
      ), 
    PHP Code:
      'NWC_SHORTTERM_NWC_INTERESTREPAYMENTS_NAME' => 
      array (
        
    'width' => '15%',
        
    'label' => 'LBL_NWC_SHORTTERM_NWC_INTERESTREPAYMENTS_FROM_NWC_SHORTTERM_TITLE',
        
    'module' => 'nwc_ShortTerm',
        
    'id' => 'nwc_shortt3910ortterm_ida',
        
    'widget_class' => 'SubPanelDetailViewLink',
        
    'target_record_key' => 'nwc_shortt3910ortterm_ida',
        
    'target_module' => 'nwc_shortterm','
        '
    link' => true,
        '
    default' => true,
        '
    ACLTag' => 'nwc_ShortTerm',    
        '
    related_fields' => array('nwc_shortt3910ortterm_ida),      
      ), 
    Have a look at the target.... entries above - should work.
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  7. #7
    Join Date
    Feb 2009
    Posts
    13

    Default Re: relate field to show in listview and subpanel

    i inserted the following code in the listview and redepoloyed the module a few times

    PHP Code:
      'NWC_SHORTTERM_NWC_INTERESTREPAYMENTS_NAME' => 
      array (
        
    'width' => '15%',
        
    'label' => 'LBL_NWC_SHORTTERM_NWC_INTERESTREPAYMENTS_FROM_NWC_SHORTTERM_TITLE',
        
    'module' => 'nwc_ShortTerm',
        
    'id' => 'nwc_shortt3910ortterm_ida',
        
    'widget_class' => 'SubPanelDetailViewLink',
        
    'target_record_key' => 'nwc_shortt3910ortterm_ida',
        
    'target_module' => 'nwc_ShortTerm',
        
    'link' => true,
        
    'default' => true,     
      ), 
    I am still getting the error of the record being deleted or not having access to it. I am unsure if it is given the correct ID from the interest repayment module over to the short term module when i click on the column as it seems to have the same interest repayment id rather than the id that would match the short term, either that or there is some permission problem as it say, but i am able to view the short term module so there should not be a permission issue unless there is a spelling mistake in my code.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to let relate account show in subpanel show
    By eddiechen in forum Developer Help
    Replies: 2
    Last Post: 2009-02-20, 01:39 AM
  2. Custom Module Relate Field doesn't show on ListView
    By fxbrandon in forum Developer Help
    Replies: 5
    Last Post: 2008-10-04, 10:05 AM
  3. History Subpanel : how to show field in listview
    By jitchavan in forum Developer Help
    Replies: 1
    Last Post: 2008-07-16, 07:53 AM
  4. Replies: 0
    Last Post: 2008-07-16, 07:46 AM
  5. History Subpanel : howto add field in listview to show
    By jitchavan in forum General Discussion
    Replies: 0
    Last Post: 2008-07-16, 07:43 AM

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
  •