SuiteCRM setting initial_filter of the aos_products popup - sugarcrm

I need to add a custom filter to the aos_products popup where you can choose the line items from the aos_quotes edit view.
What the filter should look like is equal to WHERE aos_procucts_cstm.remaining_capacity_c > 0.
What I have so far is in editviewdefs.php of the aos_product module:
array(
'name' => 'remaining_capacity_c',
'label' => 'LBL_RESTKAPAZITAET',
'displayParams' =>
array(
'initial_filter' => array(
'&remaining_capacity_c > 0',
),
),
),
but this does not work as intended. I believe that it is not possible to set up the filter like I did. So any suggestions are highly appreciated.

Following below steps:
remaining_capacity_c needs to be a field type that where you can "Enable Range Search" in studio. So I would suggest using "Integer" type in this case.
Second, you will need to add the field into the popup search definition.
you will need to set the variables required to do a range search.
Example:
'initial_filter' => array(
'&remaining_capacity_c_advanced_range_choice=greater_than&range_remaining_capacity_c_advanced=0&start_range_remaining_capacity_c_advanced=&end_remaining_range_capacity_c_advanced=',
),
EDIT
You can use the keys found in date_range_search_dom dropdown. just set the [fieldname]_advanced_range_choice to one of the keys and range_[fieldname]_advanced to the value you wish to compare. When you wish to edit the start and end. You need to specify the start_range_[fieldname]_advanced and end_range_[fieldname]_advanced values.

Related

How to add custom action button in suiteCRM module sub panel list?

I need some suggestion in my suite CRM module integration.
I have a sub-panel in one of my modules and required to add one more edit button to redirect to a custom form to take some input from the user for each row separately.
Below is a sample image of my sub-panel list view.
In the above image on click of the edit button of a row, there is a remove button, I want to add one more custom button after remove and need to redirect from there to my new form.
I have checked some of forums and blogs but didn't found the solution.
To add a button you will need to modify the metadata of that sub-panel. In metadata, you will see the following code for the Edit and Remove buttons:
'edit_button' =>
array (
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'module' => 'Contacts',
'width' => '5%',
'default' => true,
),
'remove_button' =>
array (
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'Contacts',
'width' => '5%',
'default' => true,
),
You can add your new button using same array syntax. As you can see that every button use specific widget class(defined as widget_class) therefore you will need to add new widget_class class for that. You can find existing widget classes in this folder: include/generic/SugarWidgets.
Cheers!

Drupal 8 - Entity Reference - Autocomplete - Add fields to search and result in autocomplete

I have an entity called "lawyers."
And another entity refers to lawyers.
The problem is that when searching the reference field with the autocompletion system many repeated names appear:
Pablo
Pablo
Pablo
Pablo
I need the reference field to be able to show the surnames of that person so that it turns out to be
Pablo Martínez
Paglo Gutirerrez
Pablo Iglesias
Pablo López
how can I do this?
You will have to create a Entity Reference View to use as handler for doing the autocomplete lookup. Then you can add additional fields (such as last name) to the autocomplete results. This article outlines that process well enough:
https://www.cmsminds.com/blog/entity-reference-entity-reference-view-in-drupal-8/
If the field is a base field and is not available on the Manage form Display page, you will have to modify the entity class Lawyer::baseFieldDefinitions function. Specifically, you need to change the handler and set the form display settings. In your BaseFieldDefinition::create call:
->setSetting('handler', 'default')
Needs to change to this:
->setSetting('handler', 'views')
->setSetting('handler_settings', [
'view' => [
'view_name' => 'name_of_entity_reference_view',
'display_name' => 'name_of_view_display',
],
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 2,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
],
])
Alternatively, if you want to make base fields available in the UI, you can use this line to make the field available in the form display settings ui (and then export your form display settings as config:
->setDisplayConfigurable('form', TRUE);

How to change the default order of the sub panels in the opportunities module

I have a need to change the default order of the sub panels in the opportunities module. I have been looking for a solution for a while and have not found a solution that works.
I am using SugarCRM CE 6.5.13
Thanks in advance.
Your question is actually unclear. Are you asking for the order of a subpanel meaning how to place one subpanel above another. Or is your question concerning the order of the data inside a subpanel?
A fast response to both is:
in {MainModule}/metadata/subpaneldefs.php there should be the sort order declared for the subpanel like this:
$layout_defs[{MainModule}] = array(
// list of what Subpanels to show in the DetailView
'subpanel_setup' => array(
'{TheSubpanel}' => array(
'order' => 1, // influences the place of the subpanel relative to the other subpanels
'module' => '{TheSubpanel}',
'subpanel_name' => 'default', // attention please check the subpanel module to make sure there is not another setting overriding this setting
'sort_order' => 'desc',
'sort_by' => 'date_entered',
...
check also the file defined above that contains the subpanels fields. In this case it can be found in {TheSubpanel}/metadata/subpanels/default.php
$module_name = '{TheSubpanel}';
$subpanel_layout = array(
'top_buttons' => array(
'where' => '',
'sort_order' => 'desc',
'sort_by' => 'date_entered',
Please consider that after a change you need to run 'rebuild & repair' and if you manually clicked on a sort field then you should clear your cookie cache and log in again too.
There are other questions on stack overflow concering this like how-to-change-default-sort-in-custom-subpanel-sugarcrm
If you do not want code level customization then you can just drag and drop the sequence of subpanels on detail view of record. The sequence of subpanel will be saved.

how to have default label class, but different text per input in cakephp 2.x

I know you can define inputDefaults in the Form->create function, but if I define the label class there, and set the text in the individual Form->input function, the class option is removed. Is there any way around this or do I have to re-define the label option completely?
Yes, you've to redefine the label option completely.
$this->Form->input('name', array(
'label' => array(
'text' => __('label-text'),
'class' => 'label-class'
)
));
your default options are overridden by the options that you've specified for the input method of form helper.
For more information check __parseOptions

Restrict output of typo3 extbase backend module

I wrote a backendmodule with extbase in typo3 4.5 and I would like to show different extbase models for different usergroups, but I don't know how. My idea was to register one backendmodul per usergroup, but i think its too laborious. I don't want to check the user group and their rights in my extension. Is there a way to get this?
Example:
models | usergroup: editor could see
specific models | usergroup: specific_editor could see
Please explain the scenario in details. From this i can say this is possible . All you do see to check the user group and according to this you can create a switchable actions in your controller .
What about having a few checkboxes in extension manager - extension configuration tab for selecting the user group and their rights in your extension?
I try to show different extbase-model-entries to different users in my own backend-modul. For example user 'editor' only see 'entry1' and 'special_editor' see 'entry2' and 'entry3'. My idea was to extend the usergroup tca and add a selectfield for my models. My backend-modul will check the current backenduser to get his usergroup and than i want to check the assigned model. It seems to be laborious, but i think its the best and the only way.
I get one solution:
At first i add a field to be_users.
$tempColumns = array(
'model' => array(
'exclude' => 0,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:extensionResources/Private/Language/locallang_db.xml:tx_extension_domain_model_ownmodel',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_extension_domain_model_ownmodel',
'size' => 10,
'width' => 20,
'minitems' => 0,
'maxitems' => 9999,
'allowNonIdValues' => 0,
'eval' => 'required',
),
),
);
t3lib_div::loadTCA('be_users');
t3lib_extMgm::addTCAcolumns('be_users',$tempColumns,1);
t3lib_extMgm::addToAllTCAtypes('be_users','model;;;;1-1-1');
in my backend-modul i check the current backenduser
$GLOBALS['BE_USER']->user['model']
so i get a list of my modelids separated by commas.
thats it.