Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Customize the convert lead page

  1. #1
    moroccanjoe2 is offline Member
    Join Date
    Sep 2010
    Posts
    11

    Default Customize the convert lead page

    HI guys!

    I have a question that someone will hopefully have a suggestion for.I think the code that drives this is in convertlead.tpl but I am not really sure how to modify it to do what I need. What I am trying to do is this:

    1) delete (or hide) all the options other than "create account" and "create opportunity" in the convert lead screen.
    2) make the "create opportunity" check box automatically checked so that the form shows every time.

    I am running version 6.0.1. Thanks for your help in advance!

  2. #2
    ravisalaria is offline Junior Member
    Join Date
    Oct 2010
    Posts
    4

    Default Re: Customize the convert lead page

    HI guys i have same problem please help me out of this

    Thanksssss

  3. #3
    jrp918 is offline Senior Member
    Join Date
    Aug 2010
    Location
    Phoenix Arizona
    Posts
    27

    Default Re: Customize the convert lead page

    Hi
    These items should help you along with some of your customizations, I am working on these items myself and I know it is appropriate to share when information is found... Good luck

    1. Logo Custom Login Page :
    You'll need to edit the file modules/Users/login.tpl
    You'll probably actually want to move it to custom/modules/Users/login.tpl to make it upgrade safe.

    This is the code you'll need to modify:

    <td style="padding-bottom: 10px;" ><b>{$MOD.LBL_LOGIN_WELCOME_TO}</b><br>
    <IMG src="include/images/sugar_md.png" alt="Sugar" width="340" height="25">
    </td>

    The variable $MOD.LBL_LOGIN_WELCOME_TO contains the "Welcome to" text, and is determined by the selected language.

    You'll have to edit the path to login.tpl in login.php (located in modules/Users/) to custom/modules/Users/login.tpl. it's at the end of the page somewhere ... $sugar_smarty->display('custom/modules/Users/login.tpl');

    Or simple way just change the text “sugar_md.png” in the code and change it to match your “company.png” image file and also change the [“alt” text] to whatever company name you want it to say when you hover over the image with your mouse. Make sure your new image is also somewhere around 340x25



    2. Make the "Create Opportunity" and “Create Appointment” box always checked :
    In the Leads/ConvertLead.php file
    change the following text bolded items at the bottom of your php file:

    Located here
    //OPPORTUNITY
    .....('FORMBODY',"<h5 class='dataLabel'><input class='checkbox' type='checkbox' name='newopportunity' onClick='toggleDisplay(\"newoppdiv\");'> ".$mod_strings['LNK_NEW_OPPORTUNITY']."</h5><div id='newoppdiv' style='display:none'>".$oppForm->getWideFormBody('Opportunities', 'Opportunities','ConvertLead', $lead , false).....

    New Code Is

    .....('FORMBODY',"<h5 class='dataLabel'><input class='checkbox' type='checkbox' checked name='newopportunity' onClick='toggleDisplay(\"newoppdiv\");'> ".$mod_strings['LNK_NEW_OPPORTUNITY']."</h5><div id='newoppdiv' style='display:block'>".$oppForm->getWideFormBody('Opportunities', 'Opportunities','ConvertLead', $lead , false).....


    And

    //APPOINTMENT
    .....('FORMBODY',"<h5 class='dataLabel'><input class='checkbox' type='checkbox' checked name='newmeeting' onClick='toggleDisplay(\"newmeetingdiv\");'> ".$mod_strings['LNK_NEW_APPOINTMENT']."</h5><div id='newmeetingdiv' style='display:block'>".$callForm->getWideFormBody('Appointments','Calls','ConvertLe ad').....



    3. Make Expected Close Date Not required :
    In Opportunities/OpputunityFormBase.php under the function getWideFormBody()
    check for the line :
    <td class="dataLabel">$lbl_date_closed&nbsp;<span class="required">$lbl_required_symbol</span></td>
    change this to -
    <td class="dataLabel">$lbl_date_closed&nbsp;

    And
    also, in the Opportunities/metadata/editviewdefs.php, in the "panels" array remove 'required'=>true' for the "date_closed" –

    old code: array('name'=>'date_closed', 'displayParams'=>array('required'=>true)),
    new code: array('name'=>'date_closed', 'displayParams'=>array()),


    4. Prefill the Opportunity name with the Account Name :
    In Opportunities/OpputunityFormBase.php under the function getWideFormBody()
    check for the line:
    <td class="dataField"><input name='{$prefix}name' type="text" value="{$lead->opportunity_name}"></td>
    change it to:
    <td class="dataField"><input name='{$prefix}name' type="text" value="{$lead->account_name}"></td>

  4. #4
    moroccanjoe2 is offline Member
    Join Date
    Sep 2010
    Posts
    11

    Default Re: Customize the convert lead page

    Quote Originally Posted by jrp918 View Post
    Hi
    These items should help you along with some of your customizations, I am working on these items myself and I know it is appropriate to share when information is found... Good luck

    1. Logo Custom Login Page :
    You'll need to edit the file modules/Users/login.tpl
    You'll probably actually want to move it to custom/modules/Users/login.tpl to make it upgrade safe.

    This is the code you'll need to modify:

    <td style="padding-bottom: 10px;" ><b>{$MOD.LBL_LOGIN_WELCOME_TO}</b><br>
    <IMG src="include/images/sugar_md.png" alt="Sugar" width="340" height="25">
    </td>

    The variable $MOD.LBL_LOGIN_WELCOME_TO contains the "Welcome to" text, and is determined by the selected language.

    You'll have to edit the path to login.tpl in login.php (located in modules/Users/) to custom/modules/Users/login.tpl. it's at the end of the page somewhere ... $sugar_smarty->display('custom/modules/Users/login.tpl');

    Or simple way just change the text “sugar_md.png” in the code and change it to match your “company.png” image file and also change the [“alt” text] to whatever company name you want it to say when you hover over the image with your mouse. Make sure your new image is also somewhere around 340x25



    2. Make the "Create Opportunity" and “Create Appointment” box always checked :
    In the Leads/ConvertLead.php file
    change the following text bolded items at the bottom of your php file:

    Located here
    //OPPORTUNITY
    .....('FORMBODY',"<h5 class='dataLabel'><input class='checkbox' type='checkbox' name='newopportunity' onClick='toggleDisplay(\"newoppdiv\");'> ".$mod_strings['LNK_NEW_OPPORTUNITY']."</h5><div id='newoppdiv' style='display:none'>".$oppForm->getWideFormBody('Opportunities', 'Opportunities','ConvertLead', $lead , false).....

    New Code Is

    .....('FORMBODY',"<h5 class='dataLabel'><input class='checkbox' type='checkbox' checked name='newopportunity' onClick='toggleDisplay(\"newoppdiv\");'> ".$mod_strings['LNK_NEW_OPPORTUNITY']."</h5><div id='newoppdiv' style='display:block'>".$oppForm->getWideFormBody('Opportunities', 'Opportunities','ConvertLead', $lead , false).....


    And

    //APPOINTMENT
    .....('FORMBODY',"<h5 class='dataLabel'><input class='checkbox' type='checkbox' checked name='newmeeting' onClick='toggleDisplay(\"newmeetingdiv\");'> ".$mod_strings['LNK_NEW_APPOINTMENT']."</h5><div id='newmeetingdiv' style='display:block'>".$callForm->getWideFormBody('Appointments','Calls','ConvertLe ad').....



    3. Make Expected Close Date Not required :
    In Opportunities/OpputunityFormBase.php under the function getWideFormBody()
    check for the line :
    <td class="dataLabel">$lbl_date_closed&nbsp;<span class="required">$lbl_required_symbol</span></td>
    change this to -
    <td class="dataLabel">$lbl_date_closed&nbsp;

    And
    also, in the Opportunities/metadata/editviewdefs.php, in the "panels" array remove 'required'=>true' for the "date_closed" –

    old code: array('name'=>'date_closed', 'displayParams'=>array('required'=>true)),
    new code: array('name'=>'date_closed', 'displayParams'=>array()),


    4. Prefill the Opportunity name with the Account Name :
    In Opportunities/OpputunityFormBase.php under the function getWideFormBody()
    check for the line:
    <td class="dataField"><input name='{$prefix}name' type="text" value="{$lead->opportunity_name}"></td>
    change it to:
    <td class="dataField"><input name='{$prefix}name' type="text" value="{$lead->account_name}"></td>
    I appreciate your help. The only problem is that your customizations don't work for version 6+ because the convertlead.php file is not there any more. The only things that have "convertlead" in the file names are "view.convertlead.php" and "convertlead.tpl". Neither one of those contain the code you customized. I appreciate you for trying to help us out though!

  5. #5
    atulnbd is offline Sugar Community Member
    Join Date
    Feb 2011
    Location
    Pune,India
    Posts
    34

    Default Re: Customize the convert lead page

    Quote Originally Posted by moroccanjoe2 View Post
    I appreciate your help. The only problem is that your customizations don't work for version 6+ because the convertlead.php file is not there any more. The only things that have "convertlead" in the file names are "view.convertlead.php" and "convertlead.tpl". Neither one of those contain the code you customized. I appreciate you for trying to help us out though!
    How to do the above changes in 6.x versions????I am having same problems...

  6. #6
    helping is offline Member
    Join Date
    Jan 2011
    Posts
    8

    Post Re: Customize the convert lead page

    I changed the following in 6.1.2:

    ad 2:
    (Account name as opportunity name)
    copy: modules/Leads/views/view.convertlead.php
    to: custom/modules/Leads/views/view.convertlead.php

    search for
    PHP Code:
                else if ($module == "Opportunities" && $field == 'name' && $opportunityNameInLayout) {
                    
    $focus->name $this->focus->opportunity_name;
                } 
    replace with
    PHP Code:
                else if ($module == "Opportunities" && $field == 'name') {
                    if (
    $opportunityNameInLayout) {
                    
    $focus->name $this->focus->opportunity_name;
                    } else {
                    
    $focus->name $this->focus->account_name;
                    }
                } 
    ad 4:
    (preselect opp for creation; applies to activities as well)
    copy: modules/Leads/metadata/convertdefs.php
    to: custom/modules/Leads/metadata/convertdefs.php

    search for
    PHP Code:
    $viewdefs['Opportunities']['ConvertLead'] = array(
        
    'copyData' => true,
        
    'required' => false,
        
    'templateMeta' => array( 
    replace with
    PHP Code:
    $viewdefs['Opportunities']['ConvertLead'] = array(
        
    'copyData' => true,
        
    'required' => false,
        
    'default_action' => 'create',
        
    'templateMeta' => array( 
    If you set "required" as true instead of adding "default_action", the creation of an opportunity cannot be deselected.

    HTH,
    helping

  7. #7
    marclangston is offline Sugar Community Member
    Join Date
    Oct 2009
    Posts
    98

    Default Re: Customize the convert lead page

    I've tried adding the 'default_action' => 'create' code to the specified file. It did automatically check the "Create Opportunity" box when converting a lead, but then for some reason it does not require that the user enter data in to the "required" fields (MRC, close date, name). I don't have to put anything at all in those fields and the lead will still convert.

    Any ideas? Does the addition/change of the custom/modules/leads/metadata/convertdefs.php code mean I also need to change something somewhere else/

    Thanks.
    marc

  8. #8
    helping is offline Member
    Join Date
    Jan 2011
    Posts
    8

    Default Re: Customize the convert lead page

    You are right. This seems to me like a bug in sugar's javascript validation with default_action = "create"...

    To fix it, I changed "view.convertlead.php" (look at "ad 2" in my post above):

    Within function "getValidationJS()"
    search for
    PHP Code:
            } else if (isset($viewdef['default_action'])  && $viewdef['default_action'] == "create")
            {
                
    $jsOut .= "\n            SUGAR.convert.{$module}Enabled = true;";
            } 
    replace with
    PHP Code:
            } else if (isset($viewdef['default_action'])  && $viewdef['default_action'] == "create")
            {
                
    $jsOut .= "
                YAHOO.util.Event.onDOMReady(SUGAR.convert.toggle$module);"
    ;
            } 
    This sets the validation to the right state for me.

    Regards,
    helping

  9. #9
    marclangston is offline Sugar Community Member
    Join Date
    Oct 2009
    Posts
    98

    Default Re: Customize the convert lead page

    Thanks for the follow up and advice. There may be some difference in the code between 6.1.0 (what I'm using) and 6.1.2 (which I think you are using). In the file modules\Leads\views\view.convertlead.php I don't have the exact "before" code you have shown - and the code that is there makes it difficult for me to see how I'm might implement a fix similar to the one you've used.

    Here's what I have (roughly lines 212 to 221; there is only one other instance of the code "SUGAR.convert" in this file and it's not preceded by the "[default_action]" references so I don't think it is relevant):

    Code:
            if (isset($viewdef['required']) && $viewdef['required'])
            {
                if (!empty($viewdef['select']) && (empty($viewdef['default_action']) || $viewdef['default_action'] != 'create'))
                {
                    $jsOut .= "
                SUGAR.convert.{$module}Enabled = true;";
                }
                $jsOut .= "
                YAHOO.util.Event.onDOMReady(SUGAR.convert.toggle$module);";
            }
    I'll think through the logic of the code you've suggested to see if I can come up with the way to make a similar change to this code. If you have any thoughts, I would of course be grateful.

    Thanks.
    marc

  10. #10
    helping is offline Member
    Join Date
    Jan 2011
    Posts
    8

    Default Re: Customize the convert lead page

    Hi marc,

    just look at the lines below the code you pasted above. There you will find the exact match of my search string:

    red: your post
    green: my search/replace

    Code:
            if (isset($viewdef['required']) && $viewdef['required'])
            {
                if (!empty($viewdef['select']) && (empty($viewdef['default_action']) || $viewdef['default_action'] != 'create'))
                {
                    $jsOut .= "
                SUGAR.convert.{$module}Enabled = true;";
                }
                $jsOut .= "
                YAHOO.util.Event.onDOMReady(SUGAR.convert.toggle$module);";
            } else if (isset($viewdef['default_action'])  && $viewdef['default_action'] == "create")
            {
    		//TMW
                $jsOut .= "
                YAHOO.util.Event.onDOMReady(SUGAR.convert.toggle$module);";
                // $jsOut .= "\n            SUGAR.convert.{$module}Enabled = true;";
            }
    
    		$jsOut .= "
                YAHOO.util.Event.addListener('new$module', 'click', SUGAR.convert.toggle$module);
                SUGAR.convert.requiredFields.$module = {};";
            foreach($focus->field_defs as $field => $def)
    Regards,
    helping

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How can you edit the Convert Lead page?
    By grecstar in forum General Discussion
    Replies: 17
    Last Post: 2012-02-03, 06:05 PM
  2. Hide Lead Convert page from user
    By Mithun in forum Developer Help
    Replies: 6
    Last Post: 2010-12-21, 02:30 PM
  3. Customizing "Convert Lead" Page
    By ktremblay in forum Developer Help
    Replies: 6
    Last Post: 2009-04-13, 05:53 AM
  4. Replies: 1
    Last Post: 2008-09-05, 11:30 AM
  5. Replies: 1
    Last Post: 2005-05-18, 02:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •