Hi All,
I'm trying to display a custom product field in QLI, So I made necessary changes. This particular field "total_number_c" should be a ReadOnly in QLI, So I made the following change:
src/custom/modules/Products/clients/base/views/quote-data-group-list/quote-data-group-list.php
array(
'name' => 'total_number_c',
'readonly' => true,
'label' => 'LBL_TOTAL_NUMBER',
),
src/custom/Extension/modules/Products/Ext/Vardefs/total_number_c.php
<?php
/**
* Total Number - custom db field
*/
$dictionary['Product']['fields']['total_number_c'] = array(
'audited' => true,
'calculated' => false,
'cols' => '',
'comments' => 'Total Number',
'default' => '',
'dependency' => '',
'duplicate_merge_dom_value' => '0',
'duplicate_merge' => 'disabled',
'help' => '',
'len' => '255',
'massupdate' => false,
'merge_filter' => 'disabled',
'name' => 'total_number_c',
'no_default' => false,
'reportable' => true,
'required' => false,
'rows' => '',
'size' => '255',
'source' => 'custom_fields',
'studio' => 'visible',
'type' => 'varchar',
'unified_search' => false,
'vname' => 'LBL_TOTAL_NUMBER',
);
Dependencies:
Note: This issue is not occurring if we remove the dependencies below.
src/custom/Extension/modules/Products/Ext/Dependencies/magaging_business_rules.php
<?php
$dependencies['Products']['magaging_rules'] = array(
'hooks' => array("edit", "view"),
'trigger' => 'true',
'onload' => true,
'actions' => array(
array(
'name' => 'SetRequired',
'params' => array(
'target' => 'total_number_c',
'label' => 'LBL_TOTAL_NUMBER',
'value' => 'isInList(related($quotes,"managing_c"), createList("one","two"))',
),
),
array(
'name' => 'SetVisibility',
'params' => array(
'target' => 'total_number_c',
'label' => 'LBL_TOTAL_NUMBER',
'value' => 'isInList(related($quotes,"managing_c"), createList("one","two"))',
),
),
),
);
With the above changes, the field is ReadOnly in Quote Record view / Edit View but during Quote create the field changes to an editable field. Refer to the image below.
Quote Edit View:
Quote Create View:
If the QLI was a subpanel I could create a create-view-subpanel to solve this issue, but I'm not sure how to make the field read-only.