Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-10121

Make new contact code more generic

    Details

    • Type: Patch
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.2.0
    • Component/s: None
    • Labels:
      None

      Description

      This is just a patch towards http://wiki.civicrm.org/confluence/display/CRM/Technical+Specs

      While I'd like to get the ability to record payment from a different contact into 4.2 I need some more input from DGG first.

      This part is discrete- it just allows the NewContact fields to be added to a form without the destination field being completely hard coded. i.e @ the moment the field contact_select_id is always populated (& that field has specific handling @ the form layer). This allows you to call that with a prefix so contribution_contact_select_id is populated instead

      Index: CRM/Contact/Form/NewContact.php

      ===================================================================

      — CRM/Contact/Form/NewContact.php (revision 70)

      +++ CRM/Contact/Form/NewContact.php (working copy)

      @@ -51,11 +51,11 @@

      • @access public
      • @return void

      */

      • function buildQuickForm( &$form, $blockNo = 1, $extraProfiles = null ) {

      + function buildQuickForm( &$form, $blockNo = 1, $extraProfiles = null, $pref ix = '' ) {

      // call to build contact autocomplete

      $attributes = array( 'width' => '200px' );

      $form->add('text', "contact[{$blockNo}]", ts('Select Contact'), $attrib utes );

      • $form->addElement('hidden', "contact_select_id[{$blockNo}]" );

      + $form->addElement('hidden', "$prefix" . "contact_select_id[{$blockNo}]" );

      if ( CRM_Core_Permission::check( 'edit all contacts' ) ||

      CRM_Core_Permission::check( 'add contacts' ) )

      { @@ -68,5 +68,6 @@ }

      $form->assign( 'blockNo', $blockNo );

      + $form->assign( 'prefix', $prefix );

      }

      }

      Index: templates/CRM/Contact/Form/NewContact.tpl

      ===================================================================

      — templates/CRM/Contact/Form/NewContact.tpl (revision 70)

      +++ templates/CRM/Contact/Form/NewContact.tpl (working copy)

      @@ -113,7 +113,7 @@

      {/literal}{/if}{literal}



      var contactElement = '#contact_' + blockNo;

      - var contactHiddenElement = 'input[name="contact_select_id[' + blockNo +']"]';

      + var contactHiddenElement = 'input[name="{/literal}

      {$prefix}

      {literal}

      contact_select_id[' + blockNo +']"]';

      cj( contactElement ).autocomplete( contactUrl,

      { selectFirst : false, matchContains: true, minChars: 1 }

      ).result( function(event, data, formatted) {

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: