History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CRM-2964
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed/Completed
Priority: Major Major
Assignee: mari tilos
Reporter: David Greenberg
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
CiviCRM

Online Contribution / Membership Signup on Behalf of an Organization

Created: 09/Apr/08 01:08 AM   Updated: 18/Sep/08 02:35 AM
Component/s: CiviContribute, CiviMember
Affects Version/s: 2.1
Fix Version/s: 2.1

Time Tracking:
Not Specified

Issue Links:
Suplementation
 

Verified for 2.1: Yes
Verified for 2.0: No


 Description  « Hide
(This specification supports the use cases described here: http://blog.civicrm.org/node/318 )

1. Configure Online Contribution Page
==============================
1.1 Add a boolean flag and a text field to Contribution Page object (civicrm_contribution_page) which enables the "On behalf of an organization" feature and allows user to customize the prompt:

- is_for_organization boolean default 0
++ If enabled, the contribution page will allow a contact to contribute or signup or renew a membership on behalf of an organization.

- for_organization_text varchar 255 default NULL
++ Field label for the checkbox to include on contribution form.

1.2 Add fields to Configure Contribution Page - Title and Settings form
- is_for_organization = checkbox, label = "Allow individuals to contribute and / or signup for membership on behalf of an organization?"
- for_organization_text = text field, label = "On behalf of label"
++ This text field is shown when is_for_organization is checked. Form setDefaults() provides default text for the field: "I am contributing on behalf on an organization"

1.3 Note the "DB upgrade task" on wiki : http://wiki.civicrm.org/confluence/display/CRM/Upgrade+Requirements+-+2.0+to+2.1

2. Changes to Online Contribution Page (contribute/transact)
===============================================
2.1 If is_for_organization is true, include a checkbox with the for_organization_text label just below the Email Address field.

2.2 If for_organization checked by contributor, use Ajax/dojo to load a fieldset below the checkbox consisting of the following fields:
Organization Name
(all address fields as configured in preferences.address_options)
Email Address
Phone

- Copy the email address entered in the main Email Address field (email-5) to the Organization Email field using javascript.
- Organization Name and Email are required. All other fields are optional.

NOTE: This is the same set of fields provided for permissioned contacts to edit "their related contacts" via the Contact Dashboard - as specified here: http://issues.civicrm.org/jira/browse/CRM-2963

2.3 Logic for authenticated user
If the individual is authenticated, we can check for existing permissioned employee<->employer relationships. If found, use the radio button + dojoComboBox interface to allow them to select an existing related organization or enter a new one.

2.4 Post Process steps
When for_organization is true - we will be either finding matching contact records or creating contact records for both the Individual (who is filling out the form) as well as for the "on behalf of" organization. The create / update contact logic for the submitting individual should not need to be modified. For the organization contact:

- Use the configured Duplicate Contact Rules for Organizations to determine if this is an existing contact Org record or not.
++ If NO match found: Create organization contact with the form field values (on behalf of org fieldset)
++ if SINGLE match found: Use found contact record id - and update the contact data with any non-blank values from the submitted form (including org name, address, email or phone info).
++ If MORE THAN ONE match found : Do NOT use matching contact ID. Handle this as a NO match case (insert contact, link new contact to contrib etc.). AND send an email to the civicrm_contribution_page.receipt_from_email alerting that there is a possible duplicate contact situation. (see below for content of this email)

- Check for existing employee - employer relationship between individual and organization. Create if relationship if needed. Set is_permission_a_b = true.

- Use the ORGANIZATION contact ID when creating the contribution record. If this is a membership signup case, also use ORGANIZATION contact ID in membership record.

- If receipt is generated, and Organization Email is ! = Individual's Email - then send receipt to BOTH addresses.

3. Online Membership Renewals
==========================
When an authenticated user goes to an Online Contribution page which includes a Membership Block - we currently check to see if they have an existing membership matching one of the membership types included in the block. If true, we display status and expiration date of that membership next to it's radio button option. Post process then renews the membership. In order to support "on behalf of" memberships - we need to know which membership the user wants to renew. The "infrastructure" for this is to allow a membership ID to be passed in to Online Contribution pages - see http://issues.civicrm.org/jira/browse/CRM-2971 for the implementation of this functionality.

3.1 If a valid membership id (mid=x) is passed AND that membership ID is for a related (permissioned) organization - then set the for_organization checkbox to "CHECKED" and load the member (organization) contact data into the organization fieldset FROZEN (read-only).

3.2 PostProcess should then renew the specified membership for the organization.

4. Email Alert for Duplicate Organization Warning
======================================
This email is sent only when we insert an "on behalf of organization" contact record because we found MORE THAN ONE matching existing organization contact using the default strict dupe matching rule.

Subject: Possible Duplicate Contact Record
-----Body -----------
The contribution listed below was submitted on behalf of an organization, and the organization information matches existing records in your database. Please review the following record:

http://&lt;link to view the inserted organization contact record>

If you think this may be a duplicate contact which should be merged with an existing record - use the following link to identify the potential duplicates and merge them if appropriate:

http://&lt;link to Find Dupes function>

***********************************************************
--- (Put copy of entire contribution receipt here )----

--- End Body of Email ----

NOTE: If we support this (check w/ Piotr or Pankaj), add a param in the Find Dupes link in the email (above) which tells that function to look for dupes OF THE INSERTED CONTACT. Otherwise - just put in a generic link to that page (...civicrm/admin/deduperules?reset=1)
 

 All   Comments   Work Log   Change History   FishEye      Sort Order:
David Greenberg - 10/Apr/08 01:13 AM
Clarified how renewals are handled - based on passing in membership ID.

David Greenberg - 30/Apr/08 12:06 AM
Changed Post Process logic for case where we find a matching organization. For now, we'll just get / use the org's contact ID and ignore the rest of the info submitted by the user (this prevents the possiblity that someone submits false or incorrect org info, replacing valid data w/ incorrect data in the DB).

Also, until the new deDupe framework is solidified - use our existing Contact Matching rule to check for existing organization (e.g. org name only)

David Greenberg - 22/May/08 11:26 PM
Modified the rules for handling cases where submitted organization appears to be a duplicate of an existing record.

Deepak Srivastava - 26/May/08 02:11 PM
Assigning for QA.

David Greenberg - 06/Jun/08 02:09 AM
Exceptions from testing w/ r14952
===========================
* Access denied on civicrm/ajax/countries, states and civicrm/ajax/employer comboBox paths when access CiviCRM = False. These ajax combo-boxes need to work with "access CiviCRM" = FALSE since anonymous users and authenticated users w/o access CiviCRM permission will be making online contribs etc. (I tried to fix this in Misc.xml and Core/Menu.php - but didn't get it to work. I mentioned it to Kurund but not sure if / when he'll be able to fix it.)

* Duplicate "Billing Addresses" where created for the main (individual) contact when I did a Membership Signup followed by a contribution ?? (e.g. I had 2 civicrm_address records for the same contact - both w/ location_type_id = 5).

* civicrm_contribution.receipt_date for the contribution inserted during membership signup is NULL. Should have current date since the contrib page is configured to send a receipt.

* Looks like location type is not being set for organization email / address ... we don't have a "default" location type that makes sense for Organizations - so not sure what to do here?? Could just set it to "Main" if that loc type exists (id = 3) ?? Let's discuss this.

* The function which triggers "create membership" for a related contact (based on civicrm_membership_type.relationship_type_id) is not being invoked in the contribution postProcess. To recreate:
- create new membership type "Corporate" with Relationship Type = "Employer of".
- configure contrib page 2 Membership Block to include this membership type (and enable On Behalf of)
- signup for "Corporate" membership "on behalf of" an organization
Current results are: 1 individual contact, 1 org contact, 1 relationship, 1 membership for the organization.
Expected results: a membership should also have been created for the individual since they are an "Employee of" the organization (w/ owner_membership_id = org contact.id)

* Please condense OnBehalf.tpl into a single fieldset - minimizing vertical scrolling requirements.

Deepak Srivastava - 20/Jun/08 07:56 AM
- fixed & checked for rev: 15242