From Where SugarCRM assign value for $fields.date_modified
Just wanted to see the sugar code and want to do some customization in that file
Below code is from : modules\Leads\metadata\detailviewdefs.php
'LBL_PANEL_ASSIGNMENT' =>
array(
array (
array (
'name' => 'assigned_user_name',
'label' => 'LBL_ASSIGNED_TO',
),
array (
'name' => 'date_modified',
'label' => 'LBL_DATE_MODIFIED',
'customCode' => '{$fields.date_modified.value} {$APP.LBL_BY} {$fields.modified_by_name.value}',
),
),
array (
array (
'name' => 'date_entered',
'customCode' => '{$fields.date_entered.value} {$APP.LBL_BY} {$fields.created_by_name.value}',
),
),
),
What SugarCRM version are you using?
I only have a pro version here.
Look for the following line on EditView2.php file under include/EditView directory.
$this->th->ss->assign('fields', $this->fieldDefs);
It is not advisable to modify core codes on sugarcrm. You might as well create a custom view.detail.php file custom/Leads/ directory. I assume you are new to sugar and the following link would be very helpful to you. http://archive.h2ik.co/2012/03/sugarcrm-upgrade-safe-way-to-extend-views/
Related
I am currently encountering issues trying to build a custom search field (itself bound to an unused field on a Module) to search two Phone Number fields. The documentation covering modifications of a search field are really poor, but I have the following in place in the module's SearchFields.php
'phone' =>
array (
'query_type' => 'default',
'operator' => '=',
'db_field' =>
array (
0 => 'home_phone_c',
1 => 'work_phone_c',
),
),
The field itself returns no results, so am I missing something that would prevent this from working?
why not you use "sub-query" operator for this? See SearchFields.php inside metadata folder of Account module. You will see entry like following:
'email' =>
array (
'query_type' => 'default',
'operator' => 'subquery',
'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
'db_field' =>
array (
0 => 'id',
),
'vname' => 'LBL_ANY_EMAIL',
),
this will help you to understand the sugar logic of doing it.
You need to designate the correct tables. Try the below code (or use the tables that you're searching):
'phone' =>
array (
'query_type' => 'default',
'operator' => '=',
'db_field' =>
array (
0 => 'accounts_cstm.home_phone_c',
1 => 'accounts_cstm.work_phone_c',
),
),
I am developing a custom suite CRM module however I find the Address field limiting since it uses text fields for country and state fields.
I have tried researching it by following instructions on this site:
https://johndopenotes.wordpress.com/2013/01/08/sugarcrm-change-address-state-and-country-to-dropdown-menu/
However I am stuck at step 5 since my custom module does not have a metadata directory???
Go to /custom/modules/Leads/metadata and update editviewdefs.php. Look for this code:
array (
'name' => 'primary_address_street',
'hideLabel' => true,
'type' => 'Address',
'displayParams' =>
array (
'key' => 'primary',
'rows' => 2,
'cols' => 30,
'maxlength' => 150,
),
),
1 =>
array (
'name' => 'alt_address_street',
'hideLabel' => true,
'type' => 'Address',
'displayParams' =>
array (
'key' => 'alt',
'copy' => 'primary',
'rows' => 2,
'cols' => 30,
'maxlength' => 150,
),
),
and update the type from Address to CustomAddress
array (
'name' => 'primary_address_street',
'hideLabel' => true,
'type' => 'CustomAddress',
'displayParams' =>
array (
'key' => 'primary',
'rows' => 2,
'cols' => 30,
'maxlength' => 150,
),
),
1 =>
array (
'name' => 'alt_address_street',
'hideLabel' => true,
'type' => 'CustomAddress',
'displayParams' =>
array (
'key' => 'alt',
'copy' => 'primary',
'rows' => 2,
'cols' => 30,
'maxlength' => 150,
),
),
Can someone please give me a pointer as to how I can make address field in my custom module dropdowns instead of text fields?
Instead to choosing Address type field you can use combination of multiple fileds. For an example for street address you can use (datatype:textField)
Similarly for city you can add a text filed. Now for state and country you can use dropdown and add dropdown list as per your need
And for zipcode you can use integer / text field as per your requirement.
Now to make state dependend to country you can use custom javascript / jquery in following way
Add a reference to the javascript file you are going to add at the
end of custom/modules/<>/metadata/[edit|detail]viewdefs.php
$viewdefs['Opportunities']['EditView']['templateMeta']['includes'] = array ( array ( 'file' => 'path/to/file/filename.js', ), );
Add the javascript file you want to include into the location you
referenced above.
Quick Repair from the admin section, then browser refresh
It should just be a case of updating the vardefs for the field so the type is set to enum and the options point to your dropdown list. Then run a repair and rebuild.
The guide you've linked to looks like it is creating a new field type, which I think is overkill. It's also using Sugar logic to make the 2 lists dependent, but I'm not sure that's a feature in SuiteCRM.
When I try to add the wizard named wizard_geo_selector in TCA ,there arised an error "module not registered".Please tell me how to register the wizard properly in the TCA.?
In TYPO3 Version 7.6 new wizards are added like this:
Inside your extension create the directory Configuration/Backend/
In the new directory create a file Routes.php, it will be found automatically, no mentioning in ext_localconf.php or ext_tables.php is required. If you still need Ajax you can add the file AjaxRoutes.php in the same folder.
Content for Routes.php:
return array(
'my_wizard_element' => array(
'path' => '/wizard/tx_geoselecotor/geo_selector_wizard',
'target' => \Path\To\your\class\WizardGeoSelector::class . '::WizardAction'
),
);
Content for AjaxRoutes.php
<?php
/**
* Definitions for routes provided by EXT:backend
* Contains all AJAX-based routes for entry points
*
* Currently the "access" property is only used so no token creation + validation is made
* but will be extended further.
*/
return array('my_ajax_element' => array(
'path' => 'tx_geoselecotor/my_ajax_route',
'target' => \Path\To\your\class\MyAjaxController::class .'::myAjaxFunction'
));
If you're unsure about the notation you can compare with existing entries in the Global Variables in the Backend:
Navigate to System -> Configuration -> Backend Routes
The route of the paths is handled different, for Ajax it's always "ajax" prepended, so you've never to add it to the path, else it's twice in the route. For the common route there is no change concerning the defined string.
Now the wizard can be used and even it never has to be defined in ext_tables.php it has to be mentioned there from any table-field in the configuration-area (module[name]):
'table_field_for_wizard' => array(
'label' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xml:table_name.tx_myextension_wizard',
'config' => array (
'type' => 'user',
'userFunc' => 'Path/to/class/without/wizard->renderForm',
'wizards' => array(
'my_wizard' => array(
'type' => 'popup',
'title' => 'MyTitle',
'JSopenParams' => 'height=700,width=780,status=0,menubar=0,scrollbars=1',
'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/img/link_popup.gif',
'module' => array(
'name' => 'my_wizard_element',
'urlParameters' => array(
'mode' => 'wizard',
'ajax' => '0',
'any' => '... parameters you need'
),
),
),
'_VALIGN' => 'middle',
'_PADDING' => '4',
),
# Optional
#'softref'=>'something',
),
),
In the userFunc Path/to/class/without/wizard->renderForm you've to create a button which is linking to the wizard and onClick the wizard will open with the route you defined in Routes.php and the optional urlParameters.
Currently I never found this whole item explained in the core-documentation.
Edit:
Details about routing can be found here: Routing
The rendering process can be found here: Rendering / NodeFactory
You should probably read also the outer context of the linked paragraph.
Edit 2:
An example extension can be found here, some things never work 100% but the wizard is working. The extension is for TYPO3 Version 7:
https://github.com/DavidBruchmann/imagemap_wizard
Ricky's answer doesn't really work anymore, since addModulePath ist deprecated since version 7.
Also, just registering the module like this still give's you said error.
The only thing that keeps the wizard going again is this:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('wizard','pbsurvey_answers',"",\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'wizard/');
But when you add this, the module appears as a new point in your TYPO3 backend.
IN TCA add the wizard like follows:
'module' => array(
'name' => 'wizard_geo_selector',
),
In ext_tables.php register the wizard.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
'wizard_geo_selector',
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/Yourwizardname/'
);
Keep in mind this is deprecated since Typo3 7 and removed in Typo3 8.So you can use this method upto Typo3 7.For Typo3 8 do use the method specified by David below.
I followed that tutorial ( http://developer.sugarcrm.com/2011/05/16/howto-create-a-flex-relate-for-other-modules/ ) to create a flex related module between the Leads and the Accounts module and PRO_Profil module.
One account can have multiple PRO_Profil items. Same for the lead module, it can have multiple PRO_Profil items. In the table pro_profil, there is a creation of parent_id and parent_name
Then I follow that tutorial ( http://developer.sugarcrm.com/2011/05/18/howto-add-a-subpanel-using-code/ ) to create a subpanel.
But the subpanel are not shown on the account detail view and neither in the lead detail view.
This result with the creation of 2 files
custom\Extension\modules\Leads\Ext\Layoutdefs_profil.php
<?php
$layout_defs["Leads"]["subpanel_setup"]['PRO_Profil'] = array (
'order' => 130,
'module' => 'PRO_Profil',
'get_subpanel_data'=>'PRO_Profil',
'sort_order' => 'asc',
'sort_by' => 'name',
'subpanel_name' => 'default',
'title_key' => 'LBL_TEST_FLEXPARENT',
);
?>
custom\Extension\modules\Leads\Ext\Vardefs\infos.php
<?php
$dictionary['Lead']['fields']['PRO_Profil'] = array(
'name' => 'PRO_Profil',
'type' => 'link',
'relationship' => 'profils_leads',
'module' => 'PRO_Profil',
'bean_name' => 'PRO_Profil',
'source' => 'non-db',
'vname' => 'LBL_TEST_FLEXPARENT',
);
?>
I have the feeling that sugarcrm 6.3 or 6.4 changed the system
where is the problem ?
regards
I tryied also :
http://forums.sugarcrm.com/f148/howto-prospect-list-subpanel-leads-sugarcem-6-4-maybe-6-3-a-78030/
I am using woocommerce (free plugin).. I am trying to add one custom field to the billing fields..
here it is:
// ADDED HOW YOU GOT TO KNOW ABOUT OUR SERVICE FIELD
add_filter( 'woocommerce_checkout_fields' , 'About_Our_Service' );
// Our hooked in function - $fields is passed via the filter!
function About_Our_Service( $fields ) {
$fields['billing']['billing_meat'] = array(
'label' => __('How you Got to Know About Our Service?', 'woocommerce'),
'placeholder' => _x('', 'placeholder', 'woocommerce'),
'required' => false,
'clear' => false,
'type' => 'select',
'options' => array(
'google-ads' => __('Google', 'woocommerce' ),
'google-search' => __('Yahoo', 'woocommerce' ),
'warrior-forum' => __('Bing', 'woocommerce' ),
'facebook' => __('Facebook', 'woocommerce' ),
'other' => __('Other', 'woocommerce' ),
)
);
return $fields;
}
The problem is: I am not getting the value in my mail for the custom field which was added to the billing fields.. Anyone who already used woocommerce can help me on this... ?
I already created some more custom fields which was added to the checkout (BUT these're not added along with the core fields), for these fields i'm able to get values in my mail..
By the ay, i checked this thread: but didn't much info related to mail..
please kindly someone look into this..
For future readers, custom billing/shipping fields are saved as post meta for the order post. So in general, you can retrieve them with the typical WordPress get_post_meta() function.
But in WooCommerce 2.2, you don't need to as you can pass the field name directly to an array of fields that WC will show as a list in the email:
// pre-WooCommerce 2.3
function kia_email_order_meta_keys( $keys ) {
$keys['Some field'] = '_some_field';
return $keys;
}
add_filter('woocommerce_email_order_meta_keys', 'kia_email_order_meta_keys');
This method has been deprecated in version 2.3, probably so translation can be better. As of 2.3 you will need to target a different filter and send slightly different data.
// WooCommerce 2.3+
function kia_email_order_meta_fields( $fields, $sent_to_admin, $order ) {
$fields['some_field'] = array(
'label' => __( 'Some field', 'my-plugin-textdomain' ),
'value' => get_post_meta( $order->id, '_some_field', true );
);
return $fields;
}
add_filter('woocommerce_email_order_meta_fields', 'kia_email_order_meta_keys', 10, 3 );
I wrote a tutorial on Customizing WooCommerce Checkout Fields
I believe this answer, in the codex is specifically meant for this purpose:
http://wcdocs.woothemes.com/snippets/add-a-custom-field-in-an-order-to-the-emails
I haven't implemented this myself but it's probably your best shot.