I use the suggest wizard in TYPO3 backend.
The following code is in the tca:
'tx_db_colors' => array (
'exclude' => 0,
'label' => 'Farbe',
'config' => array (
"type" => "group",
"allowed" => "tx_db_colors",
"foreign_table" => "tx_db_colors",
"internal_type" => "db",
"size" => 1,
"minitems" => 0,
"maxitems" => 1,
'items' => array(array('', ''),),
'wizards' => array(
'suggest' => array(
'type' => 'suggest',
),
),
)
),
Is there a solution, to get matched records in substring of the label, not from scratch?
Example:
The records label is named 'coffee black'
When I type 'co' into the search field, the record will be shown.
'blac' won't match to any record.
Is this possible to find this record, when I type in a substring? Else I have to extend the autocompletion. TYPO3 Core, yuk! :-)
Thank you in advance!
After hours, I found the solution.
You have to write the tca like this:
'tx_db_colors' => array (
'exclude' => 0,
'label' => 'Farbe',
'config' => array (
"type" => "group",
"allowed" => "tx_db_colors",
"foreign_table" => "tx_db_colors",
"internal_type" => "db",
"size" => 1,
"minitems" => 0,
"maxitems" => 1,
'items' => array(array('', ''),),
'wizards' => array(
'suggest' => array(
'type' => 'suggest',
'default' => array(
'searchWholePhrase' => 1
),
),
),
)
),
Just add
'default' => array(
'searchWholePhrase' => 1
),
into the 'suggest' array.
Related
I am trying to create relationships through module loader in SugarCRM. But the problem is my package is stopped installing after 55%. When I am viewing display log the error is:-
Failed to copy
cache/upgrades/temp/SYWr9G/custom/metadata/accounts_contacts_1MetaData.php
custom/metadata/accounts_contacts_1MetaData.php
I tried to change permissions also but at some point they through internal server error 500. Following are the code which I am using.
1.In manifest.php file :
$installdefs = array(
'id' => 'package_20170804',
'copy' => array(
0 => array(
'from' => '<basepath>/accounts_contacts_1MetaData.php',
'to' => 'custom/metadata/accounts_contacts_1MetaData.php',
),
1 => array(
'from' => '<basepath>/accounts_contacts_1.php',
'to' => 'custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php',
),
),
'relationships'=>array (
array (
'module'=> 'Accounts',
'meta_data'=>'<basepath>/custom/metadata/accounts_contacts_1MetaData.php',
'module_vardefs'=>'<basepath>/custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php'
)
),
);
2. In accounts_contacts_1MetaData.php file :
<?php
$dictionary["accounts_contacts_1"] = array (
'true_relationship_type' => 'one-to-many',
'from_studio' => true,
'relationships' =>
array (
'accounts_contacts_1' =>
array (
'lhs_module' => 'Accounts',
'lhs_table' => 'accounts',
'lhs_key' => 'id',
'rhs_module' => 'Contacts',
'rhs_table' => 'contacts',
'rhs_key' => 'id',
'relationship_type' => 'many-to-many',
'join_table' => 'accounts_contacts_1_c',
'join_key_lhs' => 'accounts_contacts_1accounts_ida',
'join_key_rhs' => 'accounts_contacts_1contacts_idb',
),
),
'table' => 'accounts_contacts_1_c',
'fields' =>
array (
0 =>
array (
'name' => 'id',
'type' => 'varchar',
'len' => 36,
),
1 =>
array (
'name' => 'date_modified',
'type' => 'datetime',
),
2 =>
array (
'name' => 'deleted',
'type' => 'bool',
'len' => '1',
'default' => '0',
'required' => true,
),
3 =>
array (
'name' => 'accounts_contacts_1accounts_ida',
'type' => 'varchar',
'len' => 36,
),
4 =>
array (
'name' => 'accounts_contacts_1contacts_idb',
'type' => 'varchar',
'len' => 36,
),
),
'indices' =>
array (
0 =>
array (
'name' => 'accounts_contacts_1spk',
'type' => 'primary',
'fields' =>
array (
0 => 'id',
),
),
1 =>
array (
'name' => 'accounts_contacts_1_ida1',
'type' => 'index',
'fields' =>
array (
0 => 'accounts_contacts_1accounts_ida',
),
),
2 =>
array (
'name' => 'accounts_contacts_1_alt',
'type' => 'alternate_key',
'fields' =>
array (
0 => 'accounts_contacts_1contacts_idb',
),
),
),
);
3. In accounts_contacts_1.php file:
<?php
include('custom/metadata/accounts_contacts_1MetaData.php');
?>
I just wanted to create a field in relationship that's all . Maybe I am missing somewhere in manifest file or i needed to include some additional file.
I solved it. You can follow following steps to create relationships in SugarCRM through module loader.
Step 1:- Give permission to your sugar directory according to following
For Linux: http://support.sugarcrm.com/Knowledge_Base/Platform_Management/Required_File_System_Permissions_on_Linux/
For Windows:
http://support.sugarcrm.com/Knowledge_Base/Platform_Management/Required_File_System_Permissions_on_Windows_With_IIS/
Step 2:- In manifest.php
<?php
$manifest = array(
'acceptable_sugar_flavors' => array('CE','PRO','CORP','ENT','ULT'),
'acceptable_sugar_versions' => array(
'exact_matches' => array(),
'regex_matches' => array('(.*?)\\.(.*?)\\.(.*?)$'),
),
'author' => 'Ravi Ranjan',
'description' => 'Relationship',
'icon' => '',
'is_uninstallable' => true,
'name' => 'custom relation',
'published_date' => '2017-08-10 2017 11:45:04',
'type' => 'module',
'version' => '20170810',
);
$installdefs = array(
'id' => 'package_20170810',
'copy' => array(
0 => array(
'from' => '<basepath>/accounts_contacts_1MetaData.php',
'to' => 'custom/metadata/accounts_contacts_1MetaData.php',
),
1 => array(
'from' => '<basepath>/accounts_contacts_1.php',
'to' => 'custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php',
),
),
);
?>
Step 3:- The contents of both file accounts_contacts_1MetaData.php and accounts_contacts_1.php will be same as you can see in question.
Step 4:- Compress all three files and upload through module loader, after installation quick repair and rebuild.
Go in Studio > Accounts > Relationships You will see a new field there name accounts_contacts_1 That's what I wanted to create.
How can i create one-to-many relationship with my custom module. And add subpanel to Campaign module
Campaign vardefs
$dictionary["Campaign"]["fields"]["costs"] =
array (
'name' => 'costs',
'type' => 'link',
'relationship' => 'campaign_costs',
'module'=>'Costs',
'bean_name'=>'Costs',
'source'=>'non-db',
'vname'=>'LBL_AUCTIONS',
);
$dictionary['Campaign']['relationships']['campaign_costs'] =
array (
'lhs_module'=> 'Campaigns',
'lhs_table'=> 'campaigns',
'lhs_key' => 'id',
'rhs_module'=> 'Costs',
'rhs_table'=> 'cots',
'rhs_key' => 'campaign_id',
'relationship_type'=>'one-to-many'
);
layout_defs properties
$layout_defs["Campaigns"]["subpanel_setup"]["campaign_costs"] = array (
'order' => 2,
'module' => 'Costs',
'subpanel_name' => 'default',
'sort_order' => 'desc',
'sort_by' => 'date_entered',
'title_key' => 'LBL_SUBPANEL_COSTS',
'get_subpanel_data' => 'costs', //имя поля link
'top_buttons' =>
array (
0 =>
array (
'widget_class' => 'SubPanelTopButtonQuickCreate',
),
1 =>
array (
'widget_class' => 'SubPanelTopSelectButton',
'mode' => 'MultiSelect',
),
),
);
Custom module vardefs
$dictionary['Costs']['fields']['campaign_id'] =
array (
'required' => false,
'name' => 'campaign_id',
'vname' => '',
'type' => 'id',
'massupdate' => 0,
'importable' => 'true',
'audited' => 0,
'len' => 36,
);
$dictionary['Costs']['fields']['campaign_name'] =
array (
'required' => false,
'source' => 'non-db',
'name' => 'campaign_name',
'vname' => 'LBL_CAMPAIGN_NAME',
'type' => 'relate',
'massupdate' => 0,
'comments' => '',
'help' => '',
'audited' => 1,
'len' => '100',
'id_name' => 'campaign_id',
'ext2' => 'Campaigns',
'module' => 'Campaigns',
'rname' => 'name',
'studio' => 'visible',
);
The relationship is added, but subpanel doesn't appear at campaigns module.
In your $dictionary["Campaign"]["fields"]["costs"], change bean_name from Costs to Cost.
I take it you have enabled the subpanel in the admin-menu? (index.php?module=Administration&action=ConfigureTabs)
Does your error-logs say anything?
First of all excuse my bad english.
I got a problem with my select-field in the BE. I would like to prefill (preselect) all of the available items.
Code in ext_tables.php:
'teilnehmer' => array(
'exclude' => 0,
'label' => 'LLL:EXT:kiwanisext/Resources/Private/Language/locallang_db.xlf:tx_kiwanisext_domain_model_veranstaltung.teilnehmer',
'config' => array(
'type' => 'select',
'foreign_table' => 'fe_users',
'MM' => 'tx_kiwanisext_veranstaltung_user_mm',
'size' => 10,
'autoSizeMax' => 30,
'maxitems' => 9999,
'multiple' => 0,
'wizards' => array(
'_PADDING' => 1,
'_VERTICAL' => 1,
'edit' => array(
'type' => 'popup',
'title' => 'Edit',
'script' => 'wizard_edit.php',
'icon' => 'edit2.gif',
'popup_onlyOpenIfSelected' => 1,
'JSopenParams' => 'height=350,width=580,status=0,menubar=0,scrollbars=1',
),
'add' => Array(
'type' => 'script',
'title' => 'Create new',
'icon' => 'add.gif',
'params' => array(
'table' => 'fe_users',
'pid' => '###CURRENT_PID###',
'setValue' => 'prepend'
),
'script' => 'wizard_add.php',
),
),
),
),
I found nothing helpful in the documentation.
Any hint, tip or help will be much appreciated!
Its not possible to do that with plain TCA config, afaik. You can however define a default value wich will be selected (if none is defines, 1st item will be selected).
'default' => 'myValue'
But to preselect multiple values at once, you have to use JavaScript I guess.
This code worked for me in typo3 6.2. I have a selectbox filled with database records.
I want the records with ID's 1 ans 2 to be preselected in the selectbox:
'thematique' => array(
'exclude' => 0,
'label' => 'LLL:EXT:dk_actus/locallang_db.xml:tx_dkactus_thematique',
'config' => array(
'type' => 'select',
'foreign_table' => 'tx_dkactus_thematique',
'foreign_table_where' => 'ORDER BY tx_dkactus_thematique.uid',
'size' => 10,
'minitems' => 0,
'maxitems' => 99,
'default' => '1,2',
),
),
I managed to make news (tx_news) work realurl under the default language. Then I wanted to localize the news, so I created transaltions for them. However when I access the list view for a non-default language, it fails with
Request parameters could not be validated (&cHash comparison failed)
The failing link does not contain cHash, it looks like this
http://host.com/mysite/en/about-us/
What could be the cause and how to fix it? Here is the realURL setup
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
'_DEFAULT' =>
array (
'init' =>
array (
'enableCHashCache' => true,
'enableCHashCache' => 1,
'respectSimulateStaticURLs' => 0,
'appendMissingSlash' => 'ifNotFile,redirect',
//'adminJumpToBackend' => true,
'enableUrlDecodeCache' => true,
'enableUrlEncodeCache' => true,
'emptyUrlReturnValue' => '/mysite/',
),
'pagePath' =>
array (
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'rootpage_id' => '1',
'firstHitPathCache'=> '1',
),
'preVars' =>
array (
0 =>
array (
'GETvar' => 'L',
'valueMap' =>
array (
'cs' => '1',
),
'noMatch' => 'bypass',
),
),
'fixedPostVars' => array(
'19' => array(
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' =>
'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'enable404forInvalidAlias' => '1',
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
),
),
),
),
),
);
With this error I had fight a lot.
Go to Typo3 Install Tool => All configuration and change the value 1 => 0 for this attribute.
[FE] [pageNotFoundOnCHashError] = 0
I hope this gona solve the problem !!!
I seem to have fixed it by emptying the tx_realurl_chashcache in the database.
I had to disable caching for the page. On my site it seems the "no_cache" parameter is confusing the chash calculation. This way i can keep the - i think important - security setting [FE][pageNotFoundOnCHashError] = 0
In Typo3 8.x version:
click the "Speaking Urls" module in the backend and than do "Flush all entries"
Now when you browse the frontend those entries would get re-created. And every thing should work fine.
Basically here we are deleting all page path entries for all pages so that they get created again.
Also you may delete the entries for the selected page by selecting the option "Delete all entries for this page"
I'm using the eBay API and am trying to receive the following notifications:
ItemSold
FixedPriceTransaction
EndOfAuction
However, the only notification I receive is 'FixedPriceTransaction'.
The code I'm using to 'set' what notifications I receive, looks like this:
$opts = array(
'ApplicationDeliveryPreferences' => array(
'ApplicationEnable' => 'Enable',
'ApplicationURL' => 'http://my.domain/ebay_notifications.php',
),
'UserDeliveryPreferenceArray' => array(
'NotificationEnable' => array(
'EventType' => 'ItemSold',
'EventEnable' => 'Enable'
),
'NotificationEnable' => array(
'EventType' => 'EndOfAuction',
'EventEnable' => 'Enable'
),
'NotificationEnable' => array(
'EventType' => 'FixedPriceTransaction',
'EventEnable' => 'Enable'
)
)
);
Any idea what I'm doing wrong?
Schoolboy error on my account.
The 'UserDeliveryPreferanceArray' array contains multiple arrays.
All of them have the same key title: 'NotificationEnable'
This means only the last one is used - the one containing the 'FixedPriceNotification' event.
To remedy this, make each 'notification event' part of an indexed array:
'NotificationEnable' => array(
1 => array(
'EventType' => 'ItemSold',
'EventEnable' => 'Enable'
),
2 => array(
'EventType' => 'EndOfAuction',
'EventEnable' => 'Enable'
),
3 => array(
'EventType' => 'FixedPriceTransaction',
'EventEnable' => 'Enable'
)
)
Happy days.
Ok, maybe i am wrong but the working code should be:
$opts = array(
'ApplicationDeliveryPreferences' => array(
'ApplicationEnable' => 'Enable',
'ApplicationURL' => 'http://my.domain/ebay_notifications.php',
),
'NotificationEnable' => array(
1 => array(
'EventType' => 'ItemSold',
'EventEnable' => 'Enable'
),
2 => array(
'EventType' => 'AskSellerQuestion',
'EventEnable' => 'Enable'
),
3 => array(
'EventType' => 'FixedPriceTransaction',
'EventEnable' => 'Enable'
)
)
);
And not as I thought:
$opts = array(
'ApplicationDeliveryPreferences' => array(
'ApplicationEnable' => 'Enable',
'ApplicationURL' => 'http://my.domain/ebay_notifications.php',
),
'UserDeliveryPreferenceArray' => array(
'NotificationEnable' => array(
1 => array(
'EventType' => 'ItemSold',
'EventEnable' => 'Enable'
),
2 => array(
'EventType' => 'EndOfAuction',
'EventEnable' => 'Enable'
),
3 => array(
'EventType' => 'FixedPriceTransaction',
'EventEnable' => 'Enable'
)
)
);
The first one seems to work well so far. The last one generates 37 errors.
Thank you anyways for your huge suggestion.