******************************************************************************* * * Enhanced Studio for SugarCRM * * Plugin adding new search capabilities to SugarCRM Studio. * * Developed by Patrizio Gelosi * * Version: 2.0 - Date : 24 Jun 2008 * ******************************************************************************* ******************* INSTALLATION ******************* Once logged as admin user, install the package using the "Administration -> Module Loader" tool. ************ UNINSTALLATION / DISABLING ************ Once logged as admin user, uninstall / disable the package using the "Administration -> Module Loader" tool. ************************* SUGARCRM COMPATIBILITY ************************* Enhanced Studio is compatible with all version/editions of SugarCRM 5.0. **************************** SUGARCRM UPGRADE **************************** To upgrade SugarCRM with Enhanced Studio installed : 1- Uninstall Enhanced Studio. 2- Install the SugarCRM upgrade. 3- Re-install Enhanced Studio. ******************** DESCRIPTION ******************** Enhanced Studio provides the SugarCRM Studio and Module Builder with new customization features. It helps the users to customize any module by programming the new CODE type field, that is added to the default SugarCRM ones. This way SugarCRM can be easily customized without touching SugarCRM php code It may be used for the widest range of purposes, such as adding to the ListView / EditView / DetailView the following elements : - Images - Buttons - AJAX-based updating fields - AJAX-based autocomplete fields - Fields automatically evaluated from others - Embedded elements (Flash, Java, etc.) ...and whatever the user has in mind (there's virtually no limitation) FROM THE 2.0 RELEASE CODE FIELDS CAN BE STORED/RETRIEVED AS A COMMON CUSTOM CODE WHOSE DB-TYPE CAN BE SELECTED BY THE USER. *********************** USAGE *********************** If a CODE type field is selected on the SugarCRM Studio tool on the Fields page, the new specific CODE entry appears : 1- The DB Type entry. DB Type value depends on the kind of CODE fields is to be generated. Two different kinds of CODE field are available : a. Non-DB field. To select a Non-DB field leave blank the DB Type entry. This kind of field is run-time evalued and doesn't need to be stored/retrieved to/from DB. All the CODE fields of the previous versions belong to this category. An example is the GOOGLE MAP AUTOMATIC LINK reported below. b. DB field. From the 2.0 release, values of any DB type can be stored/retrieved to/from DB for each CODE field, exactly like other SugarCRM fields. The user can enter the SQL creation query directly into the DB Type entry, according to the DB Engine. For instance a valid entry for a MySQL DB can be the following : INT (11) NOT NULL DEFAULT 0 If the DB field value produces a SQL error, the new field isn't correctly saved. 2- The CODE entry. The content of the "Code" entry is a php code which is run-time evaluated when the field is list-viewed, detail-viewed or edited. The new field can be added to any Studio / MB Layout: EditView, DetailView, ListView, QuickCreate, Basic and Advanced Search. This means that a CODE DB field can be viewed, edited, and even searched for. Numeric CODE db fields are also recognized by Enhanced Search v. 2.1 and can be searched for using the Enhanced Search numeric operator. See the Examples Section above for more details. *** THE CODE FIELD TYPE IS AVAILABLE ONLY IN SUGARCRM STUDIO WITH ENHANCED STUDIO DEMO VERSION. *** ********************* EXAMPLES ********************** 1- PROGRESSIVE ID CODE. Add a progreessive ID code to the listview. HOW-TO: create a new CODE field on Admin -> (Studio / Module Builder) -> with the values below, then add it to Layouts -> ListView. DB Type : CODE: $GLOBALS['count_cc']++; echo '
'.$GLOBALS['count_cc'].'
' N.B.: A semicolon (";") is automatically added at the end of the CODE string by default, so it can be omitted on the last code line 2- OPPORTUNITIES WARNING ON AMOUNT Add a warning field that show different images depending on the amount value. HOW-TO: create a new CODE field on Admin -> Studio -> Opportunities with the values below, then add it to Layouts -> ListView. DB Type : CODE: if ($bean->amount_usdollar > 60000) echo ""; elseif ($bean->amount_usdollar < 20000) echo ""; 3- GOOGLE MAP AUTOMATIC LINK Add a link on Contacts / Accounts modules to the map of the customer address HOW-TO: create a new CODE field on Studio -> (Contacts / Accounts) with the values below, then add it to Layouts -> EditView or DetailView. DB Type : CODE for Accounts: $search_string = urlencode("$bean->billing_address_street $bean->billing_address_city - $bean->billing_address_country"); echo <<Click here to view the map END ; CODE for Contacts: $search_string = urlencode("$bean->primary_address_street $bean->primary_address_city - $bean->primary_address_country"); echo <<Click here to view the map END ; 4- STORE/RETRIEVE A COMMON TEXT FIELD This example shows how to add a custom CODE field that act like a text one. The effect is the same of adding ad SugarCRM text field, but it can be used as a base to develop new feature (such as AJAX spellcheck, auto-complete or validate HTML for instance). HOW-TO: create a new CODE field on Admin -> (Studio / Module Builder) -> with the values below, then add it to Layouts -> ListView, EditView and DetailView. The in the CODE must be replaced with your field name. *** The "_c" postfix to the field name is required on Studio. *** DB Type : TEXT CODE: if ($GLOBALS['app']->controller->action == 'EditView') echo << END ; else echo $bean-> 5- IMAGE FIELD. Add a common image field with a web link. HOW-TO: create a new CODE field on Admin -> Studio -> with the values below, then add it to Layouts -> EditView and DetailView. Field Name : web_image Display Label: web image System Label: LBL_WEB_IMAGE DB Type : VARCHAR(255) CODE: if ($GLOBALS['app']->controller->action == 'EditView') echo <<
END ; if ($bean->web_image_c) echo '
'