Givewp: feat(form): display Company field in donation form

Created on 5 Dec 2017  路  8Comments  路  Source: impress-org/givewp

User Story

As a donor, I want to associate my donation with my company so that it is clear that the contribution came from my organization rather than just myself.

Current Behavior

I currently cannot indicate that a donation is on behalf of my company because there is no field to do so.

Expected Behavior

I expect to see a Company field that is common across many web forms to indicate my company.

Possible Solution

Allow a user to enable company donations in the Form Display settings. Doing so will add a Company field immediately after the name fields in the donation form. The company should be saved as donor meta and appear within the Donor details screen.

Tasks

  • [x] Get these implementation tasks approved by @ravinderk.
  • [x] Add global Company Donations radio buttons setting with Disabled|Required|Optional options where the Default option will be Disabled
  • [x] Add form Company Donations radio buttons setting with Disabled|Required|Optional|Global options. where the Default option will be Global
  • [x] Include description Do you want a Company field to appear after First Name and Last Name?
  • [x] Ensure Company field appears on the front-end form if the setting is enabled. The Company field should be a full-width field that appears below First Name and Last Name. The name fields must always be present even if a company field is displayed, too.
  • [x] Save Company field to payment meta as _give_donation_company so it is permanently preserved.
  • [x] Save Company field to donor meta as _give_donor_company and update the donor meta if a company was previously entered for that donor.
  • [x] Display Company field in Donor details screen if it is populated.
  • [x] Add company for the field on donor profile shortcode page.
  • [x] Add feature to show company name on a receipt ( by default hide )
  • [x] Add feature to show company name in email receipts.
  • [ ] Testing

Most helpful comment

First Name/Last Name followed by a Company field is an extremely common pattern on forms across the web, and I think that's the simplest approach here.

Back-end

  • Company Field

    • No Company Field

    • Optional Company Field

    • Required Company Field

Front-end

  • If show_company === true then display company field between name and email.
  • If show_company === true && require_company === true then show and require the company field.

All 8 comments

Nice Suggestion @mathetos

Here I have try to create a small mock of what you are saying
Dashboard Form edit section:
image

Form with Individual field selected
image

Form with Company Fiedls selected
image

Interesting concepts @raftaar1191 - We still want to collect the person's name that's donating on behalf of the company. It would be difficult to shift how our data structure works to swap our name for company.

First Name/Last Name followed by a Company field is an extremely common pattern on forms across the web, and I think that's the simplest approach here.

Back-end

  • Company Field

    • No Company Field

    • Optional Company Field

    • Required Company Field

Front-end

  • If show_company === true then display company field between name and email.
  • If show_company === true && require_company === true then show and require the company field.

If the customers requesting this feature want to see donations by company rather than individual, then that is something that should be handled via reports. We should not have to alter Give's data structure to accommodate it.

In addition, having an individual to tie the donation back to is necessary for many reasons. If you receive a large donation from a company and it is pending, then you need to know who to contact. Many other reasons but you get the picture.

@ravinderk Please see my updated task list above for implementation details, specifically whether you agree that this should be donor meta as I described. Reply here if you approve or have changes.

@raftaar1191 Once Ravinder has approved, move forward with the tasks as defined.

@kevinwhoffman List looks good to me. I have following question and suggestion.

  1. Will company field required by default? if not then I want to suggest to add flexibility to code to make it required if the customer wants by custom code.
  2. Rare case but the donor can change their company and donate with updated company profile. I will always suggest store donation form data into donation meta only. By this way, donation history will not overwrite for the donor. A donor can only have one company at a time, so when donation complete we will compare donor company if change then we can update it. By this way, donor profile always shows updated company name and donation history remain same.

Will company field be required by default? If not then I want to suggest to add flexibility to code to make it required if the customer wants by custom code.

Good question. Lets go with Disabled|Required|Optional as the radio button options so the user can decide if it's required or optional.

...the donor can change their company and donate with updated company profile. I will always suggest store donation form data into donation meta only. By this way, donation history will not overwrite for the donor.

I think you are right we should store the company as donation meta so that the company entered in the donation form is permanently recorded for that donation. But we should also record it in donor meta to associate the company with the individual so it can be displayed in the donor details screen.

To summarize, the company in donation meta never changes, but the company in donor meta gets updated based on the most recent donation in which that donor supplied a company.

I will update the tasks to reflect this approach. Thanks @ravinderk.

Slack Call Summary

Participants: @raftaar1191, @ravinderk
Topic: Discussion on Task List
Result: As discussion with @ravinderk over call on how the flow of the donation will be when company name fields will be added and also update the Task list for the same

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ravinderk picture ravinderk  路  4Comments

mathetos picture mathetos  路  3Comments

henryholtgeerts picture henryholtgeerts  路  3Comments

emgk picture emgk  路  3Comments

mathetos picture mathetos  路  4Comments