sugarcrm globalsearch custom field - sugarcrm

I want to implement the Global search for the Leads for the Primary address field ,i
followed the folllowing steps following this link.
once that has been done i have done quick repair and rebuild but im not able to get the
result .Any more thing to be done?
created a new file named customGlobalSearchFields.php in /custom/Extension/modules/Leads/ext/Vardefs/
and added the code below:
$dictionary['Leads']['fields']['primary_address_street']['unified_search'] = true;
Also added custom\modules\Leads\metadata\SearchFields.php
'primary_address_street' =>
array (
'query_type' => 'default',
),

You have enabled the Leads module for Global Search, right?

Please try this code..
custom\modules\Leads\metadata\SearchFields.php
'primary_address_street' =>
array (
'query_type' => 'default',
'force_unifiedsearch'=>true
),
Banti Gehlot

Related

Sonata Admin Advance Filter Customization in DataGridFilter

I am using sonata admin for my project as backend.
I have a module and where i have status in the filter like below :
$datagridMapper->add('status', '', array('label' => 'Status','field_type' => 'choice','field_options' => array('choices'=> array('Complete' => 1, 'Pending' => 0,'Error' => 2))));
It is working fine but in advance filter I got arithmetic filters which looks weird for filtering functionality.
Here i attach that image how it looks like:
I want to remove that arithmetic filters and want to put my own there , OR i want to hide that filter for that module only.
Thanks
Advanced filters depends on rendering type. I think what you looking for is something similiar which is implemented for example in Sonata\DoctrineORMAdminBundle\Filter\ChoiceFilter, you see there in getRenderSettings() variable settings operator_type. This determine which operators are set in advanced filtering.
I didn't found way how to simple override this settings from AdminClas, but you can extends Sonata\AdminBundle\Form\Type\Filter\ChoiceType and create new type with your defined settings for advanced filtering.
Btw. if you filter status by database field, by example Doctrine, then setting settings then you can simple do (settings second parameter):
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('status', 'doctrine_orm_choice', ..
Which will solve your problem.

How to manage different versions of application by using plugins in cakephp 3?

I have a single cakephp 3 application
I have a generic view which render data depending of an array struture of fields configured in each Model, this array includes configurations for display each field in the view like (text titles, maxsize, sortable, etc..) and database configuration like (column name in the database/table, datatype, etc..) in the same array, and its working fine.
public $tableData = [
[
'name' => 'Table1.name',
'title' => 'Name',
'field' => 'name',
'sortable' => true,
'type' => 'string',
'size' => '50px',
],
[
'name' => 'Asosiation1.option',
'title' => 'Topic',
'field' => 'topic_option',
'sortable' => true,
'type' => 'string',
'size' => '150px',
],
... More fields and asosiations
]
But now, i need to have these same Models in different versions, because the structure of the database/table for each Model change every year, but i need to preserv/show the data corresponding to each version as it is.
So if a user request mySite.com/2010, Site must show data using Model array structure defined for that year especifically.
So, i created:
/plugins/Years/version2010
/plugins/Years/version2011
etc..
and in each pluging, I copied all Models changing only the namespace, defaultConnectionName (1 schema per Year) and array structure.
This provokes to have mutiple plugins loaded in bootstrap config.
Is there any way to load only the necesary plugin depending of the request ?(/2010, /2011, etc..)
Ex. In bootstrap.php I do for each plugin year:
Plugin::load('Years/version201X', ['bootstrap' => false, 'routes' => true]);
also
Is there any way to avoid having to specify the plugin name every time i do loadModel() or TableRegistry::get() ?
Ex. In main App GeneralController I have to do every time:
$this->loadModel('Years/version201X/Table1');
Or maybe there is another better approach to solve this situation i havent seen
Is there any way to load only the necesary plugin depending of the
request ?(/2010, /2011, etc.
Yes. Inside config/bootstrap.php you can check the request uri and then have a switch statement for the plugins. Something like this:
$uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_SPECIAL_CHARS);
// might need explode('/', $uri); to extract the right URL component
switch ($uri) {
case '2011':
// load plugin
break;
case '2012':
// log plugin
break;
}
You probably dont even need the switch statement, be creative there. Obviously thats not exact, but if gives you the right idea.
Is there any way to avoid having to specify the plugin name every time
i do loadModel() or TableRegistry::get() ?
If the model is unique to the plugin then I am not sure how you get away with this. Whats the problem though? Just a few extra characters. Sounds like you only have to do this once per year, right? However, you might not have to specify that if you're within the scope of the plugin. I am not sure on that, but its worth trying.

Typo3 Realurl urlcache is messed up by gclid-parameter

We use Google-Adwords for some campaigns which ads a gclid=xxxxx parameter to the URL.
Unfortunately, this messes up the RealUrl tables and when the page is called next time it results in a 404-error.
Is there any way to make RealUrl ignore this particular parameter?
This is claimed to be solved on GitHub:
https://github.com/dmitryd/typo3-realurl/issues/377
Anyways I still had that problem that the gclid triggers a urldata entry which causes a redirect loop. For now I solved it with removing the gclid from the ignoredGetparameters Filter and then banning it:
'cache' => array( // removed gclid from the filter, then ban it
'ignoredGetParametersRegExp' => '/^(?:utm_[a-z]+|pk_campaign|pk_kwd|TSFE_ADMIN_PANEL.*)$/'
'banUrlsRegExp' => '/gclid|tx_solr|tx_indexed_search|(?:^|\?|&)q=/',
),
Go to the Install Tool and add the parameter to [FE][cHashExcludedParameters].
Since realurl 2, there is a new possibility to control entries to tx_realurl_urldata:
https://github.com/dmitryd/typo3-realurl/wiki/Configuration-reference#banurlsregexp
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array(
//[...]
'cache' => array(
'banUrlsRegExp' => '/gclid|tx_solr|tx_indexed_search|(?:^|\?|&)q=/'
),
//[...]
Works like a charm, didn't knew until today this option even exists.

Zend_Framework how to get the two URL Parameters

I have a build server (http://url.server.zip/release) which contains a list of zip files with some numeric numbers. E.g. http://url.server.zip/release/first_release_1,http://url.server.zip/release/first_release_2 and so on...
View: In my view page I have developed one search box from the search box, I need to search the string from that server (http://url.server.zip/release) then I have to display the release zip file in front view page.
public function viewPostAction() {
$this->params()->fromRoute('page', 1);
return new ViewModel();
}
I'm not sure I really understand your question, but I'll give a try.
Regardless of your situation, in general, you'll have to set the two parameters' name in the route (module.config.php). Like this for example where I want to get in the url the id and name of a theme :
'theme' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/theme/[:themeId]/[:themeName]',
...
The [] means that it is not mandatory to use a parameter in the link. Up to you to know if you want to make it mandatory or not.
The URL would be something like "http://test.com/12/testing". Then, you'll be able to get both of the parameters this way:
$themeId = $this->params()->fromRoute('themeId');
$themeName = $this->params()->fromRoute('themeName');
$themeId = 12 and $themeName = testing, if we follow the example.
Hope it is what you were looking for. If not, could you maybe give us some more info ? Like your routing file, etc.

How can I access custom validators globally?

I created a my own validation class under /library/My/Validate/
In my form I have $this->addElementPrefixPath('My_Validate', 'My/Validate', 'validate');
I am using my validator like so:
$this->addElement('text', 'aField', array(
'validators' => array(
array('TestValidator', false, array('messages' => 'test failed')
),
));
This all works. However, I am interested in improving this in two ways.
I would like to make it so that all forms have access to my validator. Calling addElementPrefixPath() in every form doesn't seem to be a clean way of doing this.
I would like to pass in My_Validate_TestValidator instead of TestValidator so other developers know what they are working with right away.
To answer your first question, the only real easy way to do this would be to create your own instance of the form - My_Form_Abstract - which has an init() method that sets the prefix path - and then of course calls the parent init().
I'm not aware of a way to make your second method work flawlessly. You need to store a prefix in order to build the validator loader correctly. However, as an alternative, you might try creating new instances of the class using the full name, and then adding it to the element:
$element = $this->getElement('aField');
$myValidateTestValidator = new My_Validate_TestValidator();
$element->addValidator($myValidateTestValidator);