Showing posts with label SugarCRM. Show all posts
Showing posts with label SugarCRM. Show all posts

Thursday, January 2, 2014

Disable Dahslets and AddDashlet button for all users



1) step:


Open file : sugarcrm/modules/Home/index.php





comment line 280

$sugar_smarty->assign('maxCount', empty($sugar_config['max_dashlets_homepage']) ? 15 : $sugar_config['max_dashlets_homepage']);
$sugar_smarty->assign('dashletCount', $count);
$sugar_smarty->assign('dashletIds', '["' . implode('","', $dashletIds) . '"]');

//$sugar_smarty->assign('columns', $display);

2) perform repair.

3) now Dahslet will be disable from all users


FOR DISABLE ADD-Dashlet Button.

Goto => System Setting 

Click on Prevent user customizable Homepage layout: checkbox.


Result :


Result
Without Dashlet And AddDashlet button


Friday, September 20, 2013

SugarCRM Quote PDF customization


1) Customize Fonts in default PDF of SugarCRM

  • copy and Edit  custom/modules/Quotes/sugarpdf/sugarpdf.quotes.php
  • add html tag for font.
  • like '<b>'.value.'</b>' for bold
  • '<u>'.value.'</u>' for underline
  • '<i>'.value.'</i>'
  • For Example you want to change for quote number :
 Code:  1.(For Label) : $quote[0]['TITLE'] = '<u><b><i>'.$mod_strings['LBL_PDF_QUOTE_NUMBER'].'</i></b></u>';

                 2.(For Value)     :   $quote[0]['VALUE']['value'] = '<u><b><i>'.format_number_display($this->bean->quote_num,$this->bean->system_id).'</i></b></u>';

Output :     





2) Customize Layout Using TcPDF :
 
   Code  :  coming  soon

Wednesday, August 7, 2013

Duplicate Finder

This is what i have find during surfing on internet,

Give an indication next to phone number if it is found to be repeated over various Contacts :

1.Create a process_record logic hook in custom/modules/Contacts/logic_hooks.php



<?php
$hook_array['process_record'][] = Array(1, 'Check Dup', 'custom/modules/Contacts/checkDup.php','checkDupC', 'checkDupF');

2. Create a file checkDup.php in SugarCRM/custom/modules/Contacts/








<?php
class checkDupC{
function checkDupF($bean){
$sContacts = $bean->db->query('SELECT contacts.id FROM contacts WHERE contacts.phone_work = "'.$bean->phone_work.'" AND contacts.id <> "'.$bean->id.'" AND contacts.phone_work IS NOT NULL', true);
$bFound = false;
while($aContacts = $bean->db->fetchByAssoc($sContacts)){
if(!empty($aContacts['id']))
$bFound = true;
}

if($bFound){
$bean->phone_work = $bean->phone_work."&nbsp;".SugarThemeRegistry::current()->getImage('no');
}
}
}

Now, refresh the list view and you should have (X) mark after phone number.









Wednesday, June 26, 2013

Dependable Required Field




e.g.: 
       My Module Name : Desner
       Field                   : desnerStatus_c ( DropDown ) (Values :  nitin, blog, spot, nrsd)



Condition : if i select nrsd from desnerStatus_c dropdown want description required else remove validation.


Step1: Copy or make path like Sugarcrm/custom/modules/Desner/views/view.edit.php

Step2: copy below code in view.edit.php

<?php
require_once('include/MVC/View/views/view.edit.php');
class DesnerViewEdit extends ViewEdit {
    public function __construct() {
        parent::ViewEdit();
        $this->useForSubpanel = true; 
        $this->useModuleQuickCreateTemplate = true; 
    }
    function display() {
        global $mod_strings;
        $jsscript = <<<EOQ

                   <script>
                      
       $('#desnerStatus_c').change(function() {
            makerequired(); 
                       });
 function makerequired()
  {
        var status = $('#desnerStatus_c').val(); 
       if(status == 'nrsd'){                     addToValidate('EditView','description','varchar',true,'{$mod_strings['LBL_DESCRIPTION']}');                           $('#description_label').html('{$mod_strings['LBL_DESCRIPTION']}: <font color="red">*</font>'); 
                            }
       else{
          removeFromValidate('EditView','description');                       
                        $('#description_label').html('{$mod_strings['LBL_DESCRIPTION']}: '); 
                            }
         }
     makerequired(); 
    </script>
EOQ;
        parent::display();
        echo $jsscript;     
    }

}



Note:

  •         It is tested on SugarCRM 6.5 and above
  •         For another version that not supported JQuery add one line after <<<EOQ
         <script src="http://code.jquery.com/jquery-1.9.1.js"></script>




Step 3 : Any Query Please Make comment




                                                       



Thursday, May 30, 2013

Hide Subpanel from Module



Want to Hide Subpanel from Module Permanently ?

Goto : sugarcrm/custom/Extension/modules/Leads/Ext//Layoutdefs/

see for the  layoutdefs.ext.php


if not than create.

( e.g. hide champaign subpanel )

edit that file and add line:

unset($layout_defs['Leads']['subpanel_setup']['campaigns']); 

Than repair and rebult.

Note: You need to create the folders and files if they doesn´t exist.
             If you want that panel than do vice-versa


For Sugarcrm 6.4.X or 6.5.X TRY THIS

Goto : sugarcrm/custom/Extension/modules/Leads/Ext//Layoutdefs/

hide_campaigns_subpanel.php

edit that file and add line:

<?php unset($layout_defs['Leads']['subpanel_setup']['campaigns']);

If file already there than

make file like              _override_hide_campaigns_subpanel.php

Tuesday, April 2, 2013

Copy Field into Related SubPanel




Copy Fields from parent module to related module at real time,

e.g : Need to create case from contacts and want contact field fill in new created case.

Steps => 1

Go to studio and create related field of Contacts in Case module.

Make this field in Edit View, Detail View and Quick Create view.

Steps =>2

Go to SugarCRM/include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php

At line 128, place below code:


 if(strtolower($defines['child_module_name']) =='cases') {
            if(strtolower($defines['parent_bean_name']) == 'contact' ){            
                if(isset($defines['focus']->id))$additionalFormFields['contact_id_c'] = $defines['focus']->id;
                if(isset($defines['focus']->name))$additionalFormFields['contact_person_c'] = $defines['focus']->name;
            }            
        }

where contact_id_c and contact_person_c is the my new field id and name


Tuesday, March 19, 2013

Add Field in Address

1) make fields name area_c by studio in contacts and accounts and leads

2) change in /include/SugarFields/Fields/Address/EditView.tpl

add line one line after country
{{assign var="area" value=$displayParams.key|cat:'_address_area_c'}} 


after that add one TR :



<tr>

<td id="{{$area}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >

{sugar_translate label='LBL_AREA' module='{{$module}}'}:
{if $fields.{{$area}}.required || {{if $area|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{/if}
</td>
<td>
<input type="text" name="{{$area}}" id="{{$area}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$area}}.value}' tabindex="{{$tabindex}}">
</td>
</tr>



add one line like,

address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}<br>

{$fields.{{$displayParams.key}}_address_area_c.value}|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}

{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
</td>


_address_postalcode.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}<br>

{$fields.{{$displayParams.key}}_address_area_c.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
<br>

{$fields.{{$displayParams.key}}_address_country.value|escape:'htmlentitydecode'|strip_tags|url2html|nl2br}
</td>


<td>
<input type="text" name="{{$postalcode}}" id="{{$postalcode}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$postalcode}}.value}' tabindex="{{$tabindex}}">
</td>
</tr>

<!--tr>

<tr>
<td id="{{$area}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' class="dataLabel" >
{sugar_translate label='Area' module='{{$module}}'}:
{{if $area|lower|in_array:$displayParams.required}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{{/if}}
</td>
<td width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}%' class='tabEditViewDF' >
<input type="text" name="{{$area}}" id="{{$area}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$area}}.value}' tabindex="{{$tabindex}}">
</td>
</tr-->
<tr>

<td id="{{$area}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >

{sugar_translate label='Area' module='{{$module}}'}:
{if $fields.{{$area}}.required || {{if $area|lower|in_array:$displayParams.required}}true{{else}}false{{/if}}}
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
{/if}
</td>
<td>
<input type="text" name="{{$area}}" id="{{$area}}" size="{{$displayParams.size|default:30}}" {{if !empty($vardef.len)}}maxlength='{{$vardef.len}}'{{/if}} value='{$fields.{{$area}}.value}' tabindex="{{$tabindex}}">
</td>
</tr>


<tr>
<td id="{{$country}}_label" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' scope='row' >



Sunday, March 10, 2013

Show and hide Panel on load and click on checkbox





Step1: Create one .js file in root /var/www/crm/*.js
function display()
{document.getElementById(‘LBL_PANEL5′).style.display = ‘none’;}



Step2: include file in editview.php
‘includes’ =>
array (
0 =>
array (
‘file’ => *.js’,
),
),

step3: onload run file:
),
‘javascript’ => ‘<script type=”text/javascript” language=”Javascript”> onload=display(); </script>’,
),
‘panels’ =>
step4: call function on checkbox event:

‘label’ => ‘LBL_FEEDBACK_TEST_DRIVE’,
’displayParams’ =>
array (
‘field’ =>
array (
‘onChange’ => ‘display();’,
),
),

Sunday, January 27, 2013

Disable Last view in SugarCRM


There is two way to disable lastview.

1) you can write logic hook in custom/modules/Users/logic_hook.php
after_retrive
AND delete all data write in tracker table.
2) if You want to disable for perticular Module,
for e.g. Disable for Account module
go to modules/Accounts/account.php
find get_summary_text() function
comment (//) return value.
Best of Luck…


Tuesday, January 1, 2013

Remove Navigation Warning MSG from Every Page

Steps =>

1=> Just goto sugarcrm/includes/javascript/Sugar_grp1.js

2=> find WARN_UNSAVED_CHANGES

3=> after change code will look like,



if(dataHasChanged==true){

//return SUGAR.language.get('app_strings','WARN_UNSAVED_CHANGES');


}else{return;}}

Monday, July 23, 2012

SugarCRM View documents in browser.


( Currently Supported PDF and Text file )

- Make a directory called “doc” within the “custom” folder (rights: 777).
- Make a  php file called “showfile.php” (rights: 777) in the “prudento” folder.
- Place the following code within showfile.php:



for all doc:::::
<?php
$FileNaam=$_GET['file'];
$FileType=$_GET['type'];
$base = str_replace(‘/custom/doc/showfile.php’, ” ,$_SERVER['PHP_SELF'] );
echo ‘<body scroll=”no” style=”overflow:hide; height:480px;”>’;
echo ‘<div id=”bg_image” style=”position:absolute; top:0px; left:0px; height:100%; width:100%”>’;
echo ‘<embed src=”http://docs.google.com/gview?url=http://’ . $_SERVER['SERVER_NAME'] . $base . ‘/cache/upload/’. $FileNaam .’&embedded=true “id=”application/pdf” width=”100%” height=”480px” ></embed >’;
echo ‘</div>’;
?>


for pdf and text exclude doc::::::::

<?php
$FileNaam=$_GET['file'];
$FileType=$_GET['type'];
/************************************
* find root of the sugarinstallation
************************************/
$base = str_replace(‘/custom/doc/showfile.php’, ” ,$_SERVER['PHP_SELF'] );

/************************************
* build html page to show in iframe field
************************************/

echo ‘<body scroll=”no” style=”overflow:hidden; height:100%;”>’;
echo ‘<div id=”bg_image” style=”position:absolute; top:0px; left:0px; height:100%; width:100%”>’;
echo ‘<embed src=”http://’ . $_SERVER['SERVER_NAME'] . $base . ‘/cache/upload/’. $FileNaam .’” id=”imgPhoto” width=”100%” height=”100%” ></embed >’;
echo ‘</div>’;
?>


Go to studio=>documents=>fields an make a costum field with these properties:
- Datatype: Iframe
- Field label: Preview
- Generate URL: Yes
- Standard value: http://domain.com/custom/doc/showfile.php?file={document_revision_id}
- Maximun size: 225
- Iframe height: 500
- Save
- Go to studio=>documents=>layout=>detailview and make a panel called something like “preview”
- Place the “preview” block on the new panel and make it fit the whole line.
- Do a quick repair in the admin menu
- Open the .htaccess (if any) in the sugar root folder.
- Comment out or delete the 2 rows with the cache and temp folder ( otherwise Googledocs cant access the files)

SugarCRM login page







Dear All,
Upgrade your sugarcrm 5.2 login page to sugarcrm 6.3
1) find the attachments .
2) goto modules => Users
3) copy Login.php to Login_org.php
4) now replace Login.php Login.php.txt

Ad