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

Thread: Assigned to field empty by default

  1. #1
    WEB11 is offline Senior Member
    Join Date
    Mar 2009
    Location
    Washington, DC
    Posts
    30

    Default Assigned to field empty by default

    Hello,

    I was wondering if anyone know how to make the Assigned to field empty by default in the cases module. We usually create the cases first and later assign them to someone, and that's usually not the person who creates the case.

    Thanks

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Assigned to field empty by default

    Hi Cássio

    Create a custom view.edit.php for Cases module containing something like that:
    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    require_once(
    'include/MVC/View/views/view.edit.php');

    class 
    CasesViewEdit extends ViewEdit {
        function 
    preDisplay() {
            
    parent::preDisplay();
            
            if(
    $this->bean->id == '') {
                
    $this->ev->focus->assigned_user_id '';
            }
        }
    }
    ?>
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    WEB11 is offline Senior Member
    Join Date
    Mar 2009
    Location
    Washington, DC
    Posts
    30

    Default Re: Assigned to field empty by default

    André,

    Thank you for the reply. I created the view.edit.php with the code above under custom/modules/Cases/metadata and ran a repar & rebuild but it didn't clear the assigned to field for new tickets. Was that the right folder?

  4. #4
    crmsiva's Avatar
    crmsiva is offline A Sugar Hero
    Join Date
    Jan 2009
    Location
    Chennai, India
    Posts
    1,130

    Default Re: Assigned to field empty by default

    You need to place the view.edit.php file in custom/modules/Cases/views. And there is no need for Repair/Rebuild.

  5. #5
    WEB11 is offline Senior Member
    Join Date
    Mar 2009
    Location
    Washington, DC
    Posts
    30

    Default Re: Assigned to field empty by default

    Yes that worked great! Thank you both of you.

  6. #6
    WEB11 is offline Senior Member
    Join Date
    Mar 2009
    Location
    Washington, DC
    Posts
    30

    Default Re: Assigned to field empty by default

    I just tried applying the same code to the meetings module but it wouldn't work.

    So I opened modules\meetings\views\view.edit.php and changed

    Code:
    require_once('include/json_config.php');
    require_once('include/MVC/View/views/view.edit.php');
    
    class MeetingsViewEdit extends ViewEdit {
    
     	function MeetingsViewEdit(){
     		parent::ViewEdit();
     	}
    
     	/**
     	 * preDisplay
     	 * Override preDisplay to check for presence of 'status' in $_REQUEST
     	 * This is to support the "Close And Create New" operation.
     	 */
     	function preDisplay() {
     		if(isset($_REQUEST['status']) && empty($_REQUEST['status'])) {
    	       $this->bean->status = '';
     		} //if
     		if(!empty($_REQUEST['status']) && ($_REQUEST['status'] == 'Held')) {
    	       $this->bean->status = 'Held';
     		} 		
     		
     		parent::preDisplay();
     	}
     	
     	function display() {
     		global $json;
            $json = getJSONobj();
            $json_config = new json_config();
    		if (isset($this->bean->json_id) && !empty ($this->bean->json_id)) {
    			$javascript = $json_config->get_static_json_server(false, true, 'Meetings', $this->bean->json_id);
    			
    		} else {
    			$this->bean->json_id = $this->bean->id;
    			$javascript = $json_config->get_static_json_server(false, true, 'Meetings', $this->bean->id);
    			
    		}
     		$this->ss->assign('JSON_CONFIG_JAVASCRIPT', $javascript);
     		if($this->ev->isDuplicate){
    	       $this->bean->status = $GLOBALS['mod_strings']['LBL_DEFAULT_STATUS'];
     		} //if
            
     		parent::display();
     	}
    }
    to:

    Code:
    require_once('include/json_config.php');
    require_once('include/MVC/View/views/view.edit.php');
    
    class MeetingsViewEdit extends ViewEdit {
        function preDisplay() {
            parent::preDisplay();
            
            if($this->bean->id == '') {
                $this->ev->focus->assigned_user_id = '';
            }
        }
    }
     	
     	function display() {
     		global $json;
            $json = getJSONobj();
            $json_config = new json_config();
    		if (isset($this->bean->json_id) && !empty ($this->bean->json_id)) {
    			$javascript = $json_config->get_static_json_server(false, true, 'Meetings', $this->bean->json_id);
    			
    		} else {
    			$this->bean->json_id = $this->bean->id;
    			$javascript = $json_config->get_static_json_server(false, true, 'Meetings', $this->bean->id);
    			
    		}
     		$this->ss->assign('JSON_CONFIG_JAVASCRIPT', $javascript);
     		if($this->ev->isDuplicate){
    	       $this->bean->status = $GLOBALS['mod_strings']['LBL_DEFAULT_STATUS'];
     		} //if
            
     		parent::display();
     	}
    It seems to work but I don't know if it will break something else...
    Last edited by WEB11; 2009-03-31 at 07:24 PM.

  7. #7
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Assigned to field empty by default

    Quote Originally Posted by WEB11 View Post
    I just tried applying the same code to the meetings module but it wouldn't work.

    So I opened modules\meetings\views\view.edit.php and changed

    Code:
    require_once('include/json_config.php');
    require_once('include/MVC/View/views/view.edit.php');
    
    class MeetingsViewEdit extends ViewEdit {
    
     	function MeetingsViewEdit(){
     		parent::ViewEdit();
     	}
    
     	/**
     	 * preDisplay
     	 * Override preDisplay to check for presence of 'status' in $_REQUEST
     	 * This is to support the "Close And Create New" operation.
     	 */
     	function preDisplay() {
     		if(isset($_REQUEST['status']) && empty($_REQUEST['status'])) {
    	       $this->bean->status = '';
     		} //if
     		if(!empty($_REQUEST['status']) && ($_REQUEST['status'] == 'Held')) {
    	       $this->bean->status = 'Held';
     		} 		
     		
     		parent::preDisplay();
     	}
     	
     	function display() {
     		global $json;
            $json = getJSONobj();
            $json_config = new json_config();
    		if (isset($this->bean->json_id) && !empty ($this->bean->json_id)) {
    			$javascript = $json_config->get_static_json_server(false, true, 'Meetings', $this->bean->json_id);
    			
    		} else {
    			$this->bean->json_id = $this->bean->id;
    			$javascript = $json_config->get_static_json_server(false, true, 'Meetings', $this->bean->id);
    			
    		}
     		$this->ss->assign('JSON_CONFIG_JAVASCRIPT', $javascript);
     		if($this->ev->isDuplicate){
    	       $this->bean->status = $GLOBALS['mod_strings']['LBL_DEFAULT_STATUS'];
     		} //if
            
     		parent::display();
     	}
    }
    to:

    Code:
    require_once('include/json_config.php');
    require_once('include/MVC/View/views/view.edit.php');
    
    class MeetingsViewEdit extends ViewEdit {
        function preDisplay() {
            parent::preDisplay();
            
            if($this->bean->id == '') {
                $this->ev->focus->assigned_user_id = '';
            }
        }
    }
     	
     	function display() {
     		global $json;
            $json = getJSONobj();
            $json_config = new json_config();
    		if (isset($this->bean->json_id) && !empty ($this->bean->json_id)) {
    			$javascript = $json_config->get_static_json_server(false, true, 'Meetings', $this->bean->json_id);
    			
    		} else {
    			$this->bean->json_id = $this->bean->id;
    			$javascript = $json_config->get_static_json_server(false, true, 'Meetings', $this->bean->id);
    			
    		}
     		$this->ss->assign('JSON_CONFIG_JAVASCRIPT', $javascript);
     		if($this->ev->isDuplicate){
    	       $this->bean->status = $GLOBALS['mod_strings']['LBL_DEFAULT_STATUS'];
     		} //if
            
     		parent::display();
     	}
    It seems to work but I don't know if it will break something else...
    You should copy the original view to custom folder.
    Always keep unchanged the original core file.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  8. #8
    rolandli is offline Junior Member
    Join Date
    Mar 2010
    Posts
    4

    Default Re: Assigned to field empty by default

    I am trying to do the same for Tasks module, but I want to do it for the Quick Create panel. Can someone point me a direction which file to edit in order to achieve this. Thank you!

  9. #9
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Assigned to field empty by default

    My previous suggestion should work without big deal, once Quick Create and Full Form share the same view.edit.php.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  10. #10
    rolandli is offline Junior Member
    Join Date
    Mar 2010
    Posts
    4

    Default Re: Assigned to field empty by default

    Hi andopes,

    Thanks for your reply. That's what I though too, but it's not working for me.

    I created a file custom/modules/Tasks/views/view.edit.php with the following content:

    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    require_once(
    'include/MVC/View/views/view.edit.php');

    class 
    TasksViewEdit extends ViewEdit {
        function 
    preDisplay() {
            
    parent::preDisplay();

            if(
    $this->bean->id == '') {
                
    $this->ev->focus->assigned_user_id '';
            }
        }
    }
    ?>

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. Replies: 1
    Last Post: 2009-07-13, 08:16 AM
  2. Replies: 2
    Last Post: 2008-03-05, 06:12 AM
  3. Populating Assigned to: by default
    By lambi in forum Customer Support
    Replies: 0
    Last Post: 2007-02-09, 03:56 AM
  4. Replies: 0
    Last Post: 2005-09-14, 06:31 PM
  5. Default Assigned To:
    By ScottD in forum Help
    Replies: 2
    Last Post: 2005-08-04, 11:18 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
  •