Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-21427 - Add form validation to make it clear we only allow a single website of each type #12582

Closed
wants to merge 1 commit into from

Conversation

gboudrias
Copy link
Contributor

@gboudrias gboudrias commented Jul 27, 2018

Overview

Fix for https://issues.civicrm.org/jira/browse/CRM-21427 where websites tend to "disappear" without warning.

Based on the different existing issues and PRs, this PR mainly attempts to consolidate existing behavior, rather than changing anything too deeply, by showing an error when attempting to enter multiple websites of the same type. This seemed illogical for websites without types, and after some testing it seems we can safely allow multiple websites without types.

Before

The second website of any given type will be removed without warning when saving again.

After

Websites without type can be added at will without being removed. Websites with a specified type are only allowed to be added once for each type.

Technical Details

Not many technical changes, the unique website type is a UI validation. #11428 attempted to allow multiple websites of the same type and was reverted. This is partly because of assumptions about website types in templates. However no such assumption would be made for websites without types, as they've only been allowed since #11683.

As discussed in #11694 (point b), there doesn't appear to be a consensus that multiple websites types should be unique, but the current behavior is still counter-intuitive, as it "fixes" the problem silently in a way. Therefore this PR mainly explicitly prohibits the action that was previously suppressed implicitly.

Comments

Tested on CiviCRM 5.3.1

@civicrm-builder
Copy link

Can one of the admins verify this patch?

@civibot
Copy link

civibot bot commented Jul 27, 2018

(Standard links)

@eileenmcnaughton
Copy link
Contributor

add to whitelist

@eileenmcnaughton
Copy link
Contributor

@colemanw @yashodha @agh1 - you've all been involved in the PRs linked above

@eileenmcnaughton
Copy link
Contributor

test this please

@eileenmcnaughton eileenmcnaughton changed the title CRM-21427 - Allow multiple websites without type and only allow a single website of each type CRM-21427 - Add form validation to make it clear we only allow a single website of each type Nov 15, 2018
@eileenmcnaughton
Copy link
Contributor

I just gave this a whirl and the form validation changes are sensible & helpful. The BAO change seems to be from a long time ago - however - there are style errors so I will create a new PR

@eileenmcnaughton
Copy link
Contributor

closing in favour of #13097 as this has a style error. I left off the BAO change as that seemed a bigger question than the validation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants