CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Defaults without defaults
Pages: [1]

Author Topic: Defaults without defaults  (Read 1261 times)

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Defaults without defaults
October 21, 2009, 01:56:41 pm
Another for my short book "Edge Cases of the Southern Seas" ...

On two client sites now, an admin has disabled the "Default" location type.

This causes all manner of weird and wonderful ripples throughout the system, such as: when registering a new user via the parent UF, the associated contact record will be created but no email address will be assigned to it.

The per-site fix is to check the default box. Easy enough, until someone else comes along six months or a year later (and maybe at a different client install) and unchecks it, and various things stop working again. So I think a code fix is indicated :)

One fix would be to require via the UI that one location type was set to "default".

Another (simpler, IMO) fix would be to change the format of the query in CRM_Core_BAO_LocationType::getDefault() so that it's of the form,
Code: [Select]
SELECT * FROM civicrm_locationtype ORDER BY is_default DESC, name LIMIT 1 rather than
Code: [Select]
SELECT * FROM civicrm_locationtype WHERE is_default = 1 LIMIT 1. Should produce the same end result and allow CiviCRM to fall back to any other location type that is configured when none is set to default.

Personally, I rather like
Code: [Select]
ORDER BY is_default DESC, RAND() ... it seems fairer. Just an idea.

Observed on 2.2.x, not sure if it came through to 3.x.
@xurizaemon ● www.fuzion.co.nz

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Defaults without defaults
October 21, 2009, 02:41:12 pm
I think it makes more sense to not allow user to disable the Default location type. I verified that you can still do this in 3.0, so please file an issue for 3.1 to prevent this operation in the UI.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Defaults without defaults

This forum was archived on 2017-11-26.