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) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Removing 'County' field or setting default for proximity searching
Pages: [1]

Author Topic: Removing 'County' field or setting default for proximity searching  (Read 1910 times)

Durruti

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
    • The Kindling Trust
  • CiviCRM version: 3.4
  • CMS version: Drupal 6.20
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Removing 'County' field or setting default for proximity searching
February 22, 2011, 08:02:58 am
Calling all profile gurus,
I don't include 'County' on my address form for organisations, as all are in the same geographical area. However, this is causing problems with proximity searches were it is mandatory, even though whatever setting you make the same results are returned. Is there a way of removing the field from the UI or of setting a default 'County' in the same way you can for 'Country'?
Anyone had cause to investigate this before and if so anything to report?
Many thanks
Matt
« Last Edit: February 22, 2011, 09:30:21 am by Durruti »
http://feedingmanchester.org.uk

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Removing 'County' field or setting default for proximity searching
February 22, 2011, 10:00:00 am
Quote
Is there a way of removing the field from the UI or of setting a default 'County' in the same way you can for 'Country'?
Nope.

Country is mandatory for proximity search not county. So if you don't want to give that option you will have to modify the code to pass default country.

Hth
Kurund
Found this reply helpful? Support CiviCRM

Durruti

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
    • The Kindling Trust
  • CiviCRM version: 3.4
  • CMS version: Drupal 6.20
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Re: Removing 'County' field or setting default for proximity searching
February 23, 2011, 03:46:07 am
Hi Kurund,
Thanks for the response but I'm not sure I understand, I'm already the option to pass default country which works fine. My problem is that 'County' is also mandatory, even though that field is not included in my dataset and therefore the results are the same whatever I choose from the confusing list of 'County' options.
Many thanks,
Matt
http://feedingmanchester.org.uk

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Removing 'County' field or setting default for proximity searching
February 23, 2011, 10:56:48 am
Is your proximity search defined via a profile? Just edit the profile (Administer -> Customize -> CiviCRM Profiles) and change that field to not be required, or remove it from the profile.

Durruti

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
    • The Kindling Trust
  • CiviCRM version: 3.4
  • CMS version: Drupal 6.20
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Re: Removing 'County' field or setting default for proximity searching
March 10, 2011, 10:05:35 am
Hi demeritcowboy,
Sorry for delay in responding, been trying to understand it. The proximity search is defined via a profile, but the profile doesn't include county, I don't even include it in my address settings so couldn't use it if I wanted. I get this error message if county isn't filled.

"Country AND State/Province are required to search by distance."

Which is strange as State/Province isn't even an option and country is already set to default. If I put anything in the county field it all works fine (doesn't matter what I put as the information doesn't exist in my database, so can put "aberdeen city" or "wiltshire" and get the same results back). But very confusing for users...

I know it's community contributed code, was just wondering if anyone else had any experience before I start taking apart CRM/Contact/BAO/ProximityQuery.php

Many thanks,
Matt
http://feedingmanchester.org.uk

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Removing 'County' field or setting default for proximity searching
March 10, 2011, 10:57:27 am

hmmm

a bit wierd. can u try and reproduce this on demo. am playing with proximity search (for another issue) on advanced search and seems to work fine. I suspect its some "unknown" setting that triggers the bug on your install. not sure what/where/which setting it is

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Removing 'County' field or setting default for proximity searching
March 10, 2011, 10:59:12 am
Do you have State/Province on your profile? It's saying you need that field.

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Removing 'County' field or setting default for proximity searching
March 10, 2011, 11:00:16 am
And just in case to clarify: county and state are different things

Durruti

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
    • The Kindling Trust
  • CiviCRM version: 3.4
  • CMS version: Drupal 6.20
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Re: Removing 'County' field or setting default for proximity searching
March 15, 2011, 07:23:35 am
Lobo: thanks for looking at that, I'll let you know if I find the mystery setting.

demeritcowboy: I don't have 'State/Province' or 'County' collected for my contacts, I've unchecked the boxes in 'Global Settings' -> Address Settings (/civicrm/admin/setting/preferences/address&reset=1). So I couldn't enable them for my profiles even if I wanted to, they don't exist in my database. As I say what seems stranger is that it's the 'county' field that appears in the search form but the error is about 'State/Province' and 'Country'.

I've tried it on the test site, having disabled 'State/Province' and 'County'. I don't see the county field but I do see the 'State/Province' field and get the message that "Country AND State/Province are required to search by distance" if I do a search without this field completed.

See the problem on my live site:
http://feedingmanchester.org.uk/civicrm/profile?reset=1&gid=35
See the problem on CIviCRM test site: http://drupal.demo.civicrm.org/civicrm/profile?reset=1&gid=11

This is more predictable behaviour, than the 'County' field problem, I am seeing, but isn't actually factual as certainly from a UK experience proximity searching works perfectly from postcode or city (with the default country field already filled in). Is the solution going to be to introduce a 'State/Province' field into my addressing? Then I can at least start collecting that information so that it works, which is not a major problem for me as we are dealing with a very localised project or only a couple of provinces. But is there a way removing the restriction of having this as a mandatory field, especially as it doesn't relate very well to the UK context (so I imagine most people will have it disabled)?
Many thanks again.
Matt
« Last Edit: March 15, 2011, 07:26:22 am by Durruti »
http://feedingmanchester.org.uk

Durruti

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
    • The Kindling Trust
  • CiviCRM version: 3.4
  • CMS version: Drupal 6.20
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Re: Removing 'County' field or setting default for proximity searching
March 15, 2011, 07:43:14 am
Having checked what's in the county field dropdown list, it appears to be showing the same information as I see in the 'State/Province' field on the test site, so it's probably just a labelling problem.

However, I can't enable the the 'State/Province' field as it will break my dataset because it includes towns, cities regions and counties in the same list (I know some work was done on this to strip these out before 2.0).
So in my context in the North of England - a project in Oldham, might select from the current dropdown list Oldham (which is a town), Greater Manchester (which is a city region) or Lancashire (which is a county). All would be correct, but would break the results that the user gets searching on those criteria.

Any thoughts, I'm very happy to do manual editing and contribute back but am a bit lost here as to the best way forward.
Many thanks,
Matt
http://feedingmanchester.org.uk

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Removing 'County' field or setting default for proximity searching
March 15, 2011, 08:28:06 am

hey matt:

maybe try implementing a the buildform hook for that form (profile?) and remove the requirement of state for your install. If the geocoder returns a valid geocode in the UK case then we are all fine and thing should work. let us know how it goes and/or ping us on irc if u r stuck

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Removing 'County' field or setting default for proximity searching

This forum was archived on 2017-11-26.