CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Customizing fields entered / displayed for contacts
Pages: [1]

Author Topic: Customizing fields entered / displayed for contacts  (Read 870 times)

ccowens

  • Guest
Customizing fields entered / displayed for contacts
April 09, 2010, 09:02:15 am
In the object model I am using, Households do not have e-mail addresses -- e-mail addresses belong only to Individuals.

That means that I would like  to eliminate all mention of, display of, or prompting for e-mail addresses every time a Household is created, edited, or displayed.

I'm not sure whether I ought to be doing this at the data abstraction level, or at the template level.

I am willing to create a new contact type, e.g. "X-household" which is  a subtype of "Household"

Suggestions, anyone?

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Customizing fields entered / displayed for contacts
April 09, 2010, 11:47:13 am
I think you are best off removing the email options from the templates. The fact that the possibility is in the database will not hurt you. Templates would be my bet for the quickest route.
Good luck!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

ccowens

  • Guest
Re: Customizing fields entered / displayed for contacts
April 11, 2010, 10:07:41 am
For the time being, I accomplished what I want by hacking CRM/Contact/Form/Contact.php to exclude the unwanted blocks by modifying the code right after 240, but that seems mighty ugly.  Is there a more appropriate way to do this using a hook?

Code: [Select]
       

// get the location blocks.                                                                                                               
        $this->_blocks = $this->get( 'blocks' );

        if ( CRM_Utils_System::isNull( $this->_blocks ) ) {
            $this->_blocks = CRM_Core_BAO_Preferences::valueOptions( 'contact_edit_options', true, null,
                                                                     false, 'name', true, 'AND v.filter = 1' );
            // ditch email, im, etc. for household                                                                                               
            if ( $this->_contactType == 'Household' ) {
              $this->_blocks = array('Phone' => 'Phone');
            }
            $this->set( 'blocks', $this->_blocks );

        }
        $this->assign( 'blocks', $this->_blocks );

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Customizing fields entered / displayed for contacts
April 11, 2010, 11:26:29 am
I think you could get the same result with the buildForm hook?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Customizing fields entered / displayed for contacts

This forum was archived on 2017-11-26.