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 CiviContribute (Moderator: Donald Lobo) »
  • v4.3.4 Seems to reject searching for Custom field value with single quote
Pages: [1]

Author Topic: v4.3.4 Seems to reject searching for Custom field value with single quote  (Read 495 times)

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
v4.3.4 Seems to reject searching for Custom field value with single quote
April 24, 2014, 07:29:48 pm
A client of ours we recently upgraded to CiviCRM 4.3.4 on Drupal 6 as that was as far as we could upgrade them on their legacy server. (The incremental update for 4.3.5 caused a MySQL crash with their old version of MySQL, so we ended up leaving well enough alone until the site moves to the new server. At that point we will upgrade the rest of the way to current release.)

Anyway, 4.3.4 appears to have broken the ability to search contributions based on a custom field which is a pick list of values. Specifically there is one value in the pick list with a single quote character (Children's) as the word is suppose to be possessive.

I went searching through the database as to why that one pick list value is causing so much trouble. Other values of the one custom pick list field appear to work as expected, as at least searching with other criteria has a result set.

And since it is a combo box pick list, I am unable to escape the single quote character.

I noticed in the DB that the custom pick list values are verbatim statically duplicated over and over for each record needing to refer to the particular pick list value. I find the value stored in table "civicrm_value_solicitation_methods_3" field "purpose_56 varchar(150)".

May someone simply reply yea / nay as to if a single quote being contained within a custom field pick list value should be possible to search based on in CiviCRM 4.3.4? I would think that CiviCRM would itself need to be doing some sort of single quote safe search, or be escaping the single quote within the search string since CiviCRM has verbatim statically placed the actual value in the field.

I am thankful,
« Last Edit: April 24, 2014, 07:45:27 pm by mdlueck »
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

capo

  • I post occasionally
  • **
  • Posts: 108
  • Karma: 5
Re: v4.3.4 Seems to reject searching for Custom field value with single quote
April 25, 2014, 05:25:08 am
What happens when you try to perform the search? Do you receive an error message? Or it just doesn't show the correct results?

I'm not sure but I think that values aren't supposed to contain single quotes. Instead, value should be something like "childrens" (no special characters). You can, anyway, maintain the quote in the label, so users will still see it in the possessive form.

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: v4.3.4 Seems to reject searching for Custom field value with single quote
April 25, 2014, 07:41:34 am
Greetings capo,

The search executes with an empty result set.

So, what steps are advised to clean up the single quote which is now in numerous records?

I do see the two fields you alluded to: Option Label and Option Value. Will CiviCRM retroactively adjust existing records if I remove the single quote from the Option Value?

I am thankful,
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: v4.3.4 Seems to reject searching for Custom field value with single quote
May 09, 2014, 04:28:45 am
To follow up with this thread:

I renamed the Custom Data » Custom Data Fields » Purpose - Multiple Choice Options entry:

"Children's Hospital" to "Childrens Hospital"

This did not clean up the existing data. I found this out via some custom SQL, and thus changed the legacy data to match the current pick list value:

Code: [Select]
SELECT *
FROM `civicrm_value_solicitation_methods_3`
WHERE `purpose_56` LIKE 'Children%'

SELECT *
FROM `civicrm_value_solicitation_methods_3`
WHERE `purpose_56` = 'Children\'s Hospital'

UPDATE `civicrm_value_solicitation_methods_3`
SET `purpose_56` = 'Childrens Hospital'
WHERE `purpose_56` = 'Children\'s Hospital'

Solved!  ;D

I am thankful,
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • v4.3.4 Seems to reject searching for Custom field value with single quote

This forum was archived on 2017-11-26.