Contact Dashboard - cleanup and remove unused code
authorColeman Watts <coleman@civicrm.org>
Thu, 1 May 2014 17:40:14 +0000 (10:40 -0700)
committerColeman Watts <coleman@civicrm.org>
Thu, 1 May 2014 17:40:14 +0000 (10:40 -0700)
CRM/Contact/BAO/Contact/Utils.php
CRM/Contact/Form/RelatedContact.php
templates/CRM/Contact/Form/OnBehalfOf.tpl

index 7a5556547ebd8afda5770c314f333a8256107239..af58ad11d5fca8c0332ecbe9b2ca056048bf8b01 100644 (file)
@@ -461,23 +461,13 @@ WHERE id={$contactId}; ";
    * @static
    *
    */
-  static function buildOnBehalfForm(&$form,
-    $contactType       = 'Individual',
-    $countryID         = NULL,
-    $stateID           = NULL,
-    $title             = 'Contact Information',
-    $contactEditMode   = FALSE,
-    $maxLocationBlocks = 1
-  ) {
-    if ($title == 'Contact Information') {
-      $title = ts('Contact Information');
-    }
+  static function buildOnBehalfForm(&$form, $contactType, $countryID, $stateID, $title) {
 
     $config = CRM_Core_Config::singleton();
 
     $form->assign('contact_type', $contactType);
     $form->assign('fieldSetTitle', $title);
-    $form->assign('contactEditMode', $contactEditMode);
+    $form->assign('contactEditMode', TRUE);
 
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
     if ($form->_contactId) {
@@ -486,41 +476,11 @@ WHERE id={$contactId}; ";
 
     switch ($contactType) {
       case 'Organization':
-        $session = CRM_Core_Session::singleton();
-        $contactID = $session->get('userID');
-
-        if ($contactID) {
-          $employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($contactID);
-        }
-
-        $locDataURL = CRM_Utils_System::url('civicrm/ajax/permlocation', 'cid=', FALSE, NULL, FALSE);
-        $form->assign('locDataURL', $locDataURL);
-
-        if (!$contactEditMode && $contactID && (count($employers) >= 1)) {
-
-          $dataURL = CRM_Utils_System::url('civicrm/ajax/employer',
-            'cid=' . $contactID,
-            FALSE, NULL, FALSE
-          );
-          $form->assign('employerDataURL', $dataURL);
-
-          $form->add('text', 'organization_id', ts('Select an existing related Organization OR Enter a new one'));
-          $form->add('hidden', 'onbehalfof_id', '', array('id' => 'onbehalfof_id'));
-          $orgOptions = array('0' => ts('Create new organization'),
-            '1' => ts('Select existing organization'),
-          );
-          $orgOptionExtra = array('onclick' => "showHideByValue('org_option','true','select_org','table-row','radio',true);showHideByValue('org_option','true','create_org','table-row','radio',false);");
-          $form->addRadio('org_option', ts('options'), $orgOptions, $orgOptionExtra);
-          $form->assign('relatedOrganizationFound', TRUE);
-        }
-
         $form->add('text', 'organization_name', ts('Organization Name'), $attributes['organization_name'], TRUE);
         break;
 
       case 'Household':
-        $form->add('text', 'household_name', ts('Household Name'),
-          $attributes['household_name']
-        );
+        $form->add('text', 'household_name', ts('Household Name'),  $attributes['household_name']);
         break;
 
       default:
index a685e6343c79fe015e7b5b9a577e4b9ca90b7994..03edc2abfb854f16d5c5fcf49385c5f09b4d12a9 100644 (file)
@@ -140,8 +140,7 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form {
       $this->_contactType,
       $countryID,
       $stateID,
-      'Contact Information',
-      TRUE
+      ts('Contact Information')
     );
 
     $this->addButtons(array(
index b8a074e90ff7a4f6613f1b2f18a11b9a538d708e..38e0a294bdb811910e88fbd639465472dd490dd5 100644 (file)
    <fieldset><legend></legend>
  {/if}
   <div class="crm-section organizationName-section">
-      {if $relatedOrganizationFound}
-      <div class="section crm-section">
-    <div class="content">{$form.org_option.html}</div>
-      </div>
-      <div id="select_org" class="crm-section select_org-section">
-        <div class="label">{$form.organization_name.label}</div>
-        <div class="content">{$form.organization_id.html|crmAddClass:big}</div>
-      </div>
-      {/if}
       <div id="create_org" class="crm-section create_org-section">
     <div class="label">{$form.organization_name.label}</div>
         <div class="content">{$form.organization_name.html|crmAddClass:big}</div>
          invert              = "false"
     }
 {/if}
-
-{literal}
-<script type="text/javascript">
-{/literal}
-{* If mid present in the url, take the required action (poping up related existing contact ..etc) *}
-{if $membershipContactID}
-    {literal}
-    cj( function( ) {
-        cj( '#organization_id' ).val("{/literal}{$membershipContactName}{literal}");
-        cj( '#organization_name' ).val("{/literal}{$membershipContactName}{literal}");
-        cj( '#onbehalfof_id' ).val("{/literal}{$membershipContactID}{literal}");
-        setLocationDetails( "{/literal}{$membershipContactID}{literal}" );
-    });
-    {/literal}
-{/if}
-{* Javascript method to populate the location fields when a different existing related contact is selected *}
-{literal}
-    var dataUrl   = "{/literal}{$employerDataURL}{literal}";
-    cj('#organization_id').autocomplete( dataUrl, { width : 180, selectFirst : false, matchContains: true, max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal}
-    }).result( function(event, data, formatted) {
-        cj('#organization_name').val( data[0] );
-        cj('#onbehalfof_id').val( data[1] );
-        setLocationDetails( data[1] );
-    });
-
-    var orgId = {/literal}"{$orgId}"{literal};
-    if ( orgId ) {
-        setLocationDetails( orgId );
-    }
-
-    function setLocationDetails( contactID ) {
-        var locationUrl = {/literal}"{$locDataURL}"{literal}+ contactID + "&relContact=1";
-
-        cj.ajax({
-            url         : locationUrl,
-            dataType    : "json",
-            timeout     : 5000, //Time in milliseconds
-            success     : function( data, status ) {
-                for (var ele in data) {
-                    cj( "#"+ele ).val( data[ele] );
-                }
-            },
-            error       : function( XMLHttpRequest, textStatus, errorThrown ) {
-                console.error("HTTP error status: ", textStatus);
-            }
-        });
-    }
-</script>
-{/literal}