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) »
  • Hiding or removing Shared Household block in add / edit Individuals page?
Pages: [1]

Author Topic: Hiding or removing Shared Household block in add / edit Individuals page?  (Read 1075 times)

gibsonoliver

  • I post occasionally
  • **
  • Posts: 65
  • Karma: 2
    • Northbridge Digital
Hiding or removing Shared Household block in add / edit Individuals page?
January 30, 2009, 05:17:45 am
Hi There

Ive been creating some custom TPL's and hacked some of the PHP (for example removed Instant Messaging and Open ID from the Individuals edit page - Location.php). I now need to remove the Shared Household Block option from the edit individuals page.

Is this done by altering the PHP below? If so what what is the best way of doing this? Yours with thanks Oliver

{* -- Javascript for showing/hiding the shared household options -- *}
{literal}
<script type="text/javascript">
   
 function showSelectedAddress( val )
 {
    var help = val+'_help';
    var address = val+'_address';
    if ( document.getElementsByName("use_household_address")[0].checked == true ) {
   hide('shared_household', 'block');
   hide('id_location_1_address');
    }
    var contactId = dijit.byId(val).getValue();
    if ( isNaN( contactId ) ) {
   document.getElementById(address).innerHTML = {/literal}"({ts}New Contact Record{/ts})"{literal};
   if ( val == 'shared_household' ) {
       hide('shared_household', 'block');
       show('id_location_1_address', 'block');      
   }   
   return;
    }

    if ( val == 'shared_household' ) {      
   var dataUrl = {/literal}"{crmURL p='civicrm/ajax/search' h=0 q='sh=1&id='}"{literal} + contactId;
    } else {
   var dataUrl = {/literal}"{crmURL p='civicrm/ajax/search' h=0 q='sh=2&id='}"{literal} + contactId;
    }

    dojo.xhrGet( {
           url: dataUrl,
      handleAs: "text",
      timeout: 5000, // Time in milliseconds
      
      // The LOAD function will be called on a successful response.
      load: function(response, ioArgs) {
      var selectedAddr = response;
      
      if ( selectedAddr != "" ) {
          var ind = selectedAddr.indexOf(':::');
          if ( ind < 0){
         var formattedAddr = '';   
          } else {
         selectedAddr = selectedAddr.substr(ind+3);
         var formattedAddr = selectedAddr.replace(/:::/g, ", ");
          }
          document.getElementById(address).innerHTML = formattedAddr;      

      } else {
          document.getElementById(address).innerHTML = '';   
      }
      return response;
       },
      
      // The ERROR function will be called in an error case.
      error: function(response, ioArgs) {
          console.error("HTTP status code: ", ioArgs.xhr.status);
          return response;
      }
   });
 }
« Last Edit: January 30, 2009, 05:23:04 am by gibsonoliver »
Oliver Gibson, Northbridge Digital

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Hiding Shared Household option in
January 30, 2009, 05:24:13 am
I usually just wrap that line in a div with a style="display: none;" in the .tpl file.
(if it's a table cell -- I don't recall of the top of my head -- then add the style declaration to the tr tag)

Not the most elegant solution, but it addresses the fact that you can't simply remove the line from the .tpl or it breaks the page.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Hiding or removing Shared Household block in add / edit Individuals page?

This forum was archived on 2017-11-26.