1

I ran into this problem for a client who needs to specify, when renewing a membership, the bank name.

So I decided to store this value into contribution note, but when renewing, this field does not appears in the form.

I added this on line 409 of CRM_Member_Form_MembershipRenewal.php

   $this->add('text', 'contribution_note', ts('Note'),
    CRM_Core_DAO::getAttribute('CRM_Core_DAO_Note', 'note')
  );

And this on line 730 of CRM_Member_Form_MembershipRenewal.php

$note = new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_contribution';
$note->entity_id = $temporaryParams['contribution_id'];
$note->note = $formValues['contribution_note'];      
$note->contact_id = $formValues['contact_id'];
$note->modified_date = CRM_Utils_Date::getToday();
$note->privacy = 0;
$note->save();    

Here is the .tpl modification on line 176

<tr id="contributionNote" class="crm-member-membershiprenew-form-block-contribution_note">
<td class="label">{$form.contribution_note.label}</td>
<td>{$form.contribution_note.html}</td>
</tr>

1 Answer 1

1

I would advise you to avoid changing the core files (php or template). You should write an extension that adds the field (in the buildform hook) and save it whilst processing the form.

However, It might be better to use other ways to save that information. The financial type for instance where you can create several, based on the bank (assuming it's the client bank) or use the check number or source (both existing fields in the contribution) if it's an information about the member's bank.

1
  • Thanks a lot Xavier, we decided to use check number to store the bank name ! Commented Apr 16, 2015 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.