Showing the correct currency symbol in a subpanel

I am hoping someone can help me to get a currency field shown in a subpanel to use the correct currency symbol rather than the base currency unit. I am using the out of box opportunity and projects modules and, using Studio, have configured the projects module subpanel for Opportunities to show the revenue amount for the project. For my test Opportunity, I have associated the opportunity to a project with currency set to dollars. However, the project subpanel for the Opportunity shows the revenue as £ as this is the base currency. This seems like a bug to me as I would of thought the currency symbol should be the currency selected for the particular project.

You need to go to Admin -> Studio -> Projects -> Subpanels -> Opportunities and drag the field Opportunity Amount {amount} to the list view of the subpanels, this should show with the default currency of that particular opportunity

best regards

Thanks for responding. I have created a currency field in projects and when I add this field (Admin -> Studio -> Opportunities -> Subpanels -> Projects ) to the Opportunity sub-panel for projects the subpanel shows the currency in £ rather than the projects currency of $. I think this is the other way round to what you have explained and so I am sorry for not being clearer.

Ok, then you have to go to custom/modules/Project/metadata/subpanels/ and edit Opportunity_subpanel_project.php and at the end of the line add this

currency_id' =>
    array (
        'usage' => 'query_only',
),

you will have something like this

<?php
// created: 2016-06-06 14:14:09
$subpanel_layout['list_fields'] = array (
  'name' =>
  array (
    'vname' => 'LBL_LIST_NAME',
    'widget_class' => 'SubPanelDetailViewLink',
    'width' => '35%',
    'default' => true,
  ),
  'assigned_user_name' =>
  array (
    'vname' => 'LBL_LIST_ASSIGNED_USER_ID',
    'widget_class' => 'SubPanelDetailViewLink',
    'module' => 'Users',
    'target_record_key' => 'assigned_user_id',
    'target_module' => 'Users',
    'width' => '15%',
    'sortable' => false,
    'default' => true,
  ),
  'estimated_start_date' =>
  array (
    'vname' => 'LBL_DATE_START',
    'width' => '25%',
    'sortable' => true,
    'default' => true,
  ),
  'estimated_end_date' =>
  array (
    'vname' => 'LBL_DATE_END',
    'width' => '25%',
    'sortable' => true,
    'default' => true,
  ),
  'edit_button' =>
  array (
    'vname' => 'LBL_EDIT_BUTTON',
    'widget_class' => 'SubPanelEditButton',
    'module' => 'Project',
    'width' => '3%',
    'default' => true,
  ),
  'remove_button' =>
  array (
    'vname' => 'LBL_REMOVE',
    'widget_class' => 'SubPanelRemoveButton',
    'module' => 'Project',
    'width' => '3%',
    'default' => true,
  ),
  'amount_c' =>
  array (
    'type' => 'currency',
    'default' => true,
    'vname' => 'LBL_AMOUNT',
    'currency_format' => true,
    'width' => '10%',
  ),
  'currency_id' =>
  array (
    'usage' => 'query_only',
  ),
);

notice that my currency field is named “amoun” and I added it in studio in the Opportunities subpanel. After that run a quick repair & build and you will achieve what you need. This is totally upgrade safe.

best regards

2 Likes

Thanks Mike. That has worked a treat :cheer:

Mike,

One more question, is it possible to define which column in a subpanel the results are sorted on? For example, if I display a ‘Date Created’ field on a subpanel, can I via PHP force the subpanel to display the results in order of ‘Date Created’ ?

I can answer my own question about changing the sort order :slight_smile: Go to custom/Extension/modules/{module_name}/Ext/Layoutdefs/ and edit the PHP file for the particular supanel namely:

‘sort_order’ => ‘asc’,
‘sort_by’ => ‘planned_date’,

1 Like

thanks for replying to your own question, that’s important for the community.

best regards

how it can be done in list view

1 Like