Results 1 to 4 of 4

Thread: Custom SugarFieldRelate.php -> Fatal error cannot redeclare class

  1. #1
    houlejo is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    Qc, Canada
    Posts
    116

    Exclamation Custom SugarFieldRelate.php -> Fatal error cannot redeclare class

    Hi,

    I did a modification in the file SugarFieldRelate.php.
    I copied my modified file in custom/include/SugarFields/Fields/Relate/SugarFieldRelate.php

    My modification is working, but I have a couple of errors like this one :

    Fatal error: Cannot redeclare class SugarFieldRelate in /home/XXX/public_html/xxx/xxx/include/SugarFields/Fields/Relate/SugarFieldRelate.php on line 368

    It seems that Sugar is trying to use both of the SugarFieldRelate.php. The original one and the custom one.

    What's wrong in what I did ?

    Thanks!!!

  2. #2
    houlejo is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    Qc, Canada
    Posts
    116

    Default Re: Custom SugarFieldRelate.php -> Fatal error cannot redeclare class

    I guess I should give more info on what I want to do :

    I want to extend the function of the Contact relate field that fill the account name, address and phone.

    I want to also fill the fax and description.

    The way I found was to add hidden field in the account popupdefs.php (phone_fax and description with default = false).

    Also, I modified the copy_phone function in the SugarFieldRelate.php to also copy phone_fax and description.

    But I guess that my way is not good because it modify the Relate field for all the modules...

    What would be the Sugar Way upgrade-safe ?

    Thanks.

  3. #3
    houlejo is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    Qc, Canada
    Posts
    116

    Thumbs up Re: Custom SugarFieldRelate.php -> Fatal error cannot redeclare class

    Ok I figured it out.

    So for all people that will look for that :

    This is how I added some fields to auto populate from account popup to contact.
    In my example, I added the copy of the phone fax and the description.

    To add in /custom/account/metadata/popupdefs.php
    Why : We want those field to be available (but hidden) in the popup view.

    PHP Code:
            'PHONE_OFFICE' => array(
                
    'width' => '10'
                
    'label' => 'LBL_LIST_PHONE',
                
    'default' => false
            
    ),
            
    //ADD those lines for fax
            
    'PHONE_FAX' => array(
                
    'width' => '10'
                
    'label' => 'LBL_PHONE_FAX',
                
    'default' => false
            
    ),
            
    //ADD those lines for description
            
    'DESCRIPTION' => array(
                
    'width' => '10'
                
    'label' => 'LBL_DESCRIPTION',
                
    'default' => false
            
    ), 
    Then, modify the /custom/contact/metadata/editviewdefs.php like this :

    PHP Code:
    array (
                
    'name' => 'account_name',
                
    'displayParams' => 
                array (
                  
    'field_to_name_array' => array(
                      
    'id' => 'account_id',
                    
    'name' => 'account_name',
                    
    'billing_address_street' => 'primary_address_street',
                    
    'billing_address_city' => 'primary_address_city',
                    
    'billing_address_state' => 'primary_address_state',
                    
    'billing_address_postalcode' => 'primary_address_postalcode',
                    
    'billing_address_country' => 'primary_address_country',
                    
    'phone_office' => 'phone_work',
                    
    'phone_fax' => 'phone_fax',
                    
    'description' => 'description',),
                 
    //Comment those lines so you can override the normal function
                 // 'key' => 'billing',
                //  'copy' => 'primary',
                 // 'billingKey' => 'primary',
                 // 'additionalFields' => array (
                 //   'phone_office' => 'phone_work',        
                 // ),
                
    ),
              ), 

  4. #4
    houlejo is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    Qc, Canada
    Posts
    116

    Default Re: Custom SugarFieldRelate.php -> Fatal error cannot redeclare class

    By the way, do a Quick repair and rebuild after.

    I did this on a 6.2.2 CE version and a 6.2.0 CE version.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Fatal error: Cannot redeclare class Tracker
    By publisirius in forum Help
    Replies: 5
    Last Post: 2009-12-21, 09:50 PM
  2. Re: Fatal error: Cannot redeclare class Tracker
    By manishbunty31 in forum Help
    Replies: 1
    Last Post: 2009-07-18, 03:33 AM
  3. Replies: 4
    Last Post: 2009-03-26, 03:12 AM
  4. New Install - Fatal error: Cannot redeclare class user
    By csiddall in forum Installation and Upgrade Help
    Replies: 1
    Last Post: 2007-04-14, 07:14 PM
  5. Fatal error: Cannot redeclare class soapclient
    By preginald in forum Web Self Service Portal
    Replies: 0
    Last Post: 2007-04-12, 01:22 AM

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
  •